Extracting DVD-Audio on Linux, the modern(ish) way
DVD-Audio (henceforce DVDA) is an unloved and mostly forgotten audio format. Nevertheless, there's a large back-catalogue of music which is still trapped on ancient discs encoded in the proprietary MLP format.
A few years ago I wrote about how to extract the audio using the obsolete Windows program DVD-Audio Explorer. I wanted to be able to run the extraction via the command line, which means trying to find a native Linux app. I tried Python AudioTools but I got lost in an endless maze of incompatible dependencies.
So I went with Brian "tuffy" Langenberger's libDVD-Audio
.
To install, simply run:
sudo make install
That will give you two new programs. To get info about your DVDA, run:
dvda-debug-info -A /path/to/your/AUDIO_TS
That will pump out details about each track like so:
Title Track Length PTS Length First Sector Last Sector
1 1 3:30 13450000 0 86547
1 2 4:11 12500000 73144 122600
1 3 2:11 16010000 370601 233337
Extract
To extract the tracks, run:
dvda2wav -A /path/to/your/AUDIO_TS
That will spit out the files in WAV format.
Encode
WAV is pretty large - about 20MB per minute per channel. Converting to FLAC (the Free Lossless Audio Codec) gets you down to about 10MB. I just go straight for the modern Opus Codec which does excellent quality surround sound at low file sizes.
opusenc --bitrate 4096 track-01-01.wav 1.opus
That's about 2MB/minute/channel and I promise that you won't hear the difference.
Metadata
If you want to add metadata to a track, it's done like this:
opusenc --bitrate 4096 in.wav out.opus --title "Yesterday" --artist "The Beatles" --tracknumber "02"
Older versions of Opusenc, oddly, don't have a native way to express track numbers, so you'll need to do it manually using --comment "tracknumber=02"
Newer versions can use --tracknumber
to add track numbers.
Automating
You can make it slightly easier to add the metadata if you give the files predictable names. For example: 01-Yesterday-The Beatles.wav
Here's a scrappy bash script:
#!/bin/bash
for FILE in *.wav
do
FILENAME="${FILE%.*}"
TRACK=$(echo $FILENAME | cut -d'-' -f 1)
TITLE=$(echo $FILENAME | cut -d'-' -f 2)
ARTIST=$(echo $FILENAME | cut -d'-' -f 3)
OUTPUT="[$TRACK] $ARTIST - $TITLE.opus"
opusenc --bitrate 4096 "$FILE" "$OUTPUT" --title "$TITLE" --artist "$ARTIST" --tracknumber "$TRACK"
done
I hope future me finds these notes useful!
Anibal says:
DivinityMarrow says:
fgzarhww says:
Pretty cool and still relevant, thanks for sharing! Would anyone know of the method/tool to use for extracting the WAV from the VIDEO_TS folder by any chances?
@edent says:
Thanks. I recommend using https://www.makemkv.com/ - works on Linux and allows you to grab the audio from a DVD or folder.