First identify the part of the dvd containing the video:
-Most of the time this is dvd://1
-If not try try dvd://2, dvd://3 etc.
-The command would be mplayer dvd://1 -dvd-device /dev/hd*
-* is your adress of the dvdrom
Get all the information of the movie:
-mplayer dvd://1 -dvd-device /dev/hd* -vo null -ao null -frames 0 -v 2>&1 | grep sid >log.txt && mplayer dvd://1 -dvd-device /dev/hdd -vo null -ao null -frames 0 -v 2>&1 | grep aid >>log.txt
Use vobcopy to copy the disc:
-vobcopy -l -t video.vob
-Make sure you’re dvd-drive is mounted or it may complain
-Copy the .IFO file beloning to the movie part (dvd://number) from pathtodvd/VIDEO_TS/VTS_number_0.ifo
Detect the black borders:
-mplayer video.vob -vf cropdetect
-Skip through the video to let it do it’s work
-Note the suggested crop values in log.txt
Detect the filelength (for I never see the credits)
-mplayer video.vob -osdlevel 3
-Skip to the end, note down the time where the video ends in log.txt
-If you want to include the credits, please ignore this step, it will cost quality though
Run the first pass of Xvid (fast):
-mencoder video.vob -endpos hh:mm:ss -nosound -o pass1.avi -sws 2 -vf crop=xxx:xxx:xx:xx,scale=576:320 -ovc xvid -xvidencopts pass=1:chroma_me:max_bframes=2:bvhq=1:vhq=1:trellis
-Your endpos is in your log.txt
-The cropvalue in in your log.txt
If the size of the first pass is reasonable, you can encode the audio and then run the second pass.
-The size is reasonable if the resulting video-only file has to be about < =30% smaller.
-Don't forget some MB for the audio
-If the resulting file has to be bigger, increase the resolution in steps of 32. For example try 640:352. Rerun the first pass with changed settings.
-If the compression would be higher than 30%, rerun the first pass with a denoise filter or decide to go for 2 CD's. Recommended denoise filter: hqdn3d=2:1:3 (Put it right after cropping with a ",")
-Based on the amount the video has to compress, choose a quality for the audio. I recommend using vorbis for movies. For hard to compress movies use vorbis at q0, otherwise stick to q2, or with real good compression q4. (Higher has no usage, for you won't possibly hear, if you insist just use the AC3 file)
Encode the audio:
-mplayer -vo null -vc dummy -ao pcm -aofile 2channels.wav video.vob -aid 128
-oggenc -q2 2channels.wav
-vorbisgain 2channels.ogg (Pumping up the volume without distortion)
-The -aid number you want is in your log.txt
Rip the subtitles:
-mencoder video.vob -ifo movie.ifo -vobsubout subtitles -vobsuboutindex 0 -sid 0 -ovc frameno -nosound
-for every extra subtitle you want to rip, increase vobsuboutindex with 1. With sid you can specify the languages found in your log.txt
-One subtitle usually costs you about 1,5 MB (compressed)
-Best way to measure the final size is to mux the subtitles only in a matroska file --> see end of instructions
Compute the bitrate:
vbr=(totalsize-audiosize-subtitlesize)*fps*8/frames
vbr=(734003200-62861936)*25*8/150750
vbr=870926
-These are examplevalues
-Bitrate is quite good, usually an undersize of about 1-2 MB.
-We’ll use this bitrate for the second pass
Run the second pass:
mencoder video.vob -endpos hh:mm:ss -nosound -o pass2.avi -sws 2 -vf crop=xxx:xxx:xx:xx,scale=576:320 -ovc xvid -xvidencopts pass=2:bitrate=870926:chroma_me:max_bframes=2:bvhq=1:vhq=1:trellis
Now mux it all together and check for audio sync:
-Use mkvtoolnix (mmg to start)
-Open from mmg: pass2.avi, 2channel.ogg and subtitle.idx
-Set aspect-ratio of the video according the information outputted at the end of pass1/2
-Mux!
-Check if the audio is in sync with mplayer (mplayer pass2.mkv)
-Use control + or control - to see if it’s getting better
-Redo the muxing with an other audio offset. This is positive if you used control +.
Enjoy your new quality rip!