Introduction
This tutorial will tell you how to take a M2TS Bluray torrent like this and turn it into MKV files like these. We’ll be working on a Windows system, but I know MKVToolNix and MediaInfo are available on Linux and Mac OS X as well.
An untouched Bluray disc contains many files and folders, like .M2TS, .MPLS, and .BDMV files. Many, if not most, users prefer to have .MKV files that are properly named so they know exactly what they are playing and it is more convenient to access it. The discs not only include the episodes, but any extras and menus as well. These Bluray discs are usually encoded by other users and it makes the episodes a lot smaller and size, but they also lose their quality. But with remuxing there is no quality loss because the streams are taken in and are put into a .MKV container. Remuxing is also much faster and less CPU intensive than encoding, and you also don’t need specific settings. The .MKV file will contain the main video stream and all the audio and text tracks (subtitles) as well. The file size is usually smaller since there is lossless compression.
If you already have MKVToolNix please make sure it is at least version 7.3.0.Required Tools and Dependencies
- MKVToolNix for MKVMerge ver. 7.3.0 or higher (Choose your OS along the top and follow the links to the downloads)
- MediaInfo (Always good to have, but not necessary for this tutorial)
Here are the steps summarized:Instructions
1. Get an untouched Bluray disc either by downloading it or ripping it yourself.
2. Install MKVToolNix for MKVMerge
3. Put the command line in a text file, and change the file extension.
4. Run the script (either for the .MPLS or .M2TS files)
5. Put the .MKV files into the folder, and only keep the episodes and maybe put the extras somewhere else. Rename the .MKV files.
Step 1. Get an untouched Bluray
You can get one from here or another torrent site, and make sure it untouched. Or you can copy a Bluray disc yourself if you have a Bluray drive, which I never have done beforebut I’m sure there are guides all over the Internet. So I’ll continue with how to download Blurays from here. The container you’ll be looking for is M2TS and you can see all the ones posted on this site here torrents.php?action=advanced&format=M2TSBefore downloading it you want to make sure no one made a Remux of it yet. For example: torrents.php?id=168880
You can see the M2TS Torrent Veep.S02.1080p.Blu-ray.AVC.DTS-HD.MA.5.1-NTb, but right below it is the Remux one Veep.S02.1080p.Remux.BluRay.DTS-HD.MA.5.1.H.264-KDL. Look at the file sizes, the untouched Bluray is 86.80 GB while the Remux is 66.18 GB. And look at the largest encode Veep.S02.1080p.BluRay.x264-ROVERS, which is only 21.78 GB. The Remuxes should be much bigger than the encoded videos. I think there might be Remuxes that aren’t labeled as such, so you might not always know for sure if someone uploaded a remux already. But if you determined that the remux isn’t already available, grab the M2TS torrent and download it with your torrent client.
Step 2. Installing MKVToolNix for MKVMerge
This is pretty straight forward. Go to this site, http://www.bunkus.org/videotools/mkvtoolnix/downloads.html and pick your OS and follow the links to the download. I recommend choosing the installation version over the portable version just because the script depends on MKVMerge being in a static location. You can use MKVMerge via script or by using the GUI which is mmg.exe on Windows, and drag in the file you want to make into a .MKV and start it up. In this tutorial we want to keep it simple and quick, so I’ll leave out those details.Step 3. Making the Command Line Script
Here is the script for Windows. This part is for Windows only, and you will need to figure out how to do it easily for your own OS. I would imagine the first script only needs a slight modification to work on Linux and Mac OS X.You need to change the location of mvkmerge.exe and eac3to.exe if it is not in Program Files (x86) or if you aren't using Windows.
Pick one script to use.
Simple script where the only pre-requisite is MKVToolNix for Windows. You just copy this script to the folder with the files you want to remux in order to run it.
Code
set mkvmerge="C:\Program Files (x86)\MKVToolNix\mkvmerge.exe"
for %%f in (*.m2ts) do %mkvmerge% -o "%%~nf.mkv" "%%~f"
for %%f in (*.mpls) do %mkvmerge% -o "%%~nf.mkv" "%%~f"
Drag and drop the files you want to remux into MKV (m2ts or mpls), rather than remuxing the whole folder you select and drop the files you want onto the .BAT script. It requires MKVToolNix and Windows. It can be very useful if you are going through a folder and you are looking for videos you want to remux because you can drag and drop one or more files you want onto the script and while it is remuxing you can drag and drop the some more. You also can keep the .BAT script in one location instead of moving it to each of the folders, because it automatically outputs to the input folders.
Code
@echo OFF
set mkvmerge="C:\Program Files (x86)\MKVToolNix\mkvmerge.exe"
:again
if "%~1" == "" goto done
echo "%~1"
set source=%~1
set dest=%~n1%.mkv
%mkvmerge% -o "%dest%" "%source%"
shift
goto again
:done
exit
Copy it and paste it in a Text Document (Notepad), and save it as any name you want. Change the file’s extension to “.bat”, so that the file would be named like this, “TheScript.bat”.
Step 4. Run the Script
You will need to decide whether you want to remux the .M2TS files directly into .MKV files, or if you want to remux the .MPLS playlists into .MKV files. If every single episode is contained in their own .M2TS file, then it will be fine to remux those. But if each episode is split into multiple .M2TS files, which is pretty uncommon from what I can tell, then you want to remux the .MPLS files which link together the multiple .M2TS files. Check the length of .M2TS files and see if there are some that are the episode length. The .M2TS files are located in the STREAM folder, and the .MPLS files are in the PLAYLIST folder.If you are using the first script, put the script in the “BDMV\STREAM” folder or the “BDMV\PLAYLIST” folder. And run it. If the command prompt window appears and then immediately disappears, then something went wrong and go to “Common Problems” section for further help. This script will search for .M2TS and .MPLS files to make the .MKV files.
If you are using the second script, just drag and drop the .M2TS and/or .MPLS files that you want to remux into .MKV files.
Wait until the command prompt window to close by itself, so you know that the script has finished running. Look through the .MKV files and collect the ones that are whole episodes, and keep the extras if you want. Make sure it has the correct audio and subtitle tracks using MediaInfo. Repeat this process for the other Bluray discs.
Step 5. Name the Episodes
Put all the .MKV episodes in one folder. The episodes aren’t always in order, and in my experience they usually aren’t. So you have to go through each episode and figure out which one they are. If there is a title card screen or anything like that, then that would be very helpful in figuring that out. If not then go to the Wikipedia page or someplace that has the episode descriptions for the season, and then go through the episode to try to figure out what episode is what. Name the episode something like, “Veep.S02E02.Signals.1080p.Bluray-YourReleaseName” so that if someone is looking for a specific episode, but their episode order is different from yours then they could go based off of the name instead of just the number.Common Problems
An Audio Track is missing in the Remux
If the audio track is in the LPCM format, then try updating MKVToolNix to version 7.3.0 or higher (highly recommended), or if you have an older version of MKVToolNix (before version 7.3.0) try using the script posted here forums.php?action=viewthread&threadid=17596#post790673 .Command Prompt Closes Immediately
If the command line window pops up and immediately disappears then something went wrong.Go to the parent folder (the folder above the current one) and hold CTRL+SHIFT and then Right Click the folder you were just in and choose, “Open command window here”. Type in the name of the script to run it (without .bat), and if it has spaces in the name then put the whole thing between double quotes like this “TheScript”, and hit enter and it will run and read the resulting error message and try to fix the problem.
Thanks to onana for notifying me about MKVToolNix being updated to support LPCM audio tracks.Special Thanks and Last Word
Also thanks to keyfan for making this script that's no longer needed if you have the updated MKVToolNix by itself. If you still want it for legacy reasons, then it is still kept here in this post: forums.php?action=viewthread&threadid=17596#post790673
Feel free to PM or to post here if you have any questions. If you are a little bit confused I'll read your post and improve the tutorial so it is more clear to others.
Last edited by RightClickSaveWorld 5 years, 9 months ago