How to Convert H.264 MKV Files to MP4 Without Re-encoding (Mac)

Posted April 8, 2012 at 5:16pm by iClarified | Please help us and submit a translation by clicking here | 48133 views

These are instructions on how to convert H.264 MKV files to MP4 without re-encoding.

Following this procedure will save you lots of time and prevent video quality degradation if you need video in mp4 format for playback through iTunes, the Apple TV, or on your iOS device.

***We have posted an easier version of this tutorial here, we suggest that most users follow that tutorial instead.***


IDENTIFY THE SOURCE VIDEO AND AUDIO
Before beginning lets get some details on the source video and audio.

Step One
Download and install VideoSpec to your Applications folder from here.

Step Two
Launch VideoSpec from your Applications folder.


Step Three
Click Select from the toolbar.


Step Four
Choose your .mkv file and click Open.


Step Five
Make sure the video format is H.264 and take note of the Frame Rate (fps) and Audio Format.


Important: Make note of the Encoding Profile. Some older Apple devices only support the Main profile so if your video is High Profile this procedure may not work. The new Apple TV supports High Profile at Level 4.0; however, we have tested level 4.1 and it worked fine in all attempts. The iPhone and iPad support High Profile level 4.1.


EXTRACT VIDEO AND AUDIO FROM MKV
Demux (ie extract) the video and audio tracks from the MKV container format.

Step One
Download and install iMKVExtract from here to your applications folder.


Step Two
Launch iMKVExtract and click the Browse button to select your Matroska file.


Step Three
Select your mkv file and click the Choose button.


Step Four
Select the video and audio track for extraction. These are usually track one and track two.


Change the target folder if need be and click the Extract button.

Step Five
iMKVExtract will let you know when the extraction is complete.



CONVERT AUDIO TO AAC
If the audio track you extracted is NOT in AAC format than you will need to convert it. If it is in AAC format then you can skip this section.

Step One
You can use your favorite application to convert the audio or try Audio-Converter which can be downloaded from the Mac App Store here.

Step Two
Launch Audio-Converter from the Applications folder.


Step Three
Set the Convert To: dropdown to AAC then set the destination folder to the folder than contains the files we extracted earlier.


Step Four
Drop the audio file that was extracted from the mkv into Audio-Converter to begin conversion. Note: the audio files will likely be named audio2.ac3 or audio2.dts.



COMBINE VIDEO AND AUDIO INTO MP4 FILE
Mux the .h264 video and the .aac audio file into a mp4 file using MP4Box.

Step One
Download MP4Box from here and save it to the same folder as your extracted video and audio. Double click to extract the archive if need be.


Step Two
Open a new Terminal window from Applications:Utilities.


Step Three
Navigate to the folder your video and audio is located in.
ie. cd ~/Desktop/[mkvextract]video


Step Four
Execute the command to create a MP4 video. Make sure to specify the frame rate we noted earlier or your audio will be out of sync. Also be sure to use the .aac audio file and not the original.

ie. ./MP4Box -fps 23.976 -add video1.h264 -add audio2.aac video.mp4


Step Five
MP4Box will now combine the video and audio tracks into a mp4 that can be added to iTunes!


Share
Add Comment
waderelle - June 24, 2014 at 9:48am
Here is a guide at: http://www.faasoft.com/articles/stream-mkv-to-apple-tv.html The first thing to know or has well known is that there are only two official and free methods to stream video files to Apple TV from computer: iTunes or AirPlay. Unfortunately, neither of the two supports MKV as the input format. Likewise, you'll be greatly disappointed if you turn to other alternatives since most of them are not only expensive but also have inevitable defects: only support several formats, require installing some plug-ins, and with an endless line of embedded goods, etc. To successfully stream MKV or HD MKV to Apple TV, here, I strongly recommend to convert MKV to Apple TV as well as iTunes and AirPlay supported formats
ghnabs - December 6, 2013 at 1:52am
I know a simple and fast way to stream and play MKV on Apple TV, Apple TV 2 or the new Apple TV 3: Convert MKV to Apple TV as well as iTunes compatible video format to stream MKV to Apple TV from iTunes for playing MKV on ATV successfully here: http://www.bigasoft.com/articles/stream-and-play-mkv-on-apple-tv.html
richardvalentinew - December 2, 2013 at 6:31am
I just find a step by step guide on how to convert MKV to Apple TV MP4 format at http://www.idealshare.net/itunes-quicktime/apple-tv-mkv-solution.html It also applies to convert other video formats like WMV, AVI, DivX, Xvid, RealMedia (rm), Flash format, GIF, SWF, FLV, ASF, MPG, 3GP, WebM, and etc to Apple TV supported format
Aimee11 - April 9, 2012 at 3:04am
Nice Tips! Yeah, there are many free tools like MKVtools, Mp4 tools can do this works, as I always use Handbrake to convert before read this article. But think I still don't abandon Handbrake as it can do many more works on DVD movies for my Apple TV: http://www.ifunia.com/news/using-appletv-as-new-your-home-media-centre/
Randy - April 8, 2012 at 10:13pm
Also subler doesn't reencode either. It re-wraps .mkv as mp4s. Most tv shows take under 1 minute to change.
13 More Comments
Follow iClarified