Monday, June 7, 2021

Ripping audio tracks from a DVD

Quick notes on ripping audio tracks from a DVD (Unplugged by The Corrs) using command line:


# rip dvd by track (total 17)
for i in {1..17}; do
  mplayer dvd:// -chapter $i-$i -dumpstream -dumpfile $i.vob;
done

# find out which audio stream has the 2-channel pcm and copy it into a flac file
for i in {1..17}; do
  tmp=`ffprobe -v error -show_format -show_streams $i.vob | grep -B 1 pcm_dvd | head -n 1 | cut -d '=' -f 2-`
  ai="$(($tmp-1))"
  ffmpeg -i $i.vob -map 0:a:$ai -vn -f flac $i.flac;
done

# rename flac files by track... TBD


# set metadata
for i in *.flac; do
  ALBUM='Unplugged'
  ARTIST='The Corrs'
  tracknumber=`echo $i | cut -d ' ' -f 1 | sed 's/^0*//'`
  title=`echo $i | cut -d ' ' -f 2- | cut -f 1 -d '.'`
  metaflac --set-tag="ALBUM=$ALBUM" --set-tag="ARTIST=$ARTIST" --set-tag="tracknumber=$tracknumber" --set-tag="title=$title" --remove-tag=encoder "$i"
done

No comments: