# Hat's NTSC guide to DVD/BD Ripping



## hat (Mar 20, 2016)

*Disclaimer:*
This guide is not intended to be used to support piracy. You should only use this as a method to back up discs you already own.

So, this is my complete, step-by-step guide to ripping DVDs (or Blu-Rays). Within lies the entire extent of my knowledge and experience, which I hope will be found valuable. Some may say it's easier to just rip with Handbrake and use the built in filters, but I find this a much higher quality process (I tried Handbrake by itself at first, and the results were, for lack of a better word, crap). First, I'm going to list a series of links right here at the top, but they will appear again where relevant. Unfortunately I'm only experienced with NTSC, so I'm not sure how to handle PAL material.

MakeMKV, for initial copying/ripping of the disc
MKVToolNix. for remuxing
VirtualDub, needed to run AviSynth
Lagarith lossless video codec for VirtualDub/AviSynth
AviSynth itself
QTGMC deinterlace plugin for AviSynth
TIVTC detelecine plugin for AviSynth
FFMS2 plugin for AviSynth, needed for loading our MKV files
Handbrake, for final transcoding
MediaInfo, tells you all about your media
MPC-HC. powerful, configurable media player
​*Step one: initial copying*
So, you want to rip a DVD? In my process, the first step is to copy it with MakeMKV. MakeMKV is a really neat tool, in it you can select which things you would and would not like to keep, for example, French subtitles or Spanish audio is not relevant to me, so I do not copy them. This speeds up the process by a minute amount, and makes one step of the process later on a bit cleaner. Unfortunately, the files MakeMKV spits out are named title00.mkv, title01.mkv and so on, so you'll need to match these up to the names of the episodes on the disc. I use the Plex naming convention so my Plex server is able to fetch additional data for my media. For example, I'd rename my files to Red Dwarf s01e01, Red Dwarf s01e02 and so on.

*Step two: what is it?*
So, this is where things are going to get complicated. Many DVDs and even Blu-Rays are either interlaced or telecined, This means, in one way or another, the original framerate of your movie/TV show/whatever was altered from the original 23.976FPS to meet the NTSC standard of 29.97FPS, either by interlacing or telecining. The effects of this are really ugly when you are able to see it, so our goal is to remove it and get back to the original.

So, do we have an interlaced video, a telecined video, or are we lucky enough to get a progressive video? The best way to tell is to fire up MPC-HC and view the video we got earlier from MakeMKV. MPC-HC has some built-in filters to clean up evil videos like this, so first we have to tell MPC-HC to play it like it really is. So, open up one of the videos you made with MKVToolNix, go to Play > Filters > LAV Video Decoder (internal) and where it says Deinterlacing Mode make sure it says Disabled (Progressive). Now you'll see the video for what it really is.

So, is it interlaced, telecined, or progressive? Well, if you don't see any combing, it's progressive, and you won't need to deinterlace or detelecine, and you can skip right to Handbrake! You can double-check with MediaInfo as well and it'll either say Interlaced, Progressive, or it won't say anything (if it says nothing, it's mixed... in my experience it's something stupid like the actual show is progressive but the credits were interlaced or telecined). If you do see combing, you need to determine here whether it's interlaced or telecined. You can do this by pausing the video _during a scene which has some motion_ and advancing frame by frame (I do this by holding CTRL and pressing the right arrow key). If you see a 2-3-2-3-2-3 pattern (that is, 2 interlaced frames, then 3 progressive frames, then 2 interlaced frames and so on) it's telecined. If every frame is interlaced, or there is no discernible pattern, it's interlaced.

*Step 3: Deinterlace/Detelecine*
This is where we need VirtualDub and AviSynth. Usually you would have to write a script for each episode, but with some help, I made a batch file that automatically generates a script for each file. If you need to deinterlace, use QTGMC (QTGMC.bat). If you need to detelecine, use TIVTC (TFM.bat). You'll probably need to modify the batch files slightly to point it to the directory of your choice. I use 2 folders for this process, one folder to keep the .avs scripts in, and one to keep my source files (and the output files as well). For example, put your files you wish to deinterlace/detelecine in the AviSynth Worker folder, along with the appropriate batch file. Run the batch file, and it'll automatically spit out a script for each episode! Now, move the .avs scripts to the AviSynth Scripts folder, and move your batch file elsewhere (I keep them out of my working folders). Now, open VirtualDub, go to File > Load processing settings (more on that later) and load your settings. Then, press F4 to bring up the Job Control. Here, go to Edit > Process Directory. Where it says Source Directory, choose your AviSynth Scripts folder. Where it says Target Directory, choose your AviSynth Worker folder. Press Start, and, if we set up everything correctly, VirtualDub/AviSynth will begin chugging along and after a while you'll have a progressive video to work with.

*Step 4: Remux*
Unfortunately, the previous process only processes the video stream, leaving behind the audio, subtitles, and chapter markers. Before we can move on, we have to put them back together. So, load MKVToolNix and go to Add Source Files and select both your original file and the corresponding file AviSynth spit out. Keep the video stream (codec will say some numbers and "LAGS") from your AviSynth video, deselect the video stream from the original .mkv file made by MakeMKV back in step 1, and keep any other streams relevant to your interests (such as the audio, subtitles, and chapter markers). I usually only have 5 items to pick from, 2 video streams, and one audio track, one subtitle track, and one set of chapter markers, because I deliberately tell MakeMKV to only copy the things I want in the first place.

*Step 5: Handbrake!*
This is it, the final step. I'll explain my setup here, most likely you'll use the same. Start by selecting the High Profile preset on the right hand side. From there, we'll start tweaking it a bit. On the first tab "Picture" I change Modulus from 2 to 16, and I change the cropping to Custom and zero it out. On the "Filters" tab, disable everything. On the Video tab, select Constant Framerate, and leave it set to Same as Source. Variable framerate can cause some playback issues. You can leave everything else alone here, though you might want to set the Encoder Tune box. If you're transcoding anime, even if it's really cartoony or badly animated like South Park, you might want to set it to Animation. For everything else, you should use Film, unless you have a really grainy source (like the movie 300) set it to Grain. You'll probably use h.264 as your Video Codec, unless you're encoding for a very modern target device, like some of the newest Smart TVs, which support h.265. You can also move the RF slider around if you wish, a lower value will preserve more quality but result in a higher file size. In contrast, a higher value will result in less quality, but also less file size. On to the Audio tab, go ahead and X that bottom box out that says nothing, unless you wish to encode multiple audio tracks. It's up to you what you wish to do here. Depending on your source audio codec (MakeMKV will probably tell you, and MediaInfo will tell you as well), you may wish to use the appropriate passthru. Personally, I use AAC @ 80kbps and I select Stereo mixdown. On to the Subtitles track, you'll need to add your subtitles manually for each episode one by one, if you kept them. The Chapters tab can be left alone entirely. Once you've got everything set up the way you want it here, you can go ahead and go to the right hand pane and create a new preset. If you do this, change Save Picture Size to none. You may then want to click on it, click on Options, and set it as the default preset.

One very important note about the resolution of your video here. Some DVDs have a flag that tells the DVD player to stretch the video to 16:9. The video is still stored in 720x480, but it's actually played back at approximately 853x480. If you have a widescreen DVD, you may notice that if you play back your original file made by MakeMKV, it appears to be in widescreen, but if you play back the video made by AviSynth, this flag gets obliterated and it's exactly 720x480, resulting in a squished looking image. You can restore this by going back to the Picture tab in Handbrake. You first have to set the Anamorphic tab to None and untick the Keep Aspect Ratio box. Then, change Anamorphic to Custom, and set PAR Width to 32, and PAR Height to 27. You may have to do this for each file individually, but I'm not sure. It's been a while since I've run into that particular issue myself. I do remember, however, that Vidcoder is a bit better about handling this. I just prefer Handbrake myself because that's what I've always used in the first place, even if it could admittedly be a bit more robust in some scenarios, like this one.

-Edited to upload batch files for AviSynth script creation


----------



## hat (Mar 20, 2016)

*Setting up VirtualDub/AviSynth*

This gets a bit complex, so I figured I'd reserve a separate post for it. First, we need to download VirtualDub. It doesn't have an installer, so just unpack it wherever you want it. Then, download and install the Lagarith lossless codec. We'll use this in VirtualDub for our deinterlacing process done by AviSynth. We don't want to lose any quality along the way, at least until the final transcoding in Handbrake, so I chose a lossless codec to work with here. Be aware that you can expect, on average, around 8GB per 30 minute episode with this method. Now open up VirtualDub and go to the Audio tab and select No Audio (the AviSynth setup I have doesn't process audio anyway, among other things, so may as well take it out completely here). Next, go to Video and choose the Fast Recompress option.  Next, go again to the Video tab and select Compression... Here, we choose the Lagarith codec we just installed. If you hit the Configure button, you can attempt to make the process a little faster and more efficient by ticking the Enable Null Frames box and the Use Multithreading box. Then, go to the File tab and select Save processing settings... VirtualDub doesn't save whatever changes you make to the settings, so you have to save them to a file and re-load them each time you launch it. When you're ready to begin using VirtualDub, just go to File > Load processing settings and load the file with the settings we saved.

Now, we have to set up AviSynth. Begin by downloading v.2.6.0 ST. Then, click the link for v.2.6.0 MT. It's only a .dll file which enables multithreading, installation instructions are there. Now, visit the QTGMC link. Click on the QTGMC-3.33.avsi link. It'll bring you to a webpage. Just right click-save as QTGMC.avsi, and put this file in your AviSynth Plugins folder. If you scroll down a little bit on the QTGMC page, you'll see it has a few dependencies. You need to install these too. First, for MVTools, you need to download mvtools-v2.5.11.3.zip. Just extract the .dll into your AviSynth Plugins folder. For MaskTools2, download masktools2-x86.zip and again extract the .dll into your AviSynth Plugins folder. nnedi3 is a little different, the .7z package contains a bunch of different copies suited to different systems. It's probably best to go to the x86 folder, since we're using 32-bit AviSynth. Whichever one you install will depend on the instructions your CPU supports. On my system with the i5 2400, I chose the one in Release_Intel_W7_Core2_SSE4.2. Again, copy the .dll to your AviSynth Plugins folder. At the RemoveGrain page, download RemoveGrain v1.0b. Extract all this stuff to your AviSynth Plugins folder. Next, visit my link for TIVTC. Download the .zip from the link on the right hand side. The only thing we need in here is the TIVTC.dll, so extract this to your AviSynth Plugins folder. The last plugin we need now is FFMS2, so visit my link and download the .7z. Extract the stuff from the x86 folder to your AviSynth Plugins folder, as well as the FFMS2.avsi.

Once you've done all this, VirtualDub and AviSynth should be ready to go!


----------



## qubit (Mar 20, 2016)

Nice walkthrough. I see that MakeMKV also rips copy protected discs, which is obviously critical for this procedure to work.


----------



## hat (Mar 20, 2016)

Alright, as of now I think my guide is done, unless I missed something, which is possible since sometimes I screw it up myself 

Hopefully though it's all right and it helps someone!


----------



## T-Bob (Mar 22, 2016)

qubit said:


> Nice walkthrough. I see that MakeMKV also rips copy protected discs, which is obviously critical for this procedure to work.


Same same


----------



## bermel72 (Mar 22, 2016)

I think this should be on top of the posts as a sticky.


----------



## T-Bob (Mar 23, 2016)

bermel72 said:


> I think this should be on top of the posts as a sticky.


 I agree, a sticky would be nice


----------



## hat (Mar 23, 2016)

Has anyone tried my method yet?


----------



## ne6togadno (Mar 23, 2016)

https://en.wikipedia.org/wiki/PAL#PAL_vs._NTSC


----------

