Monday, June 11, 2007

Ripping DVDs and Subtitles with mplayer

Ok, so mplayer has many features, not just watching but also converting and extracting etc.

I found this thread in the ubuntuforums and seems great.
http://ubuntuforums.org/showthread.php?t=273635&highlight=extract+subtitles

Here are some of the commands:

1. Install needed applications

sudo apt-get install mplayer mencoder normalize-audio vorbis-tools mkvtoolnix mkvtoolnix-gui gpac x264-bin


2. Rip DVD to harddisk


mplayer dvd://1 -v -dumpstream -dumpfile title.vob


* 1 is the stream you want to rip.


3. Subtitles

In order to determine which subtitles are available on your DVD run the following command


mplayer dvd:// -v -vo null -ao null | grep "subtitle"


3.1 Rip subtitles


mencoder dvd://1 -nosound -ovc frameno -o /dev/null -slang en -vobsubout title


* 1 is the stream we extract the subs from
* slang is the desired language (en, de, fr, etc.)
* title is the basename of the vobsub files, in this case title.idx and title.sub


4. Audio

In order to determine which audio tracks are available on your DVD run the following command


mplayer dvd:// -v | grep "audio stream"


In case you want to keep the original AC3 audio step forward to 4.4.

4.1 Convert audio to PCM


mplayer title.vob -ao pcm:file=audio1.wav -vc dummy -aid 128 -vo null


* title.vob is the stream we already ripped in step 2
* audio1.wav is the name of the resulting PCM file
* -aid 128 chooses the first audio track

If you would like to rip another audio track (e.g. commentary or different language) repeat the above with the next track number (-aid 129 would be the second track) and save as audio2.wav.

4.2 Normalize audio


normalize-audio audio1.wav


Repeat on audio2.wav etc. if you have more than one audio track.

4.3 Encode audio into Ogg Vorbis


oggenc -q5 audio1.wav


* -q5 is the desired quality of the first track.

0 comments: