Copying Blu-Rays

OK, the first question you’re bound to ask is: isn’t it piracy to copy a Blu-Ray? Well, it is and it isn’t. “Fair use” laws say that you can make personal-use copies of movies you legally own. For example, if I own a movie on Blu-Ray, I can make a DVD of that movie so my son can watch it on his portable DVD player. Similarly, I can make an MKV version of that movie so I can put it on a digital set-top media player, or my son’s iPod. I can also take screen-shots of the movie for my own personal use. However, the DMCA in the US (and whatever similar laws the US media industry bribes politicians to create in other western countries) outlawed unlicensed decryption technology, so even though the copying itself is legal, the technology used to perform the copy is illegal (yes, that’s right: you don’t need a license for a gun in the US, but you do need a license for digital decryption software).

This whole situation is highly unreasonable, and media companies are slowly realizing that it’s ridiculous to prosecute people who make copies of their own legal discs. That’s why a lot of newer movies come with “digital copy” technology, which is basically a special software that will make a DRM copy of the movie on your computer or your iPod. DRM stands for “Digital Rights Management”, and it’s basically tech-speak for “it’s locked so it will only work on the one device you transfer it to, and can’t be copied anywhere else”. This means that these “digital copies” can’t be put on a media server in your house and then viewed on playback devices over the network, among other aggravations. While the “digital copies” are nice, they are no substitute for being able to manipulate the content yourself, especially since you already paid for it. They also aren’t necessarily provided on every Blu-Ray.

So how does one get around this? Well, I can’t officially condone or promote anything, but just for the sake of information, the Aruba-based company SlySoft makes an excellent product called “AnyDVD HD”, which is an example (actually, the pre-eminent example) of Blu-Ray decryption software, and yes, it’s illegal in the US (and will soon become illegal in Canada as well, if the business-stooge conservatives have their way). Ironically enough, AnyDVD HD employs copy-protection software to prevent illegal copies :)

Anyway, assuming you have a Blu-Ray drive in your computer (not to mention a big hard drive and fast processor) and you can get around the Blu-Ray copy protection, you will need a bunch of other software to make digital-format copies of it (sorry, but I can only name them; I can’t offer them for download myself):

  • Some way to rip the Blu-Ray to your hard disk, such as AnyDVD HD.
  • K-Lite Codec Pack
  • BDEdit
  • ChapterGrabber
  • AVISynth (with DGDecode and DGAVCDecode)
  • tsMuxer
  • MeGUI
  • mkvtoolnix

K-Lite Codec Pack: this is a collection of codecs (compressors/decompressors) that are used in order to encode or decode video and audio formats. Without the K-Lite Codec Pack, you might not be able to view Blu-Ray content even if you can get around the copy protection, and you probably won’t be able to encode it in all the formats you want. Again, you can just install this and it will work transparently. Things which you couldn’t view in Media Player will now work in Media Player (some versions of K-Lite even install their own version of Media Player, which works alongside the regular one).

BDEdit: this allows you to view the internal structure of a Blu-Ray. You won’t always need it, but when you do need it, it’s indispensable (more on this later).

ChapterGrabber: this allows you to grab the chapter stops from a Blu-Ray, which is (obviously) useful for putting the same chapter stops into your MKV file.

AVISynth: AVISynth is a script-based program (yes, that’s right: no GUI, so you touch-screen people who think you’re really cool but actually have the tech skills of a hamster are S.O.L.). It allows you to create scripts which allow you to take a wide variety of input formats, process them if so desired, and then serve them up as an unencrypted video stream for other programs to use. If you don’t know what this means (and I wasn’t sure the first time I saw it either), here’s an example. Let’s assume you’ve already installed AVISynth. Go to the directory where you ripped the Blu-Ray (let’s call it “C:\RIP”), and go into the BDMV/STREAM subdirectory. You’ll see something like this:

    00000.m2ts    414,420 KB
    00001.m2ts    109,962 KB
    00002.m2ts    290,442 KB
    00003.m2ts    51,816 KB
    00004.m2ts    34,374,636 KB
    00005.m2ts    252,534 KB
    00006.m2ts    72,354 KB
    00007.m2ts    89,130 KB
    00008.m2ts    37,692 KB
    00009.m2ts    330,096 KB
    00010.m2ts    234,776 KB

Notice how one of those files is huge, while the rest are relatively small. That one is obviously the main movie, while the others are various features. The number changes from movie to movie, so you have to check it out each time. Now make a text file called “BluRay.avs” somewhere, and edit it with NotePad so that it looks like this:

    DirectShowSource("C:\RIP\BDMV\STREAM\00004.m2ts")

If you play Blu-Ray.avs in Windows Media Player, you will find that you’re watching the movie. Neat, eh?

“But wait” you might ask: “why don’t I just double-click on 00004.m2ts and watch it in Media Player, without this AVISynth mumbo jumbo?” That’s a good question, with a few different answers. The first answer is: what if you want to open it in something like VirtualDub, which is handy for things like screen-shots but doesn’t understand m2ts format? The second answer is: what if you want to change the resolution or do some other tricks with it? Let’s make a slightly more sophisticated version of our AVISynth script, which looks like this:

    DirectShowSource("C:\RIP\BDMV\STREAM\00004.m2ts")
    BilinearResize(1280,720)

You can do lots of other neat things with AVISynth scripts besides resizing video (go look it up). Anyway, if you watch Blu-Ray.avs in Windows Media Player now, it’s been downscaled from 1080p to 720p. Hence, you can run this through MeGUI and make a 720p MKV file now, which should still look great but will only be a couple of gigabytes, and is therefore much smaller and more portable than the original 1080p full-HD version. But there’s another reason to use AVISynth: suppose you look into the BDMV/STREAM directory and see something like this:

    00000.m2ts    12,532,210 KB
    00001.m2ts    15,928,652 KB
    00002.m2ts    290,442 KB
    00003.m2ts    51,816 KB
    00004.m2ts    72,354 KB
    00005.m2ts    89,130 KB
    00006.m2ts    37,692 KB
    00007.m2ts    330,096 KB
    00008.m2ts    234,776 KB

Which one is the movie? As it turns out, it’s both: some Blu-Rays split the movie into pieces. AVISynth can come to the rescue here by allowing you to join two movie segments together, with a script like this:

    video1=DirectShowSource("C:\RIP\BDMV\STREAM\00000.m2ts")
    video2=DirectShowSource("C:\RIP\BDMV\STREAM\00001.m2ts")
    video1++video2
    BilinearResize(1280,720)

That neatly solves the problem, but what if we have something like the Gladiator Blu-Ray, which splits up the movie into no less than twenty seven pieces? They didn’t do it just to be malicious; they did it so they could splice in extra scenes for the extended edition of the movie. But it’s still a mess, and the segments are out of order. Therefore, you need to use BDEdit (remember I said we’d come back to it later?) to check out the disc structure, with the help of ChapterGrabber. First, open up the disc in ChapterGrabber:

ChapterGrabber screenshot

Those files are playlists. Looking at the list, we can examine the length and number of chapters to make a pretty good guess at which playlist is the movie. Playlist 00010 is 2 hours and 50 minutes long with 28 chapters, so it must be the extended edition of the movie, and Playlist 00011 is 2 hours and 35 minutes long, so it must be the regular version of the movie. Now we can use BDEdit to examine the disc and figure out which M2TS files to grab:

BDEdit screenshot

If you look at the screenshot, you can see that there’s a list of files: 00102, 00198, 00103, 00105, etc. Now you have the numbers, so you have to concatenate all of the corresponding m2ts files. This is getting to be a lot of work! Gladiator is one of the nastiest Blu-Rays to process. We could use AVISynth here, but that’s a big nasty AVISynth script, and AVISynth gets really slow with that many segments, so we’ll have to try another approach. Hence, TSMuxer.

tsMuxer: tsMuxer allows you to extract audio, video, or other streams from one or more m2ts files on the Blu-Ray. Those m2ts files are actually “container” files which can contain any number of “streams”, or “tracks”, which can be split out into separate files and processed directly. A typical Blu-Ray m2ts file will have one or more video streams (for the movie and an alternate-view stream such as a “behind the scenes” video), a number of audio streams (English, other languages, and commentary tracks), and a number of subtitle streams. You generally want the HD video stream and the first audio stream.

TSMuxer screenshot

Now, we can string all of our 27 pieces of Gladiator together, and strip out the video and audio streams into single files. Just use the “add” and “join” buttons to tee them all up in “Input files”, then move down to the “Tracks” part and uncheck everything but the H.264 and DTS-HD tracks (that’s the video and audio for this disc).

DTS-HD audio tracks highlight another reason for TSMuxer: Windows DirectShow can’t handle DTS-HD, so if you try to use AVISynth with an m2ts file containing DTS-HD, it will just ignore it and play the second audio track, which is AC3 and which will be French in this case. Unless you’re French, this is probably not what you want, so we need to convert that DTS-HD stream to something else.

Highlight the DTS track, move down to the “General track options” area, and check the “Downconvert DTS-HD to DTS” option (if the disc uses AC3 True-HD, it will be called “Downconvert TRUE-HD to AC3” instead), and then move down to the Output area, click on the “Demux” button, and tell it which directory to dump the files in. Now hit the “Start demuxing” button at the bottom of the screen, and it will make giant files containing the video and audio streams from the disc. In the case of Gladiator, the video file will be a 29GB file with a .264 extension and the audio file will be a 1.9GB file with a .dts extension. Mind you, a .264 file is a raw video file and can’t be handled by most software, and besides, we still want to downscale it to 720p, so we go back to AVISynth and use the DGAVCDecode plugin to read in the .264 file. First, use dgavcindex to make a .dga project index (let’s call it “Gladiator video”) for the .264 file (I know, I know, this is all sounding so complicated that you’re thinking of giving up, but it’s really not that bad when you actually do it), and then make an AVISynth script to finally view the movie. The resulting script looks like this:

    loadplugin("C:\Program Files\AVISynth 2.5\plugins\dgavcdecode.dll")
    avcsource("Gladiator video.dga")
    BilinearResize(1280,720)

Now you finally have a .dts file and an AVISynth script which can be read by many types of video format conversion software. Note that if it was an MPEG video stream instead of an H.264 video stream, you would use dginex, dgdecode, and mpeg2source instead of dgavcindex, dgavcdecode, and avcsource. Anyway, we’re ready to go, so it’s time for meGUI!

meGUI: meGUI has a goofy name but it’s extremely useful, because it does all the converting. The installation can be a pain in the ass because it will ask you to install a bunch of other stuff so that it can work (and then tell it where all this other stuff is installed), but once it’s properly set up, you’re golden. To make an MKV file, you’ll want to convert the AVISynth script to “x264: Bluray”, with quality set to 21 (higher values will tend to produce blockiness, particularly in dark scenes). You’ll also want to convert the audio stream (whether it’s the AVISynth script or an AC3 or DTS file you extracted with tsMuxer) to “FAAC”, with “Output Channels” set to “Downmix multichannel to Stereo” and the bitrate set to “ABR” and “128” (or “160” if you want really good audio quality).

MeGUI screenshot #1

MeGUI is pretty easy to use. You select your input audio and video files, then hit the “Enqueue” button to tee up each job in the queue (ignore that “Queue Analysis Pass” thing on the video panel). Then you hit the “Queue” tab at the top, and you’ll see the queue screen:

MeGUI screenshot #2

Hit the “Start” button and expect a long wait, because it will spend hours processing the files. Luckily, it does this at low CPU priority by default, so you can still use the computer for other things (I even played a game on a computer which was processing these files). It’s also capable of multi-threading, so you can spawn another “worker” and have two tasks running at once. This is particularly handy in an era when pretty much every computer out there has multiple CPU cores.

mkvtoolnix: mkvtoolnix is the final step. Here’s where you assemble the video MKV file and the audio file (which should be an mp4 file) into a single MKV file. You can also throw in subtitles and chapters at this point (which can be downloaded from opensubtitles.org) and set chapters, for really nice full-featured MKV files. Just be careful to set “Compression” to “none” in the “Extra Options” for each stream, because some MKV players don’t like the extra compression that mkvmerge uses (which is actually header compression, and which is pointless). And finally, you have a nice 720p MKV file which is small, portable, still looks far better than SD DVD, and can be moved from device to device in your house without drama (and yes, these personal copies are legal, even if the software necessary to make them is illegal).

OK, so the whole process goes like this:

  1. Rip the Blu-Ray onto your hard disk, using a tool of your choice.
  2. Figure out the structure of the Blu-Ray, using ChapterGrabber and BDEdit if necessary. Hopefully there will be one giant .m2ts file, but some discs are more complex.
  3. If the Blu-Ray uses AC3 True-HD or DTS-HD, use tsMuxer to strip out the audio stream and downconvert it to regular AC3 or DTS.
  4. If the Blu-Ray splits up the movie into many pieces, use tsMuxer to tee up the segments and then strip out the video stream into a single file.
  5. Create an AVISynth script to view and/or resize the Blu-Ray video stream to the size you want, whether it be 720p, 540p for iPods, etc.
  6. Convert the audio and video to x264 video and AAC audio with MeGUI.
  7. Combine the two resulting files into an MKV file with mkvmerge GUI, along with subtitles and chapters if you still feel up to it.

I know, I know, it’s messy and sounds like a lot of work. But it gets the job done, and with the exception of AnyDVD HD, it uses tools you can download for free, with a bit of Googling. I’ll be the first to admit that it would be much nicer to have a slick piece of software that does all of this in one box, instead of this mishmash of tools and procedures. But given the fact that the movie industry has spent millions of dollars trying to ensure that we can’t do this at all, I wouldn’t hold my breath waiting for someone to make this software. Usually, the people who make slick software want to go commercial with it.

Besides, after you’ve done it more than once, it’s actually pretty easy for most movies (Gladiator excepted), and doesn’t take much of your time (although it will take many hours of the computer’s time). Now can you dump the nice small (and portable) MKV file onto a networked media server, an iPod, or whatever other toy you want to use. If you have DVD authoring software, you can even adapt this procedure to make a regular DVD from it (which is handy if you want to watch your Blu-Ray on a portable DVD player). All you’d have to do is resize the video to 720×480 instead of 1280×720, replace MeGUI with some kind of DVD authoring software, and set the DVD authoring software to 16:9 aspect ratio, because DVD uses non-square pixels. Good luck!

8 Responses to Copying Blu-Rays

  1. Alex says:

    Great article – thank you! I had almost given up on Blurays with nasty structures..

  2. Nick says:

    if you use software to disable the blu-ray protection (eg AnyDVD HD or similar) then you can copy the blu-ray file to your harddisk in .mkv format using “makemkv”. If you want to watch straight from the disk, you can just use Media Player Classic: Home Cinema and browse to the file you need through the player itself. Media Player Classic will work out which order to play the files in itself. Job done!

  3. Bill says:

    HI Mike,

    Thanks for the informative article. I have one question: there are more than one playlist in the ChapterGrabber screen capture of Gladiator that is 2:35:01. How did you know which one to use?

    • Michael Wong says:

      The easiest way is to simply navigate to the playlist directory and double-click on it, assuming you have the necessary codecs on your computer to play it. Sometimes, discs will have many different titles which appear to play the same; I’m not sure why. If you click on it to ensure that it plays normally, you can use it.

      • rez says:

        Couldn’t agree more MakeMKV is simple, quick and totally lossless compared to the source disc. Highly reccomended.

  4. Rob says:

    Mike…

    I came to your site to learn how to make archived copies of Blu-ray discs that I already have bought and paid for from a legitimate store.

    My dilemma is with Slysoft’s AnyDVD/HD and dvd clone. DVD Clone won’t copy blu-rays, and they have no plans on introducing a compatible program that will work with ANYDVD/HD.

    It’s a jungle out there trying to get these programs to work, and the conduit virus loves these sites.

    Please recommend a software combination that gets the job done. I’d really appreciate that.

    Help!!

    Frustated is putting it mildly here.

    Got a great xps8700 with twin bluray rom/rw drives, and they’re sitting idle right now.

    Would you be so kind as to suggest the right software combination that can get the job done? I’d truly appreciate your help here

    • Michael Wong says:

      If you’re just making archival copies, then you can just copy the disc to your hard drive with AnyDVD HD directly (just right-click on the AnyDVD HD icon and select the “copy to disc” option), and then burn it to a double-layer BD with a current version of Nero.

      If you want to remaster it from 50GB to 25GB, that’s a trickier proposition.

  5. Yellow Devil says:

    (yes, that’s right: you don’t need a license for a gun in the US, but you do need a license for digital decryption software) Just to clarify because I’m sure you are all for objectivity, in certain states you do indeed have to have a license to own and/or carry a firearm, and in some cases they are separate licenses (Illinois comes to mind) .

Leave a Reply

Your email address will not be published. Required fields are marked *