Burning MPEG4 to DVD From Linux

By | 2013-04-20

(TODO: Find out how to get aspect ratio correct.)

Sometimes you want to turn an MPEG4 (or anything else you might have) from, say, your digital camcorder into a DVD that is playable on a standard DVD player. It’s not quite as simple as it should be, but it is a mechanical sequence.

First we need to convert the arbitrarily encoded source video into DVD standard MPEG-2 video. ffmpeg (soon to be avconv) has a handy command line switch to handle all the details of DVD video for us.

$ ffmpeg -i YOUR_HOME_VIDEO.mp4 \
    -target pal-dvd \
    YOUR_HOME_VIDEO.mpg

DVD players need more than just a compatible video file; they need a whole filesystem (VIDEO_TS) with the video file(s) correctly named. dvdauthor can do this for us.

$ export VIDEO_FORMAT=PAL
$ dvdauthor -o YOUR_HOME_VIDEO_DIR -t -f YOUR_HOME_VIDEO.mpg
$ dvdauthor -o YOUR_HOME_VIDEO_DIR -T

-o specifies the output directory. The first call here adds our MPEG as a title (you can repeat this for as many inputs as you like), then the second (or final) call creates the table of contents from those titles already added.

Video DVDs are almost identical to data DVDs, with a specially arranged filesystem. Our YOUR_HOME_VIDEO_DIR directory is that specially arranged filesystem. However, video DVDs are special and need a bit more than just the files on the disc. We must tell our DVD burner to set the “video” flags so files are organised for optimised access by DVD players and to order the video files to a standard and pad as necessary.

$ growisofs -dvd-compat -speed=2 -Z /dev/dvdrw \
    -dvd-video YOUR_HOME_VIDEO_DIR/

Note the -dvd-video flag; without this you’ll just get a data DVD and despite having the video perfectly stored on disc, it will not play in a normal DVD player. The -speed=2 is entirely at your discretion – some combinations of media and player will be more or less successful depending on how fast the burn is performed. -dvd-compat will help with some older DVD players and -Z tells growisofs that this is a fresh DVD, not a continuation of a multisession disc.

Done. You can now delete the intermediate MPEG2 file, YOUR_HOME_VIDEO.mpg and the filesystem staging directory, YOUR_HOME_VIDEO_DIR/.

Leave a Reply