Burning Video DVDs on Linux
(initial version 2006-07-22)
Whenever I looked at the situation with DVDs on Linux -- that is, burning DVDs that you could play in your DVD player -- I ran away scared because the only answers I could find were "use transcode", and transcode is a command-line (no, I'm not afraid of the command line) program with many many cryptic options, and which requires you to read an encyclopedia to even understand the manual page. There didn't seem to be any easy way of burning your own DVDs. Then I found Howto author AVI->DVD with menus using Linux only in the Gentoo forums, which laid out all the steps, more or less. But there were still a lot of steps. I figure that any sequence of commands which has more than three commands in it, is a prime candidate for being scripted. And the author there did, indeed, write a script. Which I downloaded and used. But it was buggy. So then I tried various other things, and couldn't figure out what options to use, or they would crash, and so on. But now I have hit on a good combination of programs, reasonably nice GUIs, to simplify the process for someone who doesn't want any fancy options. Note that most of these are GUI frontends to other programs, and thus have dependencies on them, but any reasonable packaging system should install those other dependencies for you.
Getting the initial content
Before we start, we need to get the video content. Sometimes one is already starting with an .avi file, but sometimes one isn't.
- mplayer to extract VOB files from an existing DVD
I have a DVD recorder, but the format it saves the data in is non-standard The DVDs can be played in that machine, and on my computer, but not on other machines. And it has a really crappy DVD menu that one can't change.
So, one way of solving this is to let the DVD recorder record away on a DVD, take the DVD, extract the audio-visual streams and re-make it all and record onto another DVD.
To extract the contents of the DVD, use mplayer, as follows:
mplayer dvd://1 -forceidx -dumpstream -dumpfile filename.vob
That gets the first title, and forces reindexing. At least in theory. I've been having trouble with it, since it seems to play okay, but when I dump the stream with mplayer, the audio is out of sync with the video. I don't know why, or whether it was just with that particular DVD I was trying with.
So, if that doesn't work, bring out bigger guns: ProjectX
- Mount the DVD
- Start ProjectX
- Point ProjectX at the VOB files in the VIDEO_TS directory on the DVD. In my case, one needs to select all of them, because they're broken up by size, not by content.
- Select "demux" in the "prepare" settings, because that is the one that corrects errors in the streams. This will give you two files, the video and the audio files. One can split these in Avidemux. (I'm not sure whether one can split them in ProjectX; I tried, but it didn't do what I expected.)
- Take these files as input to avidemux. Start up avidemux, then use the File menu to open the video file, and then use the Audio menu to add the audio file as an external stream.
But ProjectX is not always useful. Sometimes one has an AVI or MPEG file which is sort of okay, but when one runs it through avidemux, the result is jerky or the sound doesn't sync (one can check this by hitting the "play" button in avidemux to test the file first).
In that case, it may be worth re-encoding the file, and then using the re-encoded file in avidemux. Here's a command I've found useful:
mencoder -ovc lavc -oac lavc -lavcopts \ vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:dc=10:vstrict=0:acodec=ac3 \ -vf harddup infile.avi -o infileA.avi
For converting to and from other formats, http://en.linuxreviews.org/HOWTO_Convert_video_files is a good resource.
Converting to MPEG
- avidemux to convert .avi (or VOB) to .mpg
(See also Avidemux Wiki)
Using version 2.1.2; the page I originally found about it had an older version and I couldn't figure out the right options. However, with trial and error, I finally did.
This gives you a GUI. Under the settings, I picked "PAL" as my format of choice. I can't say how things go with NTSC.
Under "Video", there is one menu and two buttons. Choose the following:
- DVD (lavc) this is DVD-video, and faster to generate than the straight "DVD" option.
- Configure window:
Encoding type: Two pass (better quality)
Size (MBytes): the default is 700; if your original file is larger than this, then make this size larger to preserve better quality.
Aspect Ratio: 4:3 unless you have a HDTV to show them on
everything else leave at default
- Filters window:
pick the DVD res option, and leave both the source and destination aspect ratios at 1:1 (I fell down on this one). This will give you a nice letterbox around your video if you need one.
%navy%Tip:If the input file already has a letterbox around it, but isn't in the desired resolution for you, then Add the Crop filter before adding the DVD res filter.
Under "Audio", there is one menu and two buttons. Choose the following:
- FFm AC3 (the audio format for DVDs)
- Configure: (fine to leave everything at default, unless you want to increase the bitrate for the sound)
- Filters: choose the Normalize filter and leave everything else at the default.
Under "Format" there is one menu. Chose MPEG PS A+V (which is mpeg2 format with the Audio and Video streams combined together).
After you've set all your settings, click File -> Save -> Save Video, and give it the name of the mpeg (.mpg) file you want to create.
It will then go off and churn away to itself for an hour or two, and when you come back, you will have a nice MPEG file, suitable for using with your DVD "menu builder" program.
Make the DVD menu and structure
- dvdstyler to go from .mpg to DVD iso with a simple menu
Using version 1.4 (though I gather 1.5 is better).
This is a simple GUI program for taking mpeg files, building a DVD menu, and creating the proper DVD files suitable for burning to DVD.
Note, however, that it has a bug if you are using mjpegtools version 1.8 rather than version 1.6, but there is also a workaround.
Using DVDStyler is fairly straightforward; first click on the "Directories" button, navigate to your chosen directory, and drag-and-drop your mpeg files into the area at the bottom. Then click on the "Backgrounds" button and select the background you want for your menu. Then click on the "Buttons" button and drag your button to where you want it on the menu. Then right-click on the button and select "Properties" to edit the properties of the button (which title it links to, what the label contents are, the colour, the font, the font-size). I only wanted really simple menus, so I just made one top-level menu which linked to just the titles (didn't bother with chapters).
Then, when that's all done, select File -> Burn dvd... and the Burn window will pop up. I found it simplest to select the create iso image option, because that makes burning it easier.
It is also possible to make your own background image if you want. I used GIMP to make mine. For PAL format, start up gimp and select File -> New and click on the Template menu and select PAL. However, that's not enough, you also have to click on Advanced Options because you have to tweak the X resolution and the Y resolution:
X resolution: 75 dpi
Y resolution: 80 dpi
(don't ask me why, it's wierd PAL thing)
Then play around and have fun making your background image. Saving it as JPEG is fine.
Then, in DVDStyler, when you are in the Directories section, drag your background over to the menu area on the right, and it will use that as the background rather than the pre-defined ones.
Another thing you can do is do a screen-capture of a frame from one of your chosen mpeg files, and use that as your background image. Or start with a screen-capture and modify it a bit. I've found that xine is good for getting screen-captures.
Another good DVD-authoring GUI program is qdvdauthor; it is less simple and gives you more options.
Testing the .iso file
Creating the .iso file may make burning the DVD easier, but it does make checking it before you burn it a little more complicated. When the .iso file is created, you need to mount it as a "loop" so that your player (for example, xine) can read the files on it.
mkdir /mnt/iso # make the dir if it doesn't exist mount -o loop -t iso9660 filename.iso /mnt/iso # may need to be root to do this xine dvd:///mnt/iso
Then when you've checked to see if the iso is okay, don't forget to unmount it when you've finished.
Alternatively, you can use vlc on the .iso file directly.
Burning the DVD
- k3b to burn the .iso file to the DVD disc
"k3b" is a KDE CD/DVD burning GUI program. Click on the Tools menu and select Burn DVD ISO image. It's all fairly straightforward.