Wednesday, 24 April 2013

How to Remux your MKV files into MP4 files with Little to No Encoding

I often get asked "How do you play MKV files on your iPhone or PS3?" or "How do you use the MKV files in Premiere Pro?" and the answer can't. Not natively. Yes, iPhone has apps such as GoodPlayer that are capable of playing MKV files, however it is unable to play MKV files using hardware decoding, which means that the video will suck as it'll be choppy, especially as the majority of the time, it would be playing HD content.

Please note that we use "Scene" as a nickname for the standard MKV TV encode that you may find on the internet, convert to or something else.

The problem?

The "MKV" container is not compatible with these devices or software. This is mostly because it was designed as a "can contain all" container, including codecs that are not compatible with the devices so in most cases, it is just easier to block it off.

The solution?

For most cases, you can simply change the container to "MP4", which is more limited for what it can contain, but is compatible with pretty much everything out there.
 You cannot simply just change the file extension from .mkv to .mp4.

Why does this work?

A video file contains tracks. Usually, these tracks consist of 1 video track, 1 audio track and sometimes, 1 subtitle track.
The codecs used for the usual mkv are h264 for video and ac3 for audio. These are allowed in both mkv and mp4, thereby allowing you to simply "take them out of one, and stick them in another." The codecs may be different.

Please note that all iDevices are incompatible with AC3 audio in mp4 containers. You will need to convert the AC3 to AAC, which is detailed later. 

How do I do it?

There are a few ways to do this. Some require you to do it manually, others less so. At the bottom, there's a short list of software that can help you accomplish this. I can do a guide for these if I am requested to do so, but here is what I have found one of the easiest ways to do it, especially because this program is awesome enough to be able to do it in batch.

Download MKVtoMP4 from here and extract the zip file. This copy is the latest version at the time of writing, and is a beta as it includes extra compatibility. You can get the latest stable version here.
Open MkvToMp4.exe file.
We should first do some setting up so the program does what we want it to do. This is useful as the settings stay across sessions and they are used when you are doing multiple files at once, without you needing to change them one by one.
Click Setup.
There's nothing we need to configure in this window, so lets move onto the Audio tab, where the most important bits are. 
This is where it gets tricky as what you want to set it to will vary.

From Scene to iPhone

To do this, we are going to changing the MKV (h264,ac3) to MP4(h264,aac). Unfortunately, iPhones do not support AC3 within mp4 files, so we will need to transcode the audio. No fret, this only takes a few short minutes.

If you have not changed any settings in this category, then the default settings should be perfectly fine, however you may wish to up the quality of coding to 1 from 0.75. I doubt it will make any noticeable difference though.

From Scene to PS3, Xbox 360 and Other Software

Most software, the PS3 and Xbox 360 are compatible with AC3, so let's disable the AAC and enable the AC3. This will ensure it keeps the original quality and doesn't re-encode it, making the process about as fast as it can be.

Next Steps

To add a video (or videos) to the queue either a)Drag and Drop the files into white space in the upper centre or b)Use the Add button. 

If you wish to change the settings of any of the tracks, simply either double-click on them, or click and use the settings icon to the right.

Optionally adding extra tags from TheTVDB, iTunes and Manually

You may wish to add some metadata to your video files. You can use the TheTVDB and iTunes to automatically fill in most of the fields. To do so, you can do the following:
 The program should automatically search. It will most likely come up with the exact details you want, as it has the year too.

However, it may come up with multiple options if, for example, you put in just the show name where, if there are multiple shows with the same name, it will ask you to specify which by year. This is an example of such a case, and what to do:
 Once you've got to this window, click Save.
And you get....
TheTVDB isn't always complete with all of its information. For example, this is the creators tab:
You can manually add, change or delete tags too. To add a tag, simply type it in the box, and the checkbox will be automatically checked. To change a tag, simply change the box to what you want it to be. To delete a tag, uncheck the box. For example. this is the same tab, with a few changes:
Once finished, press save.

The remux process

Once you have finished setting up all your files to be remuxed, simply press start.
Confirm that you want the process started:
 Once started, you will be presented with this screen.

 The process will go through a sequence of steps.
If you are converting to AAC, these will show:
 Once the tracks are ready, the file will be built.
That's it!

Now just transfer the file to your iDevices via iTunes, PS3/Xbox via USB stick or DVD/Bluray or other programs.

1 comment: