Is this possible with ffmpeg? Do you have any links that explain how to do this?

I have searched with Google but had not many results.

I just want to be able to convert a CD or DVD to MP3 audio files.


Solution 1:

From DVDs, you can access the VOB files directly though, but you have to concatenate them:

cd /path/to/dvd/
cat VOB1.VOB VOB2.VOB VOB3.VOB | ffmpeg -i - -c:a libmp3lame -vn /path/to/output.mp3

For CD, if your ffmpeg was compiled with libcdio support, @M132 gives us a solution:

ffmpeg -f libcdio -ss 0 -i /dev/sr0 dump.flac

To get libcdio with ffmpeg under Windows, check out the Media Autobuild Suite. It can then read from a .cue file.

Solution 2:

If your ffmpeg doesn't have libcdio or you want to automatically store each track separately and you have cdparanoia installed, you can use that as the input and pipe each track to ffmpeg:

$ cdparanoia -Q 2>&1 | 
grep "^ *[1-9]" | 
sed -e 's/^ *\|\..*//g' | 
while read t; do 
  cdparanoia $t - | ffmpeg -i pipe: -b:a 128k -ar 44100 -ac 2 -y "rip $t.mp3"; 
done
  • cdparanoia -Q 2>&1 prints a track list and redirects it to standard out
  • grep "^ *[1-9]" finds the lines with a number at the start representing tracks
  • sed -e 's/^ *\|\..*//g' removes all substrings that are not the track number
  • while read t; do reads each track number into variable t
  • cdparanoia $t - runs cdparanoia again, this time to read the given track and writes output to standard out
  • ffmpeg -i pipe: -b:a 128k -ar 44100 -ac 2 -y "rip $t.mp3"; reads the input from standard in and does the conversion, here into mp3 (of course you can use any audio encoding you like)
  • done end of the while-loop

So you end up with a bunch of files named "rip <track number>.mp3" in your current directory.