# dvdrip-commandline

howto rip dvd with subtitles to matroska container using mplayer, mencoder, ffmpeg, MP4Box and mkvmerge.

get data

get movie and audio

mplayer dvd://1 -dvd-device /dev/cdrom -v -dumpstream -dumpfile original.vob

get subtitles

#mplayer dvd:// -dvd-device /dev/cdrom -v -vo null -ao null | grep "subtitle"
mencoder dvd://1 -dvd-device /dev/cdrom -nosound -ovc frameno -o /dev/null -slang de -vobsubout original

extracting / encoding

one pass

audio, f.e. ac3 aka dolby digital audio

ffmpeg -i original.vob -codec:a ac3 video.ac3

audio, f.e. aac

ffmpeg -i original.vob -r 23.976 -ac 2 -vn -f wav -y - | faac -q 90 - -o video.aac

video

ffmpeg -i original.vob -an -codec:v libx264 video.h264

two pass

not working, i think...

ffmpeg -i title.vob -pass 1 -an -codec:v libx264 -passlogfile bluray-movie.log -f rawvideo /dev/null
# constant rate-factor is incompatible with 2pass.
ffmpeg -i title.vob -pass 2 -an -codec:v libx264 -passlogfile bluray-movie.log bluray-movie.h264
ffmpeg -i title.vob -codec:a pcm_s24le bluray-movie.wav

muxing

mp4

MP4Box -add title.h264#video -add title.ac3#audio -fps 23.976 bluray-movie.ac3.mp4

mkv

mkvmerge -o video.h264.aac.mkv video.h264 video.aac original.idx

further reading

http://www.blu-ray.com/faq/#bluray_video_codecs

MPEG-4 AVC - part of the MPEG-4 standard also known as H.264 (High Profile and Main Profile)
Linear PCM (LPCM) - up to 8 channels of uncompressed audio. (mandatory)
Dolby Digital (DD) - format used for DVDs, 5.1-channel surround sound. (mandatory)
DTS Digital Surround - format used for DVDs, 5.1-channel surround sound. (mandatory)

http://www.x264bluray.com/

http://ubuntuforums.org/showthread.php?t=273635

http://irishjesus.wordpress.com/2010/10/17/blu-ray-movie-authoring-in-linux/