Making DVD Movies
Posted: Mon, 26 December 2005 | permalink | No comments
I recently came into posession of a collection of (smallish) WMV files containing photo slideshows. Unfortunately, they don't play on my DVD player, and SWMBO's laptop has No Hope of playing anything remotely like a video. So, technology to the rescue.
Initially, I was just going to convert the movies into something that the DVD player would actually play, but by the time I had those, I was 95% of the way to doing the job properly, and it would (of course) look far nicer with menus and other Shinyness (instead of just a boring file menu), so I went all the way and made a complete DVD movie disc.
The whole process was non-trivial to discover, but ultimately straightforward in practice (once you know the set of command line options to use), so I'm archiving this for posterity.
I use Ubuntu Breezy. A lot of the packages I've used are under really heavy development, so slightly older versions may not work. If you're running another distro, finding compatible versions may be tricky (or not). Try the process with whatever you've got; if it works, great; if it doesn't work, try upgrading versions or something.
Step 1: Convert Video Files To Something Less Bong
Packages used: transcode 1.0.2-0ubuntu2 (trivial backport from Dapper; mail me if you want it, but the one in Breezy will probably work OK), mplayer 1.0-pre7cvs20050716-0.1ubuntu9, mjpegtools 1.6.3+rc2-0.0ubuntu2
As far as DVD players are concerned, WMV is non-existent (clever things). DVD players like some form of MPEG-2 video with AC3 or MP2/3 audio. So, we use transcode to convert the video. For WMV files in particular, only mplayer does the decoding right (the af6 plugin seemed to work, but the resizing didn't turn out too well). So, our command is:
transcode -x mplayer -i $FILE.wmv -g 640x480 -e 44100,16,2 -o $FILE.tc --export_prof dvd-pal
Items of note:
- -g 640x480 is necessary because transcode currently can't ask mplayer for the size of the video. This will apparently be fixed in the near future, but until then, work out what size your input video is (run mplayer manually and look at it's output) and substitute for 640x480 in the above.
- -e 44100,16,2 exists for a similar reason to the above -- it's the sample rate, bits/sample, and channels of the incoming audio stream. Again, retrieve by running mplayer manually until transcode knows how to ask nicely.
- I've used -o $FILE.tc because what actually comes out of this transcode step is a separated audio/video stream, which needs to be multiplexed into a single stream (see next step). You actually get $FILE.tc.m2v and $FILE.tc.mpa files (the extensions get automatically appended).
- --export_prof dvd-pal sets a bunch of options behind the scenes so that everything gets output as PAL-compliant DVD video. Much easier than the alternatives. dvd-ntsc works nicely too, if you're stuck somewhere without decent chroma control.
As I mentioned, the output from the transcode run is two separate streams -- an audio and a video stream. We want to combine them. This is quite easy:
mplex -f 8 -o $FILE.vob $FILE.tc.m2v $FILE.tc.mpa
This is a simple "glue them together" command -- the only interesting bit is -f 8, which simply specifies a particular MPEG-2 multiplexing method. Without this option, you will tend to get very jerky and stop-start output -- hardly useful. Adding this option solves all that.
Since you'll probably have a bunch of video files to convert at once, you'll want to automate all of this with a shell script or shell 'for' loop.
Step 2: Make a DVD Layout
Packages used: qdvdauthor 0.0.10-0.1
This is the bit that I thought would be hard, but is actually amazingly easy (the previous step took me two days to get completely right, this bit took me about an hour).
Fire up qdvdauthor, answer any stupid questions it might come up with. When the main screen comes up, click on the 'Add Movie' button on the left hand side, then select the first video you want to add. Repeat as required to add all of the videos you want. (Remember to add the VOB files you created earlier, and not the WMVs you might still have laying around. D'oh!)
Clicking on the 'Video' tab on the left hand side should list all of your videos. Check they're all there, and are the correct size.
Next, create or find a suitable background picture or video to make your main menu background. I've only tried with an image, but it seems to accept videos if you give them to it. Click on the 'Add Background' button on the main qdvdauthor screen. Pick your image. The image will probably need resizing; just go with the flow and pick the correct image size.
Now you need to add those funky little menu items for selecting on. This is the really cool bit. Right-click on the background image you've got, and select 'Add Text'. Drag on the background to create a text box. You'll get a dialog come up, type some text in the bottom box, then click 'OK'. This'll create the text on the background. Drag it around if you need to. Finally, right-click the text and select 'Define as Button'. Another dialog box will appear. Rename the button if you like, then pick which video you want to play from the select box marked 'vmgm'. Click 'OK'. Repeat as necessary.
That's all the hard stuff done. You can add a sound clip to play over and over again if you like, but I haven't done that yet, so you're on your own there.
Step 3: Make the DVD
For this step, I needed to compile toolame from source. Get it from http://toolame.sf.net/.
This is super-simple. Basically, just click on the giant icon labelled 'DVD' in the top toolbar. Follow the prompts. Click 'OK' as necessary. When the process is done, check the 'Keep Open' checkbox quickly, and go over the output to ensure nothing completely crapped out.
Assuming all is well, you can make your DVD image by running:
mkisofs -dvd-video -udf -o /tmp/dvdimage.iso $DVD_DIR
Naturally, replacing /tmp/dvdimage.iso and $DVD_DIR with appropriate values.
Lastly, cook the ISO to appropriate media with something like:
cdrecord -dao -eject -v speed=2 dev=1,0,0 /tmp/dvdimage.iso
Assuming all went according to plan, you should have a physical DVD you can stick in your DVD player and watch to your heart's content. Congratulations! You just did all of this in about a 50th of the time it took me.
Post a comment
All comments are held for moderation; markdown formatting accepted.