Convert mkv movies into mp4

Aegelward

macrumors 6502a
Original poster
Jul 31, 2005
528
54
UK
i was wondering if there was any way to convert an h.264 mkv file (with subtitles) into a mp4/m4v file, without having to re-encode it, but allow for adding meta data. viddyup does this to an extent, but it is limited to converting the file into an .mov, which within itunes isn't maintaining chapter data (they show, but the markers are all set at 0:00. curiously they still work under regular quicktime)

but i would also like to add art, and other metadata which the .mov format won't allow...
 

speakerwizard

macrumors 68000
Aug 8, 2006
1,655
0
London
avoid mkv if you can, its possible to convert but far too much effort, if you search my early posts there is a thread about it but just EFFORT
 

Blazer5913

macrumors 6502
Jan 20, 2004
368
12
Use VisualHub. I just bought it to convert about 200gb of High Def videos to work on my AppleTv. Looking great soo far
 

daze

macrumors 6502
Mar 11, 2006
400
0
San Jose, California

gnkieffer

macrumors newbie
Dec 16, 2007
3
0
I found a very simple way to convert MKV to MP4 without using command line tools and with no re-encoding of the video stream, no quality lost. It requires Quicktime Pro and Perian. I wrote a quick tutorial with screen shots on my blog.
You only need to export the movie using Quicktime and yesssss, there is a Pass Through option for the video :D Quicktime always surprises me :apple:
 

wmealer

macrumors regular
May 7, 2006
173
0
I found a very simple way to convert MKV to MP4 without using command line tools and with no re-encoding of the video stream, no quality lost. It requires Quicktime Pro and Perian. I wrote a quick tutorial with screen shots on my blog.
You only need to export the movie using Quicktime and yesssss, there is a Pass Through option for the video :D Quicktime always surprises me :apple:
I have seen this several times on the net, and every time I try it with any of my 720p mkv files, neither my :apple:tv nor my PS3 can recognize the resulting mp4 as a playable file.
 

gnkieffer

macrumors newbie
Dec 16, 2007
3
0
I have seen this several times on the net, and every time I try it with any of my 720p mkv files, neither my :apple:tv nor my PS3 can recognize the resulting mp4 as a playable file.
You may try to re-encode the video stream too. Maybe the streams in your MKV files were encoded with parameters unsupported by Apple TV / PS3. Or the bitrate might be to high.
If you encode with quicktime within the bitrate and resolution limits of the Apple TV the resulting file must work, as Apple TV also uses Quicktime to decode it.

Edit 2: According to the official Apple TV Tech Specs, a 720p file is even limited in its frame rate to be playable: max 24fps
 

fkntotalkaos

macrumors 6502
Nov 24, 2007
306
0
I found a very simple way to convert MKV to MP4 without using command line tools and with no re-encoding of the video stream, no quality lost. It requires Quicktime Pro and Perian. I wrote a quick tutorial with screen shots on my blog.
You only need to export the movie using Quicktime and yesssss, there is a Pass Through option for the video :D Quicktime always surprises me :apple:
Great tutorial , but i have a few questions.
Are you saying encode sound at 160? Because your settings are 256.
And my inspector shows H.264 960 x 528, but i can not select pass through on video settings
 

gnkieffer

macrumors newbie
Dec 16, 2007
3
0
Great tutorial , but i have a few questions.
Are you saying encode sound at 160? Because your settings are 256.
And my inspector shows H.264 960 x 528, but i can not select pass through on video settings
Thanks! You may use the bitrate you want but some devices may not play back high bitrates. The Apple TV for example only plays video files with up to 160kbps audio streams, not higher (according to Apple).

Make sure that you have selected the Video Format MP4 and not MP4 (ISMA).
It's the 5th screenshot in the tutorial. If you select the second option, then the Pass Through option will be grayed out.
 

wmealer

macrumors regular
May 7, 2006
173
0
You may try to re-encode the video stream too. Maybe the streams in your MKV files were encoded with parameters unsupported by Apple TV / PS3. Or the bitrate might be to high.
If you encode with quicktime within the bitrate and resolution limits of the Apple TV the resulting file must work, as Apple TV also uses Quicktime to decode it.

Edit 2: According to the official Apple TV Tech Specs, a 720p file is even limited in its frame rate to be playable: max 24fps
Yes, I use VisualHub to re-encode the entire file, but I thought the idea of your post was to NOT touch the video, and have it playable on :apple:tv...

This is an :apple:tv forum, after all...:rolleyes: No worries, I guess I'm just frustrated that :apple:tv can't handle the high-quality video contained in these great looking mkv files.
 

fkntotalkaos

macrumors 6502
Nov 24, 2007
306
0
Yes, I use VisualHub to re-encode the entire file, but I thought the idea of your post was to NOT touch the video, and have it playable on :apple:tv...

This is an :apple:tv forum, after all...:rolleyes: No worries, I guess I'm just frustrated that :apple:tv can't handle the high-quality video contained in these great looking mkv files.
I might have have found a work around. According to hackintosh, we can use t he new version of NitoTV to play .avi,.mk4 directyl
 

wmealer

macrumors regular
May 7, 2006
173
0
If it actually works, that's incredible news! I can't imagine nitoTV (mplayer) has a way of speeding up the :apple:tv's processor though. I'd assume it still boils down to that, unfortunately.
 

stomer

macrumors 6502a
Apr 2, 2007
606
1
Leeds, UK
Matroska files give me all sorts of file. This is what I've learned so far

- If the MKV contains AAC 5.1, then don't bother resampling it. For one thing VisualHub can't resample it, and resampling in Quicktime induces a delay so that the audio and video are out of sync. Besides, it seems that ATV can handle the 5.1 just fine.
- The H.264 contained within an MKV file will almost always require re-encoding. I've yet to come across an H.264 that can be played on my ATV without a re-encode. Apparently there's a tool called h264info that can set the video from 5.1 to 4.1, which may allow it to play on ATV, but I've yet to find a Mac binary of h264info. [UPDATE] BTW, forget about h264info, it's Windows only. Unless you fancy running it in a VM. Personally, it's easier for me to just re-encode.

So, if the audio is AAC 5.1, then my workflow is as follows:

1. Run mkvextract and demux the audio and video.
2. Run MP4box and remux the audio and video into an MP4
3. Run VisualHub and apply the setting -acodec copy. This will passthrough the audio without the need to re-encode.
4. You should now have an MP4 that can be played on ATV
 

nicoska

macrumors member
Jun 16, 2007
40
0
Matroska files give me all sorts of file. This is what I've learned so far

- If the MKV contains AAC 5.1, then don't bother resampling it. For one thing VisualHub can't resample it, and resampling in Quicktime induces a delay so that the audio and video are out of sync. Besides, it seems that ATV can handle the 5.1 just fine.
- The H.264 contained within an MKV file will almost always require re-encoding. I've yet to come across an H.264 that can be played on my ATV without a re-encode. Apparently there's a tool called h264info that can set the video from 5.1 to 4.1, which may allow it to play on ATV, but I've yet to find a Mac binary of h264info.

So, if the audio is AAC 5.1, then my workflow is as follows:

1. Run mkvextract and demux the audio and video.
2. Run MP4box and remux the audio and video into an MP4
3. Run VisualHub and apply the setting -acodec copy. This will passthrough the audio without the need to re-encode.
4. You should now have an MP4 that can be played on ATV
Wow!
Thanks for your precius tips.
I'll try this at home.
Bye

nico
 

stomer

macrumors 6502a
Apr 2, 2007
606
1
Leeds, UK
So, if the audio is AAC 5.1, then my workflow is as follows:

1. Run mkvextract and demux the audio and video.
2. Run MP4box and remux the audio and video into an MP4
3. Run VisualHub and apply the setting -acodec copy. This will passthrough the audio without the need to re-encode.
4. You should now have an MP4 that can be played on ATV
Unfortunately MP4Box will sometimes stall when you try to remux on step 2. I'm determined to get this working, so I've found another way to get your mkv's into mp4s.

If you drag and drop the mkv into Visual Hub, it will complain about the audio being in 5.1. It will fail even if you set the audio to passthough (using -acodec copy). Instead we pass the -an flag which tells Visual Hub to completely ignore the audio.

1. Open visual hub, enter the -an flag in the extra ffmpeg field in the advanced options, and start encoding.
2. Once the encoding is finished we need to add the audio from the mkv. So in Terminal.app run
Code:
mkvextract tracks mymovie.mkv 2:audio.aac
3. Run:
Code:
MP4Box -add audio.aac mymovie.mp4
Now you should hopefully have an Apple TV compatible MP4.
 

Scandals

macrumors member
Nov 30, 2004
38
0
Canada
this works? i have some downloaded .mkv files that are H.264 with 5.1 AAC and the video plays in QuickTime (perian), but there is no audio. I tried to convert the 5.1 AAC to stereo, but I can't for the life of me figure out if it is possible or even if that is the problem??? :confused:

I am on Leopard and have heard that there is a bug in quicktime 7.3. Is this true?

Can you guys play 5.1 AAC mp4s in iTunes and AppleTV?? I hate transcoding everything. :mad:
 

stomer

macrumors 6502a
Apr 2, 2007
606
1
Leeds, UK
this works? i have some downloaded .mkv files that are H.264 with 5.1 AAC and the video plays in QuickTime (perian), but there is no audio. I tried to convert the 5.1 AAC to stereo, but I can't for the life of me figure out if it is possible or even if that is the problem??? :confused:
Well, that particular file won't work AppleTV. If all you want to do is to watch the movie on your Mac, then just use VLC.

Can you guys play 5.1 AAC mp4s in iTunes and AppleTV?? I hate transcoding everything. :mad:
Seems to work for me.
 

zero_bit

macrumors newbie
May 3, 2005
18
0
Well, that particular file won't work AppleTV. If all you want to do is to watch the movie on your Mac, then just use VLC.

Seems to work for me.
Stomer - thanks immensely for your help! Since you figured it out for mkv, I've got to ask-- what is your process for wmv files that have 5.1 DTS? Quicktime won't open them (it crashes) and VH gives the typical "boo hoo, 5 channel sound" error.

edit: ok, the very second I posted this, Quicktime finally opened the file (it must've been 30 minutes loading). I wonder if that means anything =P
 

Scandals

macrumors member
Nov 30, 2004
38
0
Canada
All i want to do is be able to convert 720p .mkv files (x264+5.1AAC) into a format that will play nice with :apple:TV. I can't for the life of me figure out how to deal with the audio. All of the conversion tools, including QuickTime, seem to reject it. VLC is the only thing that works and that doesn't help my :apple:TV at all.
 

stomer

macrumors 6502a
Apr 2, 2007
606
1
Leeds, UK
Stomer - thanks immensely for your help! Since you figured it out for mkv, I've got to ask-- what is your process for wmv files that have 5.1 DTS? Quicktime won't open them (it crashes) and VH gives the typical "boo hoo, 5 channel sound" error.
Sorry, I can't be of much help. The files that I download are always either AVI or MKV. However, if you get Visual Hub to get you the TV compatible video in MP4 (using the -an), then you may be able to convert the audio using besweet or something similar. Then afterwards remux using MP4Box or Quicktime Pro.
 

stomer

macrumors 6502a
Apr 2, 2007
606
1
Leeds, UK
All i want to do is be able to convert 720p .mkv files (x264+5.1AAC) into a format that will play nice with :apple:TV.
Are you saying that your 5.1 audio doesn't play on the TV?
I've not tried this but I it could work. If you follow my instructions mentioned earlier, then you'll have an MP4 containing TV compatible video and 5.1 audio. Using Quicktime Pro, open your MP4, choose export from the file menu, in the options, select passthrough for the video, and then downsample the audio. That might work.
 

nicoska

macrumors member
Jun 16, 2007
40
0
Matroska files give me all sorts of file. This is what I've learned so far

- If the MKV contains AAC 5.1, then don't bother resampling it. For one thing VisualHub can't resample it, and resampling in Quicktime induces a delay so that the audio and video are out of sync. Besides, it seems that ATV can handle the 5.1 just fine.
- The H.264 contained within an MKV file will almost always require re-encoding. I've yet to come across an H.264 that can be played on my ATV without a re-encode. Apparently there's a tool called h264info that can set the video from 5.1 to 4.1, which may allow it to play on ATV, but I've yet to find a Mac binary of h264info. [UPDATE] BTW, forget about h264info, it's Windows only. Unless you fancy running it in a VM. Personally, it's easier for me to just re-encode.

So, if the audio is AAC 5.1, then my workflow is as follows:

1. Run mkvextract and demux the audio and video.
2. Run MP4box and remux the audio and video into an MP4
3. Run VisualHub and apply the setting -acodec copy. This will passthrough the audio without the need to re-encode.
4. You should now have an MP4 that can be played on ATV
Please, could you post the exact terminal command ?
Thaks a lot

Nico
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.