Understanding containers and codecs

I'm just confused because the information above seems to indicate containers are simply chosen based on what codecs you want in your video, and that they are independent of the actual output which is determined by the codecs. But then why is it when i output a h.264 in an .mp4 container the quality is much worse and shading different than h.264 in an .avi or .mkv? And if there is a reason is there a table or compilation somewhere showing this kind of information for each container so I know short of trying them all?

I ask because I'm trying to find an acceptable container to hold a .wav32 (or mbe .wav 16bit signed) and 4k h.265 video that will be supported by youtube specifically in this case, .avi isn't working. .mkv isnt listed as beings supported but does upload. it seems to be the same as a working .avi, but I don't pretend to understand what's really going on....it re-encodes anyways so its irrelevant so long as it seems to be the same as a supported format..?
People say to convert .mkv to mp4 but I don't see any reason why....mkv supports going to mp4 without a re-encode but whyyy would you limit your audio options and do so....? Especially when mp4 seems to degrade quality as talked about above, although I don't know if going mkv to mp4 produces similar quality changes as straight out rendering into such a container. Other non supported containers like .ts produces favourable visual results as well.
So this is relating to the posed question of does ur video container just hold the codecs and not affect anything really whether it be "supported" by a streaming site or not? It's all irrelevant and its the codecs that determine everything?

1 Answer 1


The choice of container has no bearing on stream quality, which is determined solely by encoder parameters.

What may happen is that the stream could have non-standard or at least unexpected colorimetry properties and some containers can't store that metadata or may have stored them incorrectly. Also possible is that the metadata is correct but the player doesn't parse them correctly or at all depending on the container. This can lead to a difference in rendering, which you perceive as a change in quality.

  • Is there anything I should look for to become aware of when this may happen? Or is it just a trial and error approach where I try different containers with different players and see how it shows itself on playback? With the .mp4 format I notice the difference across multiple players and streaming sites for example. I'm just stuck cause I can't find information online to help me move forward, perhaps I'm using the wrong keywords. avi is well supported but has failed due to that 2gb limitation on many players. Mkv hasn't been working on streaming, i need a format that can fit a .wav and stream
    – kite
    Commented Dec 4, 2018 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.