mencoder -dvd-device /dev/sr0 dvd://1 -aid 128 -sid 0 -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=700:acodec=mp3:abitrate=192 -vf harddup -o video.avi
mencoder -dvd-device /dev/sr0 dvd://1 -aid 128 -ovc lavc -oac lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=700:vhq:trell:acodec=mp3:abitrate=192 -vf harddup -o video.avi
Extract subtitles (why?) mencoder -dvd-device /dev/sr0 dvd://1 -vo copy -ao copy -o /dev/null -vobsubout video-english -vobsuboutid eng
Start Here
Ogg-Vorbis audio is not compatible with AVI containers. You must mux it separately.
Extract audio
mplayer dvd://1 -alang en -ao pcm:fast:waveheader:audio.wav -vc null -vo null
Encode audio
oggenc --quality 4.0 -o audio.ogg audio.wav
Use a pipe to streamline the previous two
mkfifo -m600 audio.pipe
These two must be run simultaneously (source first) and cannot be backgrounded.
mplayer dvd://1 -alang en -ao pcm:fast:waveheader:file=audio.pipe -vc null -vo null oggenc --quality 4.0 -o audio2.ogg audio.pipe rm audio.pipe
Calculate target bitrate from movie length and encoded audio size
movie length: 7446 seconds
video_space=$(((700 * 8388608) - $(stat -c '%s' audio.ogg) )) video_length=7446 video_bitrate=$(( (${video_space} / ${video_length}) / 1024)) mencoder dvd://1 -sid 0 -noaudio -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=${video_bitrate}:vhq:trell \ -vf harddup -o /dev/null mencoder dvd://1 -sid 0 -audiofile audio.ogg -sid 0 -ovc lavc -oac copy -lavcopts \ vcodec=mpeg4:vpass=2:vbitrate=${video_bitrate}:vhq:trell -vf harddup -o video.avi
- -ss - selects a start time in seconds or hh:mm:ss.mmm - Note that this is not accurate--it will start at the first keyframe after the chosen timeframe.
- -endpos - specifies the number of seconds to encode before stopping
Mencoer options are poorly documented!
If 'Skipping frame!' or '1 duplicate frame(s)!' warnings occur repeatedly, and the resultant audio grows out of sync (as if one is faster) then try tweaking the source framerate. 'skipping frame' means there's too many frames coming in, so try a lower fps. 'duplicate frame' means there isn't enough frames coming in to satisfy the outgoing framerate, so try a higher source fps. Try and tweak so that there are as few of each message as possible.
- -fps <decimal|fraction> - specifies the source framerate. The fraction can be, for instance, 24000/1001 for 23.976fps.
- -ofps <decimal|fraction> - specifies the output frame rate. This must be set to the actual real framerate of the source, so that the frames line up with the audio.
( In two samples, the settings that got near-perfect results were '-fps 22000/1020 -ofps 24000/1001' )