Random Access Science

Geophysics, Glaciology, Computer Science and everything inbetween

Extract Audio From DVD With VLC on Windows

This December my dad wanted to copy the sound from a couple of DVD concerts he had. Then he could hear it in his office or in the car. After a bit googling around I saw that VLC (Videolan.org) is able to extract the data. The problem was that VLC is only able to extract all the audio in one go. So all music is in one file… No way to skip from one track to the next. Not really what I wanted… The way out of this is to call VLC from the commandline and tell it to only play one chapter.

1
vlc dvd:///O:/1:2-1:2

This will play from title 1 and chapter 2 to title 1 and chapter 2. In this way you are able to open a single track at a time. But going in and using the GUI to record one track at a time is a bit cumbersome on a DVD with 32 tracks. So I ended up writing a script. My dad uses windows so it is in batch (sorry), but POSIX should work in a similar way,

1
2
3
4
5
set title=%1
set chapters=%2
set name=%3

FOR /L %%G in (1,1,%chapters%) DO CALL "C:\Programmer\VideoLAN\VLC\vlc" -I dummy -vvv dvd:///O:/#%title%:%%G-%title%:%%G --sout=#transcode{vcodec=none,acodec=mp3,ab=192,channels=2}:std{access="file",mux=raw,dst="g:\RIPDVD\%name%_%%G.mp3"}} vlc://quit

The above script assumes that the DVD is in the drive with letter O, the file is saved to “g:\RIPDVD\”, the output file is a mp3 file with bitrate 192.

To use the script edit the above parts to work with your system. When calling the script you must give it a couple of commandline arguments,

  1. The title to use (this can be found from a program like Handbrake)
  2. Number of chapters to extract (i.e. number of tracks in the concert. Can also be found using Handbrake)
  3. The base filename of the output file (i.e. filename_trackNumber.mp3)

If you decide to call the script rip-audioDVD.bat then you would call the script from the Windows commandline (cmd.exe) with

1
rip-audioDVD.bat 1 10 mymusic

This would rip tracks 1-10 from title 1 on the current DVD. The output would be call mymusic_1.mp3, mymusic_2.mp3, …, mymusic_10mp3.

So the script will run through all the chapters in the title and create one .mp3 file per track in the folder given. There may be a easy way to do this without scripting but this was the quickest way I could find.