Create Self-Booting Movie CDsby Robert Bernier
I love my son and try to give him what he needs in life. Sometimes I even give him what he wants, too. He has a nice bike that he uses quite a lot, and he is always out and about. Of course he has his own PC, which is online 24/7 while he constantly surfs for sports car images. For some strange reason, the teachers at his primary school thinks he's some sort of genius, as he's always telling them that Windows sucks and the TCO is much less when using Linux. At times I think I let him have too much; I have let him play games on a Windows machine. Then, of course, at age 11 he broke my collarbone and all I did was lecture him on his propensity for causing "incidents."
However, sometimes I put my foot down. One example involves my DVD collection. I don't trust him with those little discs of plastic and dreams. We sometimes have debates about what he's allowed to watch, and often he wants to take my DVDs to a friend's house, which I absolutely forbid. What's a father to do?
The answer is to make a copy to watch on the PC.
Before diving into the guts of the article, please keep in mind that I'm not suggesting you do anything illegal. I shudder to think that some evil person will impoverish an unassuming multinational corporation by depriving it the opportunity to make a small profit off a piece of entertainment geared for the unwashed masses. That's why the United States has such wonderful laws protecting companies' rights. (Did I tell you that I live in Canada?) Instead, I implore you to use the following approach only for DVDs unencumbered by licensing issues.
Creating a movie involves a few software and hardware considerations:
- The PC that plays the movie must have a CD reader as its primary boot-up device. It should have a Pentium III or better CPU.
- The PC used to create the movie must have a DVD reader, a CD burner, and at least 2GB of free space.
Making these movie backup copies requires several distinct utilities, including:
- Lame, the MP3 encoder
- Mplayer, the premier movie player, which can also translate the DVD's native encoding to AVI
- transcode, a Linux text-console utility for video streams that includes a utility to break a large AVI file into smaller ones
- eMoviX, a mini live Linux OS burned onto a CD, which permits the CD to boot and auto-magically play all of its files with Mplayer
- mkisofs, which of course creates the ISO image
- cdrecord, the ubiquitous CD-burning software
- growisofs, for those people who have a DVD burner
It looks pretty daunting, doesn't it? Just look at all those utilities that you need to create your movie.
Actually, you can make things work with very little knowledge by using one more utility that ties all of the above together: K3b. K3b is a CD- and DVD-burning application for Linux systems optimized for KDE. It provides a comfortable user interface for performing most disc-burning tasks.
The Moviemaking Routine
Here are the steps you should follow:
- Read the DVD and convert it into an AVI.
- Break the completed AVI into files small enough to fit onto a CD.
- Use K3b to create a new eMoviX project/CD for each AVI volume.
- Burn away.
Now let's start putting the pieces together.
Ripping the DVD Using Mplayer
Of all the utilities, Mplayer is not only the most critical but also the trickiest to set up and use correctly. There are lots of good references, including the Mplayer home page and, from this site, Video Playback and Encoding with MPlayer and MEncode and DVD Playback on FreeBSD.
Note: Adding to the complication is the fact that several Linux distributions don't supply Mplayer. Those that do tend to hobble its capabilities in order to avoid running afoul of legal restrictions. The best approach is to download Mplayer directly from its web site. You'll also need to download the required codecs (a form of technology used to compress and decompress video data) too.
First, install the codecs on your machine, usually to
/usr/local/lib/codecs/. Then configure and compile Mplayer.
Ironically, for all Mplayer's complication, you can create your AVI by using this one incantation from the command line:
/usr/local/bin/mencoder dvd:// -o temp.avi -ovc lavc \ -lavcopts vcodec=mpeg4:vhq:vbitrate=1800 -oac mp3lame -lameopts \ cbr:vol=3 -aid 128
Let's break down the above command.
/usr/local/bin/mencoderis the Mplayer command utility to use.
dvd://identifies the device from which the utility reads. You can also add a track number to use a track other than the default, at
-o temp.aviis the name of the AVI file to create.
-ovc lavcwill use the libavcodec codec to compress the video data.
-lavcopts vcodec=mpeg4:vhq:vbitrate=1800provides further information to the libavcodec codec on how to construct the resulting file.
For the most part, you don't have to worry about this option. However,
vbitrate=1800is crucial to the screen size of the movie. This particular setting, for example, sets the whole screen for a 17-inch monitor. Reducing the number reduces not only the screen size but also the file size! Halving the number means you can fit 2 hours on one CD, rather than 1 hour.
-oac mp3lameencodes the audio track to the MP3 format.
-lameopts cbr:vol=3sets the bit rate method and the volume input for
lame's sound encoding.
-aid 128chooses the audio stream (language) to use. DVDs often have more than one language sound track for a given recording. The number
128, for example, is the industry's identification number for the English language.
Normally, you don't need to worry about this either. In my case I often use the number 129 for the French language sound track. I add the
-alang frcountry identification switch too.
It's a good idea to test the command first, since the encoding process will take several hours. The most common encoding mistake involves recording the sound improperly, and you'll hate to find out you'll have to repeat the wait. Doing a test recording is pretty simple. Add the following switches to the above command invocation:
-endpos 30 -ss 00:10:00
This will cause Mplayer to record for a period of 30 seconds at about 10 minutes into the DVD recording.
There's often more than one track on a DVD. You might want to record
something other than the first track. The easiest solution is to simply play
the tracks until you find the one you're interested in. For example,
mplayer dvd:// plays the first track by default;
dvd://1 plays the first track explicitly; and
dvd://2 plays the second track explicitly.
There's more than one command incantation that will create an AVI. It's all a question of experimenting with the different video and audio codecs. For example, you can restate the command where it copies the audio stream directly into the AVI without converting it to MP3:
/usr/local/bin/mencoder dvd://1 -endpos 30 -ss \ 00:10:00 -o temp.avi -ovc lavc -lavcopts \ vcodec=mpeg4:vhq:vbitrate=1800 -oac copy -aid 128
This incantation will normally result in a 1.4GB AVI.
Play back the ripped recording by running Mplayer:
Breaking Up the AVI
The transcode suite of utilities is ideal for video stream processing. That's exactly what we want to use here.
Transcode doesn't require too much in the way of existing libraries to compile; however, you should pay close attention to the summary printed at the end of the configuration to see exactly what libraries it has found and what the resulting binary can do. Refer to Table 1 for an example output. You may have to play with the configuration paths if transcode doesn't find libraries that you know exist on your system.
|Summary of transcode 0.6.11 features|
|Static AV-frame buffering||yes|
|Support for network (sockets) streams||yes|
|DVD navigation support with libdvdread||no|
|Link against local Lame library (>=3.89) | ver||no | static|
|nasm-dependent modules (bbmpeg)||yes|
|Ogg support | Vorbis support | Theora support||yes | yes | no|
|Default xvid export module||xvid2|
|liba52 audio plugin (>=0.7.3) | default decoder||no | yes|
|avifile API support||no|
|ImageMagick-dependent modules (>=5.4.3)||no|
|libjpeg-dependent modules | mmx accel||yes | no|
|Experimental v4l support||yes|
|Experimental lve support||no|
|libfame video encoding plugin||no|
|libpostproc-dependent filter plugin||no|
|X11-dependent filter plugins||yes|
|freetype2-dependent filter (filter_text)||no|
Pages: 1, 2