HOWTO: Rip DVDs to a MythTV server and consolidate your home video for easy access to your media.
MythTV is an open source DVR solution that supports recording of live video broadcast and playback of recorded material. It also supports the direct import of DVD content. But if you’ve got multiple DVD players spread across different computer systems and a need to control disk space usage on your MythTV backend, AcidRip offers a more flexible option.
DVD’s contain a number of files, the most important of which to the average home user are the transport stream files which contain the video and audio content. MythTV and its video plugin, MythVideo, will playback video in a variety of file formats.
While you could simply rip the video and audio files from the DVD without conversion to a new format and store the files under appropriate directories on your MythTV backend, unconverted DVD files will require far greater disk space than really required. For most home users, converting the DVD files to a file format with smaller file sizes and equivalent quality is a more realistic solution.
An ideal file format for MythVideo is AVI. AVI is known as a container format since it includes both audio and video in a single file. The AVI format specifies how the two should be stored within the file but it doesn’t specify the encoding methods that should be used. Therefore, MP3 audio and MP2 video can be stored inside the AVI. Using these encodings allows us to tell whatever tool we use to create the AVI to use settings that reduce the overall size of the output file.
You can find a number of solutions for ripping and converting DVD files to AVI files. Many are command line tools that offer huge sets of options, making them extremely sophisticated but far too complex for the average home user. Two of the most most popular of these command line tools are transcode and mencoder. Most desktop tools for ripping DVDs tend to use the command line tools (or often the lower level ffmpeg library) to support their features.
There are two very popular graphical tools for ripping your DVDs: AcidRip and DVD::Rip. DVD::Rip is the higher end tool intended for those with either more experience with video files or finer grain requirements. DVD::Rip is a GTK+-based wrapper around transcode, a suite of command line tools that utilize the powerful ffmpeg library for video support. AcidRip, on the other hand, is a less complex solution for the non-technical user who just wants digital copies of his movies for use with MythTV.
AcidRip is a GTK2-Perl program that provides a graphical user interface to the popular and sophisticated mencoder program. Mencoder is a command line utility based on the same code as the MPlayer video player. Because it is based on MPlayer, it can read any of the same video file formats that MPlayer can.
That also means that mencoder, and by association AcidRip, can perform a large number of video transformations including scaling, cropping, and color and bit rate conversion. Fortunately, you don’t need to understand all this in order to get a high quality rip of your video content using AcidRip since AcidRip provides extremely good default mencoder settings for you.
Prerequisites and Installation
AcidRip requires GTK2-Perl, mencoder and libdvdread. It also requires lsdvd, a utility for reading the directory contents of a DVD disk. Fortunately lsdvd is included with AcidRip itself so you don’t need to look for it elsewhere. Finally, you’ll need appropriate tools for audio conversion.
AcidRip can use mp3lame, libavcodec, and libfaac based codecs. All of these are likely to be readily available packages for your favorite distribution. I use Fedora 7 and was able to install all the required packages with yum:
yum install acidrip
To start the program, type the name in lowercase,
Figure 1: The AcidRip Window
The window that opens might look a little intimidating at first glance, but for our simple case there is little that needs configuring. The window is divided into three main pieces: the tabs (upper left), the Video Source and Status (right side) and the command buttons (four buttons on the lower left). I’m only going to cover features you will need to modify or that might raise some questions. If I don’t discuss it, you can safely ignore it.
The AcidRip Configuration Tabs
Before we get to configuring for your first rip, check the Settings tab. The mencoder, MPlayer and lsdvd settings should be set to the appropriate program names. You can also cache the DVD contents before encoding but that isn’t necessary. I suggest clicking on Overwrite Files since there are times you’ll want to repeat the rip, such as problems with a drive or, as happens occasionally, AcidRip doesn’t properly scale the video to the requested size.
Returning to the General tab, after placing the DVD in the drive you need to enter the device path for you DVD player under the Video Source. This is usually /dev/dvd which is likely to be a symbolic link to another device file such as /dev/sr0. You can use either device file name. If you aren’t sure what the device name is and you only have one DVD/CDROM player installed on your system you can run the following command:
dmesg | grep sr0
The output should include a message similar to this
sr 0:0:1:0: Attached scsi CD-ROM sr0
If it does then your DVD device path is probably /dev/sr0. If not, then you’ll need to look through the output of dmesg manually to find the device path. Once you have the path, enter in the Path field under Video Source and click on the Load button. This will read the contents of the DVD in the drive. The DVD contents are shown in the tree below this, one track per top level of the tree and multiple chapters beneath each of those. Each entry is numbered with the time for each track or chapter.
Figure 2: The Video Source and DVD contents tree
Generally, the largest track is the one you’ll want to select. AcidRip does a good job of making this selection for you but if you find it’s the wrong track then you can just manually select it in the tree.
After loading the DVD contents you’ll also notice the Track Title (upper left of the General tab) is filled with the track title. This is often in lower case with spaces converted to underscores. For use with MythVideo you’ll want to change this to the same name that is used for the DVD in the IMDB database. This will make collecting the IMDB metadata about the movie automatic later when you add the ripped video to MythVideo’s database.
After setting the Track Title you need to specify where the output file should be stored and it’s file name. For MythTV, it’s useful to export your video directories from your MythTV backend using NFS. I create a directory just outside of the MythVideo directories, which I call /store/rip, to store the files created by AcidRip.
Later, after manually double checking the quality of the rips, I copy the files to the appropriate subdirectories of my MythVideo directories. The Filename includes the rip directory and is suffixed with
%T so that the Track Title you set will be used as the real filename.
Figure 3: General tab with Filename field highlighted
Two fields of importance in the General tab are the File Size and #Files field. The latter should be set to one so that AcidRip produces a single output file. A single file is preferred (about 1GB per hour of video is normal) for use with MythTV unless you don’t mind having to configure multiple files in MythVideo. The File Size should be set to between 1400 and 2200 (this is in MB) for best quality.
In the Audio section of the General tab you’ll find the Language, Codec and Gain fields. AcidRip is good at selecting the proper English language track so it’s not likely you’ll have to change this. The codec should be mp3lame, lavc, or faac, though I’ve only used mp3lame to this point. I’ve heard that lavc may be preferred as mp3lame can (at times) have audio sync problems if you use MPlayer to play the ripped files. I haven’t experienced this issue in any rips with mp3lame and even if you do you can switch to Xine or VLC to avoid the problem.
The audio gain can be increased or decreased if you find a rip whose volume is too low or high (respectively). However, I’ve never found a need for this and you’ll only know you need it if after you’ve ripped the DVD the first time.
In the Video tab you’ll need to set the Codec to lavc and number of passes to one (more on this when I talk about quality considerations later). Why lavc and not some other codec? The x264 setting is actually the H.264 codec, also known as MPEG4. While this can produce equivalent quality at smaller file sizes it may not be supported with hardware decoding.
For my MythTV frontend, for example, I have an EPIA M10000 board which provides hardware MPEG2 decoding. The choice is dependent in your hardware. If you have no MPEG hardware decoding then you might want to Xvid or even NUV which may be decoded faster by your CPU.
Figure 4: Video Tab
The Bitrate and Bits/Px field will automatically be updated as you change the file size in the General tab. An important thing to note here is that the Bits/Px will be red if the image quality is too low. Increase the file size to raise the Bits/Px till the value is displayed with black characters. If you hold the mouse over this field you’ll also get some text telling you the setting is too low or just right, and if it’s too low you’ll get some suggestions on how to improve it.
The next section in the Video tab is for finding and removing the black bars in widescreen videos. If you enable this option (the Crop button will have a checkmark) and click on the Detect button then AcidRip will read some random areas of the video to try and determine if there are black bars and how much of them it can safely crop out. We’ll see later that you can adjust this using the Preview tab later.
After the Crop section comes the Scaling section. For videos you intend to display on TV (not High Definition, just standard TV) you should scale the video to 740×480. Uncheck the Lock Aspect button if you AcidRip doesn’t let you update the height appropriately. Be sure the Scale button is checked too. Note that most DVDs will scale reasonably well to this size but if you find one that doesn’t then adjust the size down. You can always scale the picture up again when you play it in MythVideo (though with some video quality degradation).
Changing the Scale height and width will affect the Bits/Px field. If the field goes red again, leave the scale alone and opt for a larger file size. If you’re truly stingy with disk space then reduce the scaling instead. MythVideo can resize the video to various aspect ratios (4:3, 16:9 and variations of each).
Keep in mind that the scaling will occur after any cropping is applied. If you have a widescreen video where the black bars are removed then scaling to 480 pixels high might stretch the image vertically in a way that you find unacceptable. Again, the settings I’m recommending have provided me with reasonable video quality for nearly all of the DVDs I’ve ripped but you may need to adjust to your own taste after trying a few.
One note on editing any field in AcidRip: be sure to click in another field or tab to the next field after making a change or else the change may not get picked up when you start the rip.
The configurations set in the General and Video tabs can be previewed in the Preview tab. This allows you, for example, to check if the Crop setting is actually getting rid of the black bars on a widescreen video.
Figure 5: Previewing your settings
Another reason to preview your configuration is to make sure AcidRip correctly identified the audio language. On a few videos I found it would choose a Spanish or French audio instead of English. This is easily fixed by selecting a different audio language track in the General tab.
Getting Quality Video for MythTV
There are some tricks to getting good quality videos with small file sizes using AcidRip. First, but alternative to one of the ultimate goals, is that large file sizes generally produce better quality video. This just allows AcidRip (or rather mencoder) to use more bits per pixel and even higher bit rates. If the video quality is really bad, retry it with a larger file size. Fortunately, even at 1.8GB an AVI file is anywhere from 3 to 4 times smaller than the equivalent DVD file taken straight from the disk.
Second, in the US we use the NTSC standard to display video and in the UK and Europe they use the PAL standard; these have nothing to do with the MPEG encoding of the actual file but rather to do with how the image is displayed on the TV. The ideal file resolution for NTSC video is 740×480 pixels and in the UK and Europe it would be 768×568 pixels. If you scale to some other size then the video has to be scaled by your display device (video card) or MythTV in order to fill the screen properly. Any additional scaling at that point will increase the CPU and GPU (video card) workload, possibly slowing things down, and will likely create visible artifacts in the display.
Finally, dual passes (set in the Video tab) will help to make action sequences cleaner. The tradeoff with multiple passes is that the rip will take significantly longer to complete.
Multiple rips: Queuing and NFS
If you have multiple DVD drives you can queue up a series of videos for ripping. Just hit the Queue button after you’ve configured one DVD device, then configure the next device and hit Queue again. Each queued job is shown in the Queue tab. The queued jobs will be run one at a time. Each rip can take from several hours to half a day depending on the speed of your hardware, the number of passes and the quality settings you’ve selected.
If you have multiple systems with DVDs, just repeat the process on each system and use the same NFS directory exported from your MythTV backend.
Fatal error: Call to undefined function aa_author_bios() in /opt/apache/dms/b2b/linux-mag.com/site/www/htdocs/wp-content/themes/linuxmag/single.php on line 62