Search This Blog

Saturday, 13 April 2013

The comprehensive (and free) DVD / Blu-ray ripping Guide!

Note: If you've read this guide already (or when you've read it) then going through all of it each time you want to rip something can be a bit of a pain, especially when you just need your memory jogging on one particular section. Because of that, I've put together a quick "cheat sheet" here which acts as a handy reference just to jog your memory on each key step.

I've seen a few guides around on ripping DVDs, but fewer for Blu-rays, and many miss what I believe are important steps (such as ensuring the correct foreign language subtitles are preserved!) While ripping your entire DVD collection would have seemed insane due to storage requirements even a few years ago, these days it can make perfect sense.

This guide doesn't show you a one click approach that does all the work for you, it's much more of a manual process. But the benefits of putting a bit more effort in really do pay off - you get to use entirely free tools with no demo versions, it's reliable and works with all discs I've tried it with (bar one that was heavily scratched!), you get much more control over the quality / file size ratio and quality / encode time ratio, you can ensure any forced subtitles are correctly transferred across - the list goes on. You can also be sure that you get a high quality, completely DRM-free rip that you can do with as you choose without fear that some built in time bomb is going to stop the file from ever playing again if you transfer it to another computer.

Usual disclaimer that this isn't necessarily legal in your country, so check first and proceed with caution - I present this as a technical guide on the process only. If you are going to do it, just make a single personal copy.

Tools

I'll detail the tools used as we go, but it may make sense to install them ahead of time so you can follow the article more easily.

MakeMKV - We'll be using this to rip the raw files from the disc, this works with both Blu-rays and DVDs. If MakeMKV complains about not having a license key, grab the latest one from here.
Handbrake - We'll be using this to compress the file that MKV generates down to a more reasonable size.
VLC - We'll be using this to play / check the MKV files. Any media player that can play them will do, but if you're not sure grab this since it definitely does.

MKVExtract - We'll be using this to extract subtitle streams.
Subtitle EditWe'll be using this to convert subtitles into a better format.


The Initial Rip

Put your disc in the drive and load up MakeMKV (get rip of any auto-playing DVD players that might pop up.) You should be presented with something like the following:



Select the correct optical drive from the list if you have more than one (unlikely these days) and then hit the big button. MakeMKV will then proceed to analyse your disc, which may well take a while - when it's done it'll show you the titles, like so:


There may be as few as one title, or tens of titles depending on the disc. If your DVD contains a film, then you want to select the title with the largest size (in this case that's the first one, 6.2GB.) If it's a TV show you're ripping, you should have selected one title for each episode, and they should all be around the same size (ish.) The other titles are likely extras we don't care about, so we'll deselect those. If there's any titles you're unsure about, just include them anyway - it'll take a bit longer to rip, but that's better than doing the whole disc again! 

Expand the view for your chosen title, and you'll likely see something like this:


Each title contains various tracks, and it's these tracks that you're seeing here - the video track is the one at the top (which you definitely want!) there's audio tracks in different languages, and various subtitle tracks. However, I'm not interested in most of these, so I can deselect them. Presuming you're English go ahead and deselect all apart from the audio track that says "English" and the subtitles tracks that say "English" (do this even if you don't care about subtitles, I'll explain later, honest!) Careful if there's more than one audio track that says English that you select the right one (there may be a couple of others, for instance directors commentaries or audio subtitles. The one you want is usually the first "English" one on the list, and usually the one with the highest quality audio (it's often the only one to have surround sound for instance.)

For Blu-rays the view looks slightly different but essentially the same:

The thing to make sure of here is that you select the "DTS-HD Lossless English" audio as well as the normal "DTS 3/2+1" subitem, to make sure you copy all the uncompressed audio across from the disc. You also have a better option with subtitles, in that you can just tick "English (forced only)" as I have here, rather than checking all the tracks.

Select an output folder for the files (I usually make a temporary folder on the desktop to store them in) then hit the Make MKV button, and wait! It has to pull all the data off the disc, so will take quite a while. On my machine it's usually around 20 minutes for a DVD, up to an hour for a Blu-ray. Yours may be longer though, so be patient!

Test the MKV files

When MakeMKV is finished, open each file in VLC and check it's what you think it is - you can then delete any MKV files from titles you don't want, and if you like rename any MKV files so you know what they are more easily (episode 1, episode 2) for instance.

You should now have a rip of whatever DVD or Blu-ray you chose, congratulations! However, take a look at the file size - it's likely huge (it may be around 6 or 7GB for a DVD, and around 30GB for a Blu-ray.) Rip your whole collection and leave it like that, and unless you have access to a colossal amount of storage, you'll run out of space rather quickly! You may also not want an MKV file, you may want something to play on your ipod or similar. The next steps will involve reducing the file size down to around 1/3 of what it is at the moment with no noticeable loss in quality (there are various tradeoffs in this sense over file size and quality, we'll get to those later.)

Checking the subtitles

This is important! This is the part that most guides miss, but can unknowingly wreck many films if you miss this bit out! What we'll do here is check whether the film has any forced subtitles, and if so translate them into a better format.

Forced subtitles are those that appear even when subtitles are normally disabled, and usually contain captions to translate foreign languages spoken by characters in a film. If you're sure that your chosen film or TV show contains no such captions then you can skip this step, but if you're not sure then follow it anyway to check, otherwise your rip may have large parts you can't understand! This page gives a rough idea of some films that have forced subs, but it's by no means comprehensive.

When MakeMKV is finished, you should have a folder with an MKV file in for each title (for films, this will likely just be one MKV.) Fire up the MKVExtract GUI, and drag the MKV file onto it. You'll get a screen that looks a bit like this:


Select each track that says subtitles, make sure "use source dir for output" is checked and then hit "Extract." (If you hit "English (force only)" and had a Blu-ray disc, and there's no subtitle tracks here, that's fine - it's because there's no forced subtitles and you can skip this step.) When it's done, you should then have a .idx and a .sub file (just a .sup file if you're doing this for a blu-ray) for each subtitle track in the same folder as the mkv file. Examine the size of these files (ignore any idx files for this step.) Take the largest file, which will probably be the full subtitles for the film. Now have a look at the other sub / sup files, is there any one that's significantly less (less than half the size) of the others? If there is, you've likely found your forced subtitle track, and this is the one you'll want to include in your final rip. If not and the files are all around the same size, then you can likely skip the rest of this step and continue.

However, there are times when the forced subtitles are mixed in the same track as the normal subtitles (rare, the only discs I've found that do this thus far are the Game of Thrones DVDs), so if that's the case you'll need to export the entire file and just save the forced subs to the srt file (covered later on.)

This is a typical example that does have a forced subtitle track from an episode of Game of Thrones (Blu-ray):

We can clearly see two sup files, one around 16MB and the other around 44KB. It's the late 44KB one that's the forced track in this case, used when the Dothraki are speaking (Game of Thrones viewers will know what I mean!) This is a particularly extreme example - the forced subtitle track only has two lines, so in many cases it may be larger (but in almost all cases, significantly smaller than the main subtitle track.)

If you used a Blu-ray and clicked the forced only option, you can bypass this check - if there is a sup file there then you have your forced track in front of you. If not, there were no forced subtitles you need to worry about, and you can skip this step.

Of course, I'm assuming here that you don't want the full subtitle track; you may well do, for instance if the film is in a foreign language throughout - in this case, do the following for each subtitle track you want in your final rip.

You could just leave it at that, but here (this is the comprehensive guide, after all!) we're going to convert to SRT format. SRT subtitles use text as the format rather than an image, which gives a number of advantages - it takes up much less space than an sub / sup track, you can customise the colour / font / size of the subtitles trivially within the application that's playing them, you can trivially make any corrections if there's spelling mistakes (has been known to happen!) and they will be rendered smoothly on any resolution screen. In the case of DVDs, SRT files also look much better on any modern monitor or television, since they're rendered in the native resolution rather than displayed in scaled up, blocky 704x576.

Load up Subtitle Edit, and open the sub or sup file. You'll be presented with a screen similar to this:



Hit the "Start OCR" button, then subtitle edit will go through and OCR the entire subtitle file. For most foreign language subtitles this won't take long at all - you'll see it as it goes through, and if it gets stuck it'll prompt you to check that it's got it right (or provide a correction if it hasn't.)

If you're converting a track that has a mixture of forced and non-forced subtitles, and you just want the forced (foreign language) subs, then you'll need to check the "show only forced subtitles" checkbox.

When done, you'll be taken to the main subtitle edit window with the subtitles displayed. All you need to do now is save it (File -> Save), - ".srt" should be selected as the file type by default, but if not, change it so it's definitely in srt format rather than another type.

Repeat this process for each MKV file you have - in the case of TV shows, this may be a few per disc. When you've got more than one title to do, make sure you know what subtitle file goes with what episode!

Transcoding / Compressing

 Almost there - just one more step! Open up handbrake and drag your MKV file onto it (ignore any warning that appears about automatically named output files.)

If you have a subtitles track (srt file as created above), click on the subtitles tab, click import SRT, and locate your srt file you saved earlier. Make sure the "Default" checkbox is selected (important!), and you should end up with something like this:




When you've sorted the subtitles out, click the "Browse" button and select your destination location.

Don't click on "Start" just yet. You could, and you'd end up with a perfectly playable MKV or MP4 file on handbrake's default settings, but it may not be what you want.

Are you ripping this specifically for a device? If so, click on the preset on the right hand side and then click Start. These should encode relatively quickly, if you're unhappy with the result then just re-encode with the Video Quality slider set a bit higher - find it on the video tab (set it to something like 19 instead of 20 - yes, a lower number is better quality!)

However, if you're just ripping it to have as part of a media centre (which is what I do) then I'd recommend my process (see Note 2), which is adjusting the settings from Handbrake's default to the following:
  • Head over to the "Video" tab, and set the slider value there to 19. (I notice some blocking especially on fast action films when you leave it at 20, but setting it to 18 drastically increases file size. You may wish to experiment to find what works best for you, your eyes may be better or worse than mine!)
  • If you want to preserve surround sound (I do) then head over to the "Audio" tab, and under the "Codec" drop down option for the track, select Auto-passthru. You should end up with something like this:

This is important if you want surround sound - if you leave it at the default option it'll be downmixed to a reduced quality stereo. I only have a stereo setup of speakers at the moment, but I do this because if I did get a surround sound system, re-encoding every single DVD just so I can have surround sound would be a nightmare - better to do it right the first time! I'd suggest you do the same, unless you know you really definitely will never need surround sound in your rips and/or you want your rips to be as small as possible.
  • Select "MKV file" as the container - it's technically much more flexible and generally better than MP4, and all good media players now support it. (See Note 1 if you're after avi.)
  • Optional: On the "Video" tab, selecting H265 as the "Video Codec" will result in much smaller files for the same quality - I now use H265 for all my rips, and there's often around a 30% size reduction. This has a time tradeoff though (see Note 3.)
  • Head back to the video tab, and under the "Optimise Video" group, drag the preset slider until it gets to "Very Slow":


Then you can hit "Start", and wait for your video to encode!

When Handbrake is done, then there you have it - your very own DVD or Blu-ray rip! Just to make sure everything went smoothly though, it's best to double check things worked ok.


Check the subtitles!

Yup, we're back with subtitles again, though this time it's just a precautionary measure - check that any forced subtitles you're expecting to show up, actually do show up. There seems to be a bug in Handbrake with subtitles that means under certain conditions (for me this happens often with Blu-rays but not with DVDs) they won't always get written in properly.

If this happens, then fire up MKVMerge (see "joining MKV files" for a description) and load in your transcoded file, deselect the text stream that's in the file, then click "add" and add in your SRT file. MKVMerge (at least under all conditions I've tested it with) seems to do this correctly every time, unlike Handbrake.



Joining MKV files

Most of the time you won't need this step at all - it only applies to a few films I know of (such as the Lord of the Rings extended editions.) But this is where ripping can really have an advantage, because there's no need to swap discs over half way through, or even MKV files - you can rip the discs separately and then join them together in one continuous file. To do this, you need to rip both discs with *exactly* the same settings all round in Handbrake (so if you follow the above guide to the letter you should be fine) and then use a tool called MKVMerge. (This is a fantastic tool that also lets you add things like extra subtitle and audio streams after you've ripped the file, but here we'll be using it to join two MKV files together.)

MKVMerge is part of the MKVToolnix suite, which you can grab from here. When it's installed, you want to run the "MKVMerge GUI".

Once you've got it running, appending the two files together is simple and doesn't take long at all. Just click the add button, then select the first MKV file, then click append (Note: that's append the second time not add!) and select the second MKV file. You should end up with something that looks like this:



Select the output filename (towards the bottom of the window), then click on "Start muxing" and the program will join the two files seamlessly. If it spits back any errors, it's probably becase the two files weren't encoded with exactly the same settings - so double check and try again.


Wrap-up

This may have seemed like an incredibly long process for ripping a disc, and some will say it's overkill. However, while it might take a while the first time, after ripping a few discs this way the process sped up significantly. When you get used to what to do, it really doesn't take long at all, and the results can be anything from a convenient ipod-playable file to a high quality home media centre setup where you can search through and browse available films using something like Kodi or Plex. Setting that up isn't too complicated in itself either - but that's for another post!


-------------------------------------------------------------------

* Note 1: A lot of people seem to ask "Where's AVI?!" at this point, and get very upset when they can't find it. Let go! Seriously, don't bother with it, it's a horrible antiquated format that can't hold separate tracks, can't support modern codecs and can't support any files larger than 2GB (so it's absolutely useless for Blu-ray encodes especially, and very very limited even for DVD rips.) It may be what you're used to, but these days it's really awful. Don't go looking for it, Handbrake doesn't support it any more! You can of course select MP4 if you need it (usually if the device you're playing it on doesn't support MKV.)

* Note 2: How you set up handbrake is very much a personal choice, there's no right answer so don't be afraid to experiment around with the options. I've detailed there the options that I use, including the "Very Slow" preset. This deliberately takes a long time to do the encode, but produces (pretty much) the best quality / filesize ratio. There is one beyond this - placebo. The placebo preset takes this to extremes, but because of diminishing returns, it's really not worth it at all. You might have a 0.000001% increase in filesize : quality ratio if you're lucky, and the encode time will go from a few hours to a few days, hogging up 100% of CPU for all that time and having to be resumed from square one if anything goes wrong or your computer decides to run updates and restart...! You may wish to go for a faster encode if you want results more quickly, but "Very Slow" is really the slowest practically useful encode.

* Note 3: H265 is the successor to H264, and will generally give you rips less than 2/3 the size of those with H264 for the same quality. As such I now use H265 for all my rips - but be aware that this takes much, much longer. On the "veryslow" preset I use, the average DVD now takes upwards of 24 hours (it took around 3-4 before.) Also note that fewer devices will support H265, though adoption is now pretty rapid - the major media platforms such as VLC, XBMC and GStreamer all support it fine.