As I don’t care for the noise of an optical drive while going to sleep, have been transcoding a few favorite DVDs to USB sticks.
ffmpeg
is a versatile tool, but does not support import directly from DVD media.
mplayer
does however, and can stream dump.
#!/bin/bash
function dvdrip {
mplayer dvd://${1} -chapter ${2} -dumpstream
# adjust as needed
ffmpeg -i stream.dump -c:a aac -b:a 128k -c:v libx264 -crf 16 -pix_fmt yuv420p -f mp4 "${3}.mp4"
rm stream.dump -f
}
case $(lsdvd -c | md5sum | cut -b-6) in
# [...]
# archer 5-1
da7c42)
dvdrip 2 1-5 '0501 White Elephants'
dvdrip 2 6-10 '0502 A Kiss While Dying'
dvdrip 2 11-15 '0503 A Debt of Honor'
dvdrip 2 16-20 '0504 House Call'
dvdrip 2 21-25 '0505 Southbound and Down'
dvdrip 2 26-30 '0506 Baby Shower'
dvdrip 2 31-35 '0507 Smugglers Blues'
;;
# default handler
*)
echo 'add config for:'
lsdvd -c | md5sum | cut -b-6
esac
eject
With a bit of hindsight:
-ac 2
to force it.