jerichoblog

linux and windows tips, mathematics, and some recipes

Monday, April 03, 2006

Converting DVDs to mp3s

Scenario: you have a DVD and you'd like to make an mp3 of a particular track / soundclip. The simplest solution (especially for Linux users) is to use mplayer and lame, which are freely available and open source.

Basic Ripping

Mplayer will produce a wav file from the DVD, and you can then use lame to convert the wav file to an mp3. The general mplayer command line is as follows:

mplayer $SOURCE -ao pcm -af resample=44100:0:0 -aofile $WAVFILE -vc dummy -vo null

Here $SOURCE is the recording source and $WAVFILE is the output file.
There are many ways of specifying the source. If you wished to record chapters 2 to 4 from dvd title 2, the appropriate invocation would be:

mplayer dvd://2 -chapter 2-4 -ao pcm -af resample=44100:0:0 -aofile outfile.wav -vc dummy -vo null

The final stage is conversion from the wav file to the mp3 file. You do this using lame, and the correct command is:

lame $WAVFILE $MP3FILE

where $MP3FILE is the desired mp3 file name.

Mplayer and lame are available for Windows, but there may be problems playing the later chapters in a DVD, as there seems to be a 2Gb limit imposed by the underlying software.

If you don't have Linux, it may be better to try a non-free alternative. A search through Tucows comes up with a large array of Windows tools, including "A1 DVD Audio Ripper", "AoA DVD Copy", "DVD Audio Extractor", and many others!

Advanced Ripping

The previous section should be sufficient for most purposes, but there are a few more tricks which may make the process smoother. Linux users can eliminate the need for a large intermediate wav file by using named pipes. First create the named pipe with

mkfifo $WAVFILE

You can now issue the lame command, followed by the mplayer command (preferably on different consoles). Delete the $WAVFILE file once you've finished the process.

Mplayer has a large variety of options. We've already seen how to specify the chapters you want to record. Another alternative is to specify the seek time. For example, to start recording from 1hr 30mins 40s, issue the following command:

mplayer dvd://2 -ss 01:30:40 -af resample=44100:0:0 -ao pcm -aofile outfile.wav -vc dummy -vo null

To find out more about mplayer, read the manual page.

0 Comments:

Post a Comment

<< Home