MKV vs MP4 containers

Discussion in 'Apple TV and Home Theater' started by 3282868, May 8, 2011.

  1. 3282868, May 8, 2011
    Last edited by a moderator: May 11, 2011

    3282868 macrumors 603

    Jan 8, 2009
    I've read that some prefer MKV containers for all their DVD encodes. I've been using MP4 (working on SD DVD's, I'll use MKV for my BD's). I know that the Apple TV 2 doesn't play MKV files, I have my Apple TV 2 JBen and using XBMC so compatibility there isn't an issue. The only issue is with iDevices and non-JB'en items. I plan on ditching my DVD's once encoded so getting the encodes near lossless (don't care about size) is more important, but I'm curious why MKV may be better than MP4.
  2. And1ss macrumors 6502a


    Oct 20, 2009
    I don't really think you can compare mkvs with mp4 since one is a container format and the other is a video format. With mkvs, it allows you to add audio, video, subtitle(s) separately without having to embed it all on the video. This means that you can turn the subtitles on and off (softsubs vs hardsubs) like a dvd, extract just the .ass or .srt file, or video or audio. Inside mkvs, I've seen a lot of the video track in .mp4.

    I guess it is more convenient and emulates a dvd.
  3. 3282868 thread starter macrumors 603

    Jan 8, 2009
    Thanks for the help. I forgot about MKV = container and MP4 is a video file, I knew that but jumped the gun. My goal is to future proof my DVD's as much as reasonably possible. In HB I I have been using:

    MP4 H.264, Large file size, Constant quality = 18, VFR, FPS = Same as source, Anamorphic = Loose w/ Modulus =16

    1. AAC Stereo for iDevices (iDevices default to the first audio track, I can switch the tracks in XBMC)
    2. AC3 Passthru
    (Other layers for director's commentary, etc.)

    English Bitmap (not Burned In)

    A lot of advanced tweaks and if I have the srt for chapters I'd import it in HB then use MetaX for tagging.

    Should I use MKV containers as they seem to be as close to DVD as possible? Given that MKV isn't supported natively in iDevices I can play them in XBMC on my aTV 2 but I would not be able to on my iPad unless it's JB'en. If I use MKV container can I extract the data and produce an MP4? I want to future proof as much as possible (I'm still learning, I've gotten the gist of MP4 video files and advanced encoding but as I have yet to work on my BD rips I put off MKV learning as I was informed MKV is primarily recommended for BD rips).

    Thanks again for any help. :)
  4. spacepower7 macrumors 68000

    May 6, 2004
    I convert all of my mkv files to mp4 (m4v specifically). The main reason is compatibility with ios devices. I have no problem with mkv since the video in it is usually compatible with iOS, I just change the container.

    I think the MKV crowd mainly uses HTPCs for playback but most mp4 people use PS3, XBox360, AppleTV, Roku, etc.....

    I'm not a fan of avi files though. I know they were and are still popular since movies can be burned onto cheap CDs and played back on cheap DVD players suck as my $29 Philips.

    I'm use handbrake to encode my DVDs into m4v with 5.1 DD and 2 channel aac. This way I can get full iOS compatibilty. Think of it this way, when a family member with an iPad or iPhone want to "borrow" a movie for a trip, I have a compatible file handy, and dont have to convert each file individually.

    When I say "borrow" it works well and semi-legally because I can hook up their iPad (doesn't work with iPhones) to my computer, load up the movie and away they go. But they can't transfer the movie back to their computer (last we tried) so they delete it after one viewing. So I don't feel that it's evil to give them the movie since they only have it temporarily.
  5. spacepower7 macrumors 68000

    May 6, 2004
    mp4 is a container just like mkv, the video inside is mp4 in the mp4 (usually h.264) and every mkv that I see has mp4 (h.264) video inside it.

    Mkv can have a variety of video formats inside, but I always see h.264 which is iOS compatible. Therefore I use subler, MKVtools, or iflicks to put the video and audio of the mkv into a mp4 container. It only takes 10 minute on a core2duo 2ghz Mac mini. there is no loss of quality.
  6. And1ss macrumors 6502a


    Oct 20, 2009
    I agree with spacepower7 on that it really depends on how you want to view the video. I'm with the htpc crowd so mkv is the way to go.

    I would stick with mkvs for your dvd collection. It offers more convenience later on. And yes, you can extract the data and produce an mp4 (the extraction process is called demux, I think).

    I often extract the subtitle track in asian dramas, reedit, and mux back into container. Plus, I can turn off subtitles since it isn't hardsubbed onto the video track, something mp4 can't do.

    I guess with iOS, you can always extract the video track and mp4 it, but still retain the mkv as the master.

    It's the way to go for movies and whatnot imo.
  7. AdrianK, May 8, 2011
    Last edited: May 8, 2011

    AdrianK macrumors 68020

    Feb 19, 2011
    How? For the process BeDifferent uses (which is perfectly suitable), they would gain *nothing* from MKV, other than a compatibility headache.

    MP4 is a container, MKV is a container. Various codecs such as h264 are based on the MPEG4 standard. So when someone says "MP4" it depends on the context.

    That doesn't really mean anything. Seriously, just forget that trail of thought...

    There are 3rd party iOS apps that can play files in an mkv container.


    That's simply untrue. It may be favoured for BD rips as it allows the storage of DTS, DTS-HD/HR, TrueHD, PCM etc which MP4 doesn't. However, you're setup with AAC and AC3 in no way requires MKV.

    MKV does have more options for subtitles, however mp4 can utilise soft subs as well, so no big deal.

    My opinion: Keep doing what you're doing. You're not missing out on anything using MKV, only breaking compatibility. Also with MKV you lose the ability to add metadata.

    m4v was designed for Apple devices, and it works great, no reason to use anything else.
  8. spacepower7 macrumors 68000

    May 6, 2004
    You can have soft subs in mp4, they are not pretty though, and your best bet would probably be MKVtools or Subler.
  9. 3282868, May 8, 2011
    Last edited by a moderator: May 8, 2011

    3282868 thread starter macrumors 603

    Jan 8, 2009
    Forgot to mention that I encode them into m4v's. Just posted this after reading the new comments, so you can extract the MP4 from the MKV container. PERFECT. I'll start using MKV in Handbrake from now on.

    Yeah, not to get long winded, here is my setup:

    1. 2010 Pioneer Elite VSX-33 AVR: supports AC3/DTS/DDII/THX/7.1+, everything you can throw at it (controls all devices via HDMI in and outputs 1 HDMI channel for viewing). Also supports 3D should I decide.

    2. 50" Pioneer Elite (again, high quality is essential)

    3. Here's the important part:

    I have 2 "Time Capsules", the latest gen is my main router, the previous gen connected WiFi to extend my network to my media center. This provides internet radio and full control of my AVR from my computers. Most importantly I have my aTV 2 connected to that "Time Capsule" via ethernet and configured XBMC to access the HDD via SMB, acting as an attached storage device for my media instead of streaming it. Using Finder I drag and drop my final movie into the "Time Capsule" HDD folder and XBMC loads it, allowing me to select the audio tracks I encoded as well as subtitles. It supports about every codec and have had no issues playing any movie so far.

    Exactly what I've been doing (learned the hard way through months of studying). I learned that placing the AAC Stereo track first is key as iOS and OS X Quicktime default to the first audio track, and XBMC can be configured to default to the best track. I've been told to use AC3 Passthru for the second track as this preserves the DVD audio (before I was using AC3 6-channel discrete which I learned made no sense).

    I've achieved great audio and with my advanced settings at full mach I can encode a DVD on my 2010 3.33GHz 6-Core Mac Pro in less than an hour, retaining quality without a huge file. I refuse to use the batch encode workflow as I have little control over the quality and don't mind manually processing each rip, I'd rather do it right the first time.

    I've tried Subler but found MetaX to offer more. Maybe I should give Subler a second chance as most recommend it.

    My system supports DTS and such, so I was planning on a different encoding process for my BD's. Does that throw a wrench into the equations?

    Tagging is definitely something I need, and isn't supported in MKV? Hmmmm. Good point on M4V in Apple devices, my only fear is if that changes and MKV format is supported or other video devices develop that may be better. Then again, I ain't Ms Cleo :p

    Thanks for all your help guys. It's amazing how much more you can always learn :)
  10. And1ss macrumors 6502a


    Oct 20, 2009
    If compatibility and iOS usage is a big factor for OP, I'd say stick to mp4. But then again, how often do you watch on iOS devices? Your answer to that will determine whether or not to use mkv vs. mp4.

    I'm just prefer mkv for all my video needs.
  11. AdrianK macrumors 68020

    Feb 19, 2011
    Why?! You don't gain anything from using MKV.

    Yes, you can remux to m4v, but then you have the same file, in the same quality, except one plays on iOS and the other doesn't.
  12. And1ss macrumors 6502a


    Oct 20, 2009
    But, given the information the OP posted, to me, it doesn't sound like iOS compatibility is the deciding factor.
  13. 3282868, May 8, 2011
    Last edited by a moderator: May 8, 2011

    3282868 thread starter macrumors 603

    Jan 8, 2009
    Yeah, wrote that after your post (tend to be long winded as I want to get as much info as possible for help, so sorry for the long posts and delays).

    It's one of the factors, but the most important one is near perfect/lossless encoding as reasonably possible while maintaing device compatibility. If MKV's are better quality (sorry if I misread that) and I can always extract an MP4 from it should I want stock iOS compatibility, would it make sense to encode in MKV keeping my options open? I mainly watch my m4v's on my aTV 2 through XBMC, as the quality is better than stock iOS aTV 2 MP4's. Rarely do I watch on my iPad, however it would be nice to have that option.

    Screw it, I'll encode both, I have the space j/k :p
  14. AdrianK macrumors 68020

    Feb 19, 2011
    oh ok.

    But why encode both? The interal streams are the same. If you encoded one (either mp4 or mkv) you could then remux to the other. This would take minutes, instead of hours.
  15. 3282868, May 8, 2011
    Last edited by a moderator: May 8, 2011

    3282868 thread starter macrumors 603

    Jan 8, 2009
    Perfect point, and thank you to everyone for teaching me and having patience. It's more than appreciated.

    Just remember, someone mentioned you can't metatag MKV's? Also, is Handbrake the better app for MKV encodes? And last question, I swear. I've been using anamorphic loose as I understand that it allows for adaptive viewing on various displays (although mine are widescreen).

    Update: I found info on meta-tagging MKV's by writing tag's in XML using Matroska's docs, then mergi it with the mkv file using MKVToolnix (4.6.0 current OS X version). Using MKVmerge GUI's "Attachments Tab" should allow adding the XML file. Gonna give it a go.
  16. slothrob macrumors 6502

    Jun 12, 2007
    They are not better quality. The .mp4 in the .MKV is the same quality as the .mp4 in the .m4v.
  17. kuwisdelu macrumors 65816

    Jan 13, 2008
    The advantage of mkv's are that they allow for a wider variety of media to be put inside the container. For example, you can have styled .ass subtitles, while mp4's only support the simpler .srt subtitles.

    The advantage of mp4's is that they are compatible with more devices, in particular, any Apple device.

    If all you have is a H.264 video and AAC audio, it's probably better off in an mp4 container, since it allows for greater compatibility. If you have something more complicated, for example, subtitle formats, then you'd have to use mkv.
  18. 3282868 thread starter macrumors 603

    Jan 8, 2009
    What's the difference then aside from adding different subtitles, etc?

    My system can play everything audio and video wise, my main objective is to create a digital lossless video library of my DVD collection. I have been using m4v H.264 w/ Constant Quality 18, VFR. My Pioneer Elite AVR supports AC3/DTS/THX/7.1+ and I throwing out sound through my B&W speaks. I'm encoding my audio:

    1. AAC Stereo for iDevices
    2. AC3 Passthru for 5.1 or DTS if applicable
    - More for director's commentary, etc.

    There are so many opposing opinions on CRF/ABR/MKV/MP4/Advanced Settings/Audio layers - I've been reading and studying for the past few months and just when I think I have it someone says something else. :eek:

    I know mkv's are a container with the same/sim m4v, however if mkv's are better suited to my needs I'd rather know now before encoding 200+ movies one by one. I can always extract the mp4 from the mkv if I need to, but I will use XBMC on my JB'en aTV 2 to watch most of my rips. Guess I need to decide on my own and stick with it.

    Thanks guys, this is my last post on MacRumors. Been a fun ride, wishing you all the best! :)
  19. kuwisdelu macrumors 65816

    Jan 13, 2008
    They're just different containers. The H.264 video is the same whether you put it in an mkv or mp4. The advantage of mkv is it allows more kinds of codecs and media than mp4, but is less compatible than mp4.

    Since mp4 can take those codecs just fine, I'd just use mp4 since it'll be compatible with more devices should you ever wish to play them on something other than your current system.

    As you said, it's very quick and easy to mux them into an mkv if you ever need to add things that you can only put into an mkv rather than an mp4.
  20. slothrob macrumors 6502

    Jun 12, 2007
    There are differences in how the containers work, but there is nothing inherent in either of them that leads to better quality. If you put an identically formatted mp4 into either m4v or MKV, you will have identical quality.

    If what you want is a "lossless" copy of your DVDs (DVDs themselves not being lossless, since they are compressed as mpeg2), then you should be saving .iso or VIDEO_TS folders. ALternately, the mpeg2 in those can be put into an MKV to have identical quality to the original DVD. That quality has nothing to do with the fact that it is an MKV, but simply what codec and how much compression you've chosen to put into the container.
  21. newagemac macrumors 68020

    Mar 31, 2010
    Look, mkv, mp4, and m4v are just containers. The quality is solely based on the h.264 video inside of the container. The h.264 video can be put inside any one of those containers (or extracted out from any of them and put in another) and the quality will be exactly the same.

    The difference between the containers is mostly about which formats can be placed inside of it and work when you play it with hardware that supports that particular container. The mkv container works with more types of formats but if all you plan to use is h.264 it would be best to stick with m4v because it is better supported.

    The only big exception is that if you are encoding h.264 HD material, the mkv format offers more options for audio and subtitles than .m4v.

    But of course, m4v is more widely supported than mkv and partly since it is designed to focus on one specific format, it is less buggy than mkv on hardware that supports mkv. Apple has pretty much perfected playing h.264 video within the .m4v container on their hardware. And I think it has a lot to do with them, as usual, focusing their efforts rather than trying to support a ton of entirely different formats, containers, and codecs.
  22. dynaflash macrumors 68020

    Mar 27, 2003
    Since the OP is targeting a jailbroken atv 2 running xbmc there is one thing to be aware of when using .m4v and and embedded srt subtitles like Handbrake or subler can do for a stock atv or ios device (or iTunes for that matter). XBMC will not display the 3GPP soft sub. It recognizes it when you hit the audio subtitle panel while the movie is playing but will not show them on screen. It is worth being aware of if using xbmc and a trac ticket is filed with them but even in current git head its not fixed yet.
  23. 3282868, May 11, 2011
    Last edited by a moderator: May 11, 2011

    3282868 thread starter macrumors 603

    Jan 8, 2009
    Ok, was gonna take a break from MacRumors but you guys posted some good recommendations/comments. :)

    Knew DVD's were compressed, suppose I meant as lossless as possible from the VIDEO_TS folder I ripped on my Mac Pro (used either RipIt! or MTR 4 depending). I have a 2 TB HDD with my DVD rips, let's me HB encode in differing settings to compare on my setup. MKV containers seemed perfect as I can simply extract the m4v/mp4 for compatibility sake (least I was told). Only issue is metatagging which I'd like. XBMC can play mkv files, and JB iDevices so no issue there I hope.

    I'm using H.264 (x264) codec (course Apple doesn't support mkv unless the iOS is JB'en). Is this the best option for quality? Using constant quality 18 w/ FPS "Same as Source," VFR, Anamorphic set to "Loose" and Modulus 16, Detelecine/Decomb at "Default" (in case this matters).

    Selecting the "Subtitles" on option in XBMC does play them (selecting "English - (Bitmap) w/o Burned In checked of course). Don't know what 3GPP is though, but will stock iDevices play those subtitles?

    Been using MetaX. Tried Subler as I liked the ability to name the audio tracks but tagging wasn't great (doesn't auto d/l subtitles like MetaX). One issue is encoding all available tracks in HB w/ these settings:

    1) English (AC3) (5.1) AAC (Core Audio) (either Stereo of DD) Auto ~192 kbps
    2) English (AC3) (5.1) AC3 … for full 5.1 Surround Sound
    3+ for any additional tracks such as Director's Commentary, etc

    I noticed audio tracks sometimes get mixed in the m4v. I placed the Stereo in Audio Track one as iOS Stereo devices default to that first track, and I can change and set the default in XBMC to Track 2 for AC3 5.1.

    With my setup would I benefit anything encoding in the mkv container? I know BD benefit/need to (I believe).

    Thanks guys!
  24. dynaflash macrumors 68020

    Mar 27, 2003
    Yes, stock iDevices will as well as qtx and itunes. Basically what I meant was when using hb to encode say ... a source mkv and importing an srt to be included in the output .m4v ... hb (and subler) will embed the source srt into the .m4v as a 3gpp text track which said devices will show via their audio/chapters/subs function. XBMC won't ( at least not at this time).

    .. and yes right now h.264 is the best video codec you are likely to use, whether in an mkv or an mp4(m4v) container. Its worth noting that containers sometimes do or don't support things like variable framerate (the avi container was famous for this, fantastically broken from conception imo), etc. So ultimately its not true that any video/audio codec combination in *any* container will be the same. That said by and large mkv vs. mp4 will be much the same given the Video/Audio codecs contained within are the same.
  25. akatsuki macrumors regular

    Sep 3, 2010
    MKV is really a hackers codec in the end. Few devices support it out of the box. Forget about streaming to Xbox or using iPads or a lot of other stuff.

    Frankly I hate it. Half the time remuxing using subler fails (usually the audio).

Share This Page