Lossless conversion of MKV to MP4

Easy MKV to MP4

Recently I discovered that Davinci Resolve (NLE and Color Grading software) is incapable of reading MKV ("Matroska" multimedia container) files.  MKV files are my go-to container format simply because of the convenience, given that there are utilities provided for muxing/demuxing and it supports any video or audio formats you want to use within the container.

Unfortunately the Davinci Resolve media pool just ignores files with that extension.  Shame on them, I would have expected them to adopt open standards like Matroska.  For what it's worth it looks like other NLE software like Adobe Premiere Pro does not support it either.  I guess their justification is that they only need to support the formats that cameras record in.

Anyway, given I was working with H.264 video and AAC audio, I knew I should be able to put multiplex into a MP4 (or even MOV) container to make it compatible with Davinci Resolve.

A quick Internet search found crazy posts and videos where people are using tools that perform a lossy conversion, or and perhaps even worse installing "special" software to do the job (which could contain some form of malware).

Frankly I don't want to be installing special software, not when there are open source utilities that will do the job, utilities I already have installed on my computer.  So here are two ways to perform a lossless conversion of MKV into MP4.

OBS Studio Logo

Conversion using OBS

OBS Studio is free and open source software for video recording and live streaming.  It is commonly used by people streaming games, or recording "screencasting" tutorials.

The default container format used for recordings in OBS is MKV.  In the settings you can choose MP4 or MOV as the recording format, however you are encouraged not to use those formats with this warning.

Warning: Recordings saved to MP4/MOV will be unrecoverable if the file created cannot be finalized (e.g. as a result of BSODs, power losses, etc). If you want to record multiple audio tracks consider using MKV and remux the recording to MP4/MOV after it is finished (File → Remux Recordings).

So, that's the answer.  Just use the capability built-into OBS to do the remuxing.  Note that while the menu option says "Remux Recordings", I've seen no problems remuxing any MKV files that I've thrown at it.

OBS File Menu, Select Remux Recordings
You can tell that it is remuxing and not reencoding the video/audio because the container conversion is very quick - even for large files.

Nothing could be easier.

VLC Logo

Conversion using VLC

VLC is a free and open source cross-platform multimedia player.  It's one of the first programs most people install on a new computer, because the software can handle any video or audio formats even if the underlying operating system does not.

The software however does much more than just playing media files.  One of the functions it can do is perform media conversion, including lossless conversion from MKV to MP4.

From the Media menu choose Convert / Save.

VLC Media menu, selecting Convert / Save

Add your source MKV media, then click on Convert / Save.

VLC Open Media, select input file(s) and click Convert / Save
Click on the button to create a new profile.

VLC Convert Settings - Create new profile
I've named the profile "Lossless MP4".  Configure as shown, ensuring that "Keep original track" is selected in the Audio/Video settings.

VLC Profile Encapsulation - Use MP4/MOV encapsulation

VLC Profile Video codec - Keep original video track
VLC Profile Audio codec - Keep original audio track
Then run the conversion.  As with OBS, the conversion will be fast, because the video/audio is not being reencoded.

VLC final step, running the lossless conversion
Note, at one point VLC could also concatenate multiple files using this conversion function.  However that is no longer working, instead VLC does not allow entry of a destination filename.  If you proceed with the conversion, then each file will be converted separately - in effect it only operates as a batch conversion.

VLC Destination File "Multiple Files Selected" when performing batch conversion


Hope you find that helpful.

Avoid making any lossy conversion to your source media, and certainly not because of the container format.  Use the built-in proxy capability if you need to convert for performance reasons.

I encourage you to seek out open source alternatives where possible.


Popular posts from this blog

Resolving FOSCAM connection dropouts

Building an automatic chicken door opener

Analysis of Fader ND (mark I) filter image quality