How To Extract A 3D Blu-Ray with Free Tools

So you’ve bought that shiny 3D Blu-Ray, but they don’t make 3D TVs anymore. Now you have that shiny new VR headset, which just screams “Let me play my 3D movies!,” but alas, no such luck. Well, here is how to extract your purchased Blu-Rays (only use these instructions with movies you own, please!).

You will need a lot of space to do this (at least 2 TB, maybe more, depending on the length of the movie). I recommend using an SSD, especially for the 3D extraction because the tool generates uncompressed raw frames and is reading and writing two huge tracks simultaneously. You will need MakeMKV, ffmpeg, mkvextract (part of the MKVToolNix package), frim, and Handbrake. All but one of these steps can be done on the Mac or Linux.

The first thing you need to do is extract the movie from the Blu-Ray. This can be accomplished with MakeMKV. Choose the track that has the 3D information; make sure you check the 3D video source as well as the main video. i.e. the AVC track and the MVC track (which will look similar to “Mpeg4 MVC High@L4.1/StereoHigh@L4.1“. The MVC track will not be checked by default. Pick the language you want for your audio and subtitles, and make that MKV. The scripts below will only copy the first audio track in the file. You can adjust them if you need more.

Now you have that nice MKV file that has all the data you need for the 3D track. Unfortunately, I don’t know of any players for VR that will process the MVC data into a proper second video channel. If there were one, we could stop here. There are two reasons to continue. One, is for compatibility, the other is for size. As you can see, the MKV is an untouched original copy of the BluRay, so is very large. We will now continue and make the file more portable, and a whole lot smaller.

The next step is to extract the raw H.264 stream out of the MKV file. This will contain both the AVC and the MVC data. For this step, we will be using the mkvextract tool. The basic command is in the form of:

mkvextract -f tracks "extracted_movie.mkv" 0:"extracted_movie.h264" --fullraw

This will extract out the movie data from extracted_movie.mkv into one raw stream file called extracted_movie.h264.

I do this on the Mac, and have a small terminal script to do it all for you:

#!/bin/bash -x



mkvextract -f tracks "$FILE" 0:"$( basename "${FILE}" .mkv )".h264 --fullraw

extractsubs "${FILE}"

The last command extractsubs is a shell script I wrote that will extract out the HDMV PGS (.sup) subtitles and convert them to VOBSUB so they can be put into an MP4 container. If you prefer to keep MKVs, you can adapt that script to extract and keep the .sup file and put that directly into the MKV. This step is purely optional. If you don’t care about subtitles, then just comment out the extractsubs command and move on to the next step.

Now comes the painful part. The next step can only be done on Windows because the the frim package is Windows only, and I haven’t found an alternative that runs under linux or Mac. If anyone knows of a tool to accomplish the same thing, please comment and let me know where to find it.

To do this, I just share out my working folder and mount it as a drive on Windows. If you have an Intel Mac, this works just fine using a virtual machine with VMware Fusion or Parallels. Or you can use an external hard drive formatted with NTFS and using the Tuxera NTFS driver on the Mac. It’s up to you how you want to get the data back and forth. Just keep in mind you will be moving a lot of data.

Extract the frim package on your Windows machine where ever you like (in this example, at the top of C:\), or just put it in the same working directory on the Mac/Linux machine you are sharing from. Open a windows command prompt in the appropriate share/drive location, and then you will run a command in the form:

C:\frim\FRIMDecode64.exe -i:mvc extracted_movie.h264 -o extracted_movie_L.yuv extracted_movie_R.yuv 

Now go watch a movie or make dinner. This step will take a while.

When it has finished, you should have two files: extracted_movie_L.yuv and extracted_movie_R.yuv. These will be massive. The next step is to convert them into something more manageable. Again, I wrote a small script to do it for you:



ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1080 -pix_fmt yuv420p -r 24000/1001 -i "${FILE}"_R.yuv -c:v prores_ks -profile:v 4 -vendor apl0 -pix_fmt yuva444p10le -r 24000/1001 "${FILE}" && rm "${FILE}"_R.yuv
ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1080 -pix_fmt yuv420p -r 24000/1001 -i "${FILE}"_L.yuv -c:v prores_ks -profile:v 4 -vendor apl0 -pix_fmt yuva444p10le -r 24000/1001 "${FILE}" && rm "${FILE}"_L.yuv

if [ -f "${FILE}" ] && [ -f "${FILE}" ]
	ffmpeg -i "${FILE}" -i "${FILE}"  -i "$ORIGINAL"  -filter_complex hstack -c:v prores_ks -profile:v 4 -vendor apl0 -pix_fmt yuva444p10le -c:a copy -map 0:v:0 -map 1:v:0 -map 2:a:0 "${FILE}"-sbs-prores.mkv
	# ffmpeg -i "${FILE}" -i "${FILE}"  -i "$ORIGINAL"  -filter_complex vstack -c:v prores_ks -profile:v 4 -vendor apl0 -pix_fmt yuva444p10le -c:a copy -map 0:v:0 -map 1:v:0 -map 2:a:0 "${FILE}"-ou-prores.mkv

This script takes two parameters:

1) The filename without the _L or _R and extension. i.e if the filenames from the frim conversion are extracted_movie_L.yuv and extracted_movie_R.yuv, then the parameter would be specified as “extracted_movie“. It does not do validation of the names. The command will fail if those two file names don’t exist.

2) The file name of the original MKV you extracted from MakeMKV. e.g. “extracted_movie.mkv

This will convert the YUV RAW files into ProRes MOV files, which, while still very large, will be much smaller than the YUV files with no loss of visual data. If the conversion is successful, it will remove the YUV file. Since they are raw streams, there is no information whatsoever to tell ffmpeg the frame rate. However, every single BluRay I have converted was 24 frames per second (the 24000/1001). Little known fact; the 24 frames per second standard with movies is actually slightly less than 24 frames per second. If your source is of a different frame rate, you’ll have to determine it, and adjust the framerate accordingly.

The second part of the script (it checks that both the left (_L) eye and right (_R) eye streams are there), assembles both into a SBS or an OU (over-and under) orientation and and takes the audio from the original ripped movie and merges them all into a new MKV file.

You can comment/uncomment the last two ffmpeg commands to choose whether you want SBS or OU (or both). Note: The OU method does not work well if the source has black borders on the top and bottom.

I could have merged the top two ffmpeg lines and the bottom ones into fewer commands, but even with a 2TB volume, with larger movies, I ran out of space. So by converting the YUV files one at a time, and removing them before moving on to the next, I free up enough space for the final SBS or OU processing. If you are working with a larger volume, you could merge the conversion with the stacking commands and create the final file in one pass.

Now you have a single file with both frames aligned as you chose, and the original audio. Now we go to the last step, and use HandBrake to encode the video to its final form. Choose whatever method you like. I use H.265 because it gives you the same quality as H.264 at roughly half the bitrate. I will link to a tutorial on HandBrake and my personal settings choices when I get around to writing it.

The naming convention I use for my 3D movies is extracted_movie_3DHF.mp4. 3D to tell the player it is, in fact, a 3D movie. H for horizontal, i.e. SBS, and F for full frame. V instead of H would be vertical, or OU.

You will find many people generate 3D movies with half-width or half-height movies, which made sense long ago when many players couldn’t handle files larger than 1920×1080. That has not been the case for a while, so I decided not to throw away half of the movie data and I use full frames. If you do have a movie that is squished half frames, just leave the F off the filename to designate half frame.

Now you have a 3D movie you can copy over to your VR headset (or stream via Plex or your favorite DLNA server) and watch in glorious 3D with the player of your choice. Several I have tested, and used successfully are Pigasus VR Media Player (my personal favorite; not free, but worth every penny), BigScreen VR, and SkyBox VR Player. There are many more to choose from. Pick the one you like. These will get you started, though.

Leave a Comment