Extracting the Audio Track of a DVD with ffmpeg
I've recently had to extract the audio track of a DVD. The easiest way to do it is the following:
First navigate into the VIDEO_TS folder on your DVD. In that folder pick out one of the VTS files you want the audio track of. In my case that was VTS_02_1.VOB.
For that file we execute the following command:
ffmpeg -i VTS_02_1.VOB
This gives us quite a bit of output, however we're looking for this part:
Input #0, mpeg, from 'VTS_02_1.VOB': Duration: 00:09:55.53, start: 0.060000, bitrate: 14423 kb/s Stream #0:0[0x1bf]: Data: dvd_nav_packet Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m/bt470bg/bt470bg, progressive), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:2[0xa0]: Audio: pcm_dvd, 48000 Hz, stereo, s16, 1536 kb/s
Here we can see that the audio stream "pcm_dvd" is mapped to 0:2.
To extract now the whole audio track of the DVD we have to execute this command:
cat VTS_02_1.VOB VTS_02_2.VOB VTS_02_3.VOB VTS_02_4.VOB VTS_02_5.VOB | ffmpeg -i - -map 0:2 -ab 1536k -c:a flac /home/andreas/01_inbox/filename.flac
This pipes all the needed .vob files to ffmpeg which extracts the audio track and saves it as a FLAC file on my computer. Job done :)