Tuesday, 24 March 2009

Tip of the Day: Easily Get Audio from DVD .VOB Files

Notice: This tip should work for both Debian and Ubuntu, except for the way of installing mplayer which differs (in Ubuntu you should use Medibuntu, while in Debian you have the debian-multimedia.org repositories).

This is usually useful when you only need some audio recording from a live performance DVD or some other recording of some kind. If you have a DVD image and you need to mount it, you can do so by typing as root:

mkdir /mnt/iso0
mount -o loop /path/to/dvd/image.iso /mnt/iso0

You can choose any empty directory for mounting the image, in the above example I chose /mnt/iso0. It's also a good idea to eventually concatenate the VOB files you want to extract audio from, e.g.:

cat /mnt/iso0/VIDEO_TS/VTS_01_[1-3].VOB > ~/my_vob.vob

This will concatenate files VTS_01_1.VOB, VTS_01_2.VOB and VTS_01_1.VOB into one single VOB file, my_vob.vob, inside the home directory. The same can be accomplished using, for example:

cd /mnt/iso0/VIDEO_TS/
cat VTS_01_1.VOB VTS_01_2.VOB VTS_01_3.VOB > ~/my_vob.vob

Next, install mplayer (read here for instructions to get it from debian-multimedia.org repositories - after adding it, type as root apt-get install mplayer) and issue the following command inside the directory where the my_vob.vob file is located:

mplayer my_vob.vob -aid ${AID} -dumpaudio -dumpfile my_audio.ac3

Notice that you will have to replace ${AID} with a number corresponding to the audio channel, for VOB + AC3 that number is between 128-159. So our command should look like this:

mplayer my_vob.vob -aid 128 -dumpaudio -dumpfile my_audio.ac3

And there you go, the extracted audio file is my_audio.ac3.

1 comment:

grateful Mike said...

AAGHHH I am so, so thankful for this post! I've been struggling for some time to rip audio from my DVDs, and this little command finally did it for me! I'd fiddled with all kinds of software, and I was even about to jump into Windows when I found this. Thank you!

also, for any wondering, I used 128 for the channel number. I'm not experienced enough to know what the other numbers/channels might do, but 128 worked for me.