Skip to content

Instantly share code, notes, and snippets.

@viz3
Last active March 27, 2022 08:17
Show Gist options
  • Save viz3/2866481 to your computer and use it in GitHub Desktop.
Save viz3/2866481 to your computer and use it in GitHub Desktop.
extract audio from dvd.
#!/bin/sh
dvd_device="/PATH/TO/VIDEO_TS"
# exec mplayer -dvd-device "$dvd_device" dvd:// -identify to acquire chapters and aid.
chapters="21"
aid="160"
title="1"
for chapter in `seq 1 $chapters`; do
wav=`printf %02d.wav $chapter`
if [ ! -e "$wav" ]; then
mplayer -dvd-device "$dvd_device" -vo null -chapter "${chapter}-${chapter}" -ao pcm:file=${wav}:fast -aid "$aid" dvd://"$title"
fi
m4a=`echo $wav | sed -e 's/wav/m4a/'`
if [ ! -e "$m4a" ]; then
ffmpeg -i $wav -acodec alac $m4a
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment