All credit goes to Echohead from TehConnection for this extremely in-depth guide:
What you will need:
A 64-bit version of windows (XP, Vista, or Win7) - Encoding with the 64-bit build of x264 is on average 10% faster than with the "normal" 32-bit build
RipIt4Me - Extract the .zip to %programfiles%\RipIt4Me and place a shortcut to RipIt4Me.exe somewhere convenient
DVD Decrypter
Avisynth
DGMPGDec - Extract the .zip to %programfiles%\DGIndex and place a shortcut to DGIndex.exe somewhere convenient
tritical's Avisynth Filters - For this guide you'll only need TIVTC, NNEDI, and yadifmod. Extract TIVTC.dll, nnedi.dll and yadifmod.dll, and place them in %programfiles%\AviSynth\plugins. Do the same with DGDecode.dll (found in the DGIndex folder).
AvsP - Extract the .zip to %programfiles%\AvsP and place a shortcut to AvsP.exe somewhere convenient
SubRip - Extract the .zip to %programfiles%\SubRip and place a shortcut to SubRip.exe somewhere convenient
MKVmerge
techouse's x264 builds - Download the 32-bit and 64-bit versions of the latest revision. Extract the 64-bit archive and rename x264.exe to x264_x64.exe. Extract the 32-bit archive. Move x264_x64.exe and x264.exe to Program Files\x264 - NOT Program Files (x86) (NOTE: If you are doing this on a 32-bit system, download the x86 version)
Lord Mulder's 64-bit x264 GUI - Extract the contents of the archive. Delete the two x264 executables there, and move the rest to Program Files\x264. Then place a shortcut to launcher.exe somewhere convenient
Note: If you are having trouble with the non-ITU and ITU script later, try this .avs script:
1. Setup RipIt4Me and DVD Decrypter
(This only needs to be done once.)
-Open RipIt4Me and click Logs/Settings --> Preferences.

^your settings should look like this, with the exception that your install location for DVD Decrypter (that you'll have to point RipIt4Me to) may not be the same as mine.
-Next, open DVD Decrypter. Go to Tools --> Settings. They should look like this:

-Open DGIndex. Click Video --> iDCT Algorithm IEEE-1180 Reference
2. Rip the DVD
-Insert your DVD in your DVD Drive (duh)
-Open RipIt4Me, click "1-Click Mode", then click "Next".

-Once you've clicked "Next", wait a few seconds for RipIt4Me to open DVD Decrypter. Don't touch ANYTHING on your computer until you see this window and the progress bar indicating that the rip has started:

-After DVD Decrypter is done, RipIt4Me will take a few minutes to clean the files you've ripped. When that is done (you'll know because the DVD will be ejected from your drive), you should have a folder on the root of your hard drive with the same name as the DVD, and a VIDEO_TS folder.
3. Preparing to Encode
-Open DGIndex, as well as the directory containing the ripped DVD. Find the .vob files for the main movie - just about every DVD structure looks like this:

-Drag the needed .vob files into DGIndex. Click OK on the confirmation window, then choose File --> Save Project and Demux Video:

-DGIndex will process the .vob files, separating the audio streams and the video. If a message about a "Field Order Transition" pops up, click Yes. When DGIndex is done, close it. Go to the location you had DGIndex output the audio and video, and delete the .m2v file, and any audio streams you don't want in the final encode. Each audio stream should be numbered in the same order as described in the DVD information.
-Next open AvsP. Drag the .d2v file that DGIndex made, into the AvsP window. If your DVD is NTSC, add TFM().TDecimate() to the second line. If it is PAL, ignore this. If the DVD is interlaced, add YADIFMod(edeint=NNEDI()) to a separate line. Next, you need to remove all black borders. Click Video --> Crop Editor....

-Crop out the black bars entirely, and if necessary, overcrop to achieve mod16 (width and height dimensions are divisible by 16). You can confirm this by looking at the AvsP status bar while you are cropping - WMOD and HMOD should equal either 16 or 32. Video can be cropped to mod4 (multiples of 4 or 8) if it means saving a large number of pixels.
-Save the .avs script, and open a new tab. Paste this into the new tab:
avsfile = "script.avs" # Encoding script
format = 1 # 1=NTSC, 0=PAL
wide = 1 # 1=Widescreen 16:9, 0=Full screen 4:3
#########################
ITU = (format==1?10:12)/11.0*(wide==1?4.0/3:1)
SARs = """"12:11","16:11","10:11","40:33","16:15","64:45","8:9","32:27""""
ITUprof = "" (wide==1?"ANAMORPHIC ":"":wink: (format==1?"NTSC":"PAL":wink:
i=import(avsfile).converttorgb
i
ab = round(height*(sqrt(45.0/44)-1))
a = spline36resize(round(width*ITU),height)
a = a.addborders(0,floor(ab/2.0),0,ceil(ab/2.0))
bb = width(a)-round(width*ITU/sqrt(45.0/44))
b = spline36resize(round(width*ITU/sqrt(45.0/44)),height ab)
b = b.addborders(floor(bb/2.0),0,ceil(bb/2.0),0)
interleave(a,b)
scriptclip("""subtitle("Playback Resolution: " \
string(round(width(i)*ITU*pow(44.0/45,current_frame%2))) "x" string(height(i)) \
"\n" ITUprof (current_frame%2==1?" NON-ITU":"":wink: \
"\nx264 --sar " eval("select(2*format wide current_frame%2*4," SARs ":wink:":wink:,lsp=0)""":wink:
^change script.avs to the location and name of the .avs script you saved earlier. Also change "format" and "wide" to match the specifications of the DVD (NTSC or PAL, fullscreen or widescreen).
-Now, scroll through the frames. You'll notice that each frame is repeated, only with slightly altered aspect ratios - ITU and NON-ITU. Find a frame that shows a round/circular object on frame - the larger and more straight-on the shot, the better. Clocks, car wheels and headlights, the "Universal" logo at the beginning of many films, and the Criterion logo all work well.

vs.

^Notice how the tires and hubcaps in the ITU screenshot appear to be slightly more circular than in the NON-ITU screenshot. This means that in order to make this encode anamorphic (a required element for any encode uploaded to TehConnection), I will have to append --sar 40:33 to the end of my x264 parameters. This number will be different if your source is fullscreen and/or PAL, or there is something odd about your source DVD. If you cannot determine whether your DVD is ITU or NON-ITU, choose ITU - there are way more ITU DVDs than NON-ITU.
4. Encoding
-First, you need to decide on your encoding parameters. To a certain degree, every encode source should be treated differently - tweak your encode parameters and run a few test encodes to determine what will yield the best results. Do your best to avoid excessive bitrate/filesize, but DO NOT sacrifice perceivable quality for smaller encodes. Please take note that the GUI does not accept the 2-pass option.
-Here are a few basic templates that I use to get started, before deciding on my final encode parameters. Look over them carefully - if you consider something to be excessive, unnecessary, lacking, or whatever, do some research on it. Once you're are sure you know what you're doing, change it to whatever you think will work best for your purposes...
Live-Action Wrote:
--crf 18 --ref 6 --mixed-refs --no-fast-pskip --bframes 5 --b-pyramid --weightb --direct auto --deblock -2:-1 --subme 9 --analyse all --8x8dct --no-dct-decimate --trellis 2 --aq-strength 0.8 --psy-rd 1.0:0.0 --b-adapt 2 --me umh --merange 64 --thread-input --no-psnr --no-ssim
(Real actors and locations)
Rotascope Wrote:
--crf 19 --ref 9 --mixed-refs --no-fast-pskip --bframes 5 --b-pyramid --direct auto --deblock 1:1 --subme 9 --analyse all --8x8dct --no-dct-decimate --trellis 0 --aq-strength 0.7 --psy-rd 0.7:0.0 --b-adapt 2 --me umh --merange 64 --thread-input --no-psnr --no-ssim
(used for movies like Waking Life and A Scanner Darkly)
CGI Wrote:
--crf 18 --ref 9 --mixed-refs --no-fast-pskip --bframes 5 --b-pyramid --direct auto --deblock 1:1 --subme 9 --analyse all --8x8dct --no-dct-decimate --trellis 0 --aq-strength 0.7 --psy-rd 0.9:0.0 --b-adapt 2 --me umh --merange 64 --thread-input --no-psnr --no-ssim
(3-Dimensional animation)
animation Wrote:
--crf 19 --ref 9 --mixed-refs --no-fast-pskip --bframes 5 --b-pyramid --weightb --direct auto --deblock 1:1 --subme 9 --analyse all --8x8dct --no-dct-decimate --trellis 2 --aq-strength 0.8 --psy-rd 1.0:0.0 --b-adapt 2 --me umh --merange 64 --thread-input --no-psnr --no-ssim
(Higher-complexity animation)
cartoons Wrote:
--crf 20 --ref 9 --mixed-refs --no-fast-pskip --bframes 5 --b-pyramid --weightb --direct auto --deblock 1:1 --subme 9 --analyse all --8x8dct --no-dct-decimate --trellis 0 --aq-mode 0 --psy-rd 0.0:0.0 --b-adapt 2 --me umh --merange 64 --thread-input --no-psnr --no-ssim
(Lower-complexity animation)
-Note: It may be a good idea for you to come up with some encoding templates of your own, and save them somewhere on your computer - It's easier than manually typing everything for each encode you do.
-Click the shortcut for "launcher.exe". Load your .avs file, choose an output filename, and paste your encode parameters into the GUI. Also, remember to append the --sar number to the end (in this example, mine was --sar 40:33). The window should look something like this:

-Click Start! and wait for the encode to finish
5. Ripping Subtitles
-Open SubRip. Click "File --> Open VOB(s)". Then click "Open Dir". Here, again, you're looking for he VIDEO_TS folder. The VOB file you want is usually the one that coincides with the main movie. You'll know that you have the right one because you'll see something like this:

^in my case, there's only one subtitle so it wasn't named (hence the "???":wink:. On other DVDs there will be multiple subtitle tracks, each named for their language and (sometimes) for what audio/video stream they are for.
-Now for the hard part. Click Start. SubRip has no way of "knowing" what each character in the subtitle file is, so you have to identify each one as subrip comes to it. Each character only has to be identified once though...for example, once you tell it that S is S, it will automatically identify every capital S in that movie.

-After completely "identifying" all the subtitles, click "Corrections --> Post OCR Correction:

^make sure everything looks like this, then click OK.
-Save the subtitle file. Let SubRip save it as Unicode if it asks. Don't save the character matrix.
-Sometimes SubRip doesn't get everything right. Open the .srt file in notepad, copy all the text, and paste it into a word processor that has spellcheck. Check for misspelling, exra spaces before or after quotations, and the occasional extra or forgotten space between words.
6. Muxing
-Open mkvmerge GUI. For the "Input" section, choose your .mkv encode, audio stream(s) and your subtitle file.
-Click "Muxing --> Add command line options" Here, enter the command: --engage keep_bitstream_ar_info
-If the movie is not English language, you should set the subtitle as ON by default. Highlight the subtitle file under "Tracks". Then under General Track Options, set "Default track flag" to Yes. DO NOT do this if the movie is English language.

-Make sure to change the output filename to something different from the input, and click "Start muxing"
-When mkvmerge is done, open the file in your media player and skip through it to make sure everything is as it should be.
We had two bags of grass, seventy-five pellets of mescaline, five sheets of high-powered blotter acid, a salt shaker half full of cocaine, a whole galaxy of multi-colored uppers, downers, screamers, laughers…Also a quart of tequila, a quart of rum, a case of beer, a pint of raw ether and two dozen amyls. The only thing that really worried me was the ether. There is nothing in the world more helpless and irresponsible and depraved than a man in the depths of an ether binge. –Raoul Duke
It is hard to shed anything but crocodile tears over White House speechwriter Patrick Buchanan's tragic analysis of the Nixon debacle. "It's like Sisyphus," he said. "We rolled the rock all the way up the mountain...and it rolled right back down on us...." Neither Sisyphus nor the commander of the Light Brigade nor Pat Buchanan had the time or any real inclination to question what they were doing...a martyr, to the bitter end, to a "flawed" cause and a narrow, atavistic concept of conservative politics that has done more damage to itself and the country in less than six years than its liberal enemies could have done in two or three decades. -Hunter S. Thompson







