Video codec vs video container – what's the difference?

Nikon Z8
The Nikon Z8 can shoot H.265 video, but that's a codec not a file format. The file format is a 'container' for video, audio and metadata. (Image credit: Future)

Codecs and containers are two of the most confusing bits of jargon that modern videomakers have to try and they their heads around. So what do they mean, and what do they do - and which do you choose?

So let’s start with ‘codecs’. This is a contraction of video ‘coder’ and ‘encoder’. It’s the process of compressing and then decompressing video as it’s captured, edited and displayed. There are some key codecs in use right now, including H.264 (universally used, easy to view/edit), H.265 (more efficient compression but more processing overhead to view and edit) and Apple ProRes (higher, quality, higher end gear).

Now what’s confusing is that videographers will often debate the pros and cons of ‘shooting in H.264’ or ‘H.265’ as if these are file formats you can choose on the camera. They’re not. In fact, the file formats you choose on the camera are ‘containers’ because video is not the only thing you’re capturing. Your camera will also need to store audio and image metadata alongside the video, for example, and the file is the ‘container’ that all of these things are stored in.

Here’s an example. The Canon EOS R8 shoots video in the MP4 format. MP4 is a ‘container’ for the video and the audio data, which are two separate things. The EOS R8’s MP4 files may use the H.264 codec for video or H.265, depending on the video settings you choose. The file format (container) is the same but the video codec may be different. The audio codec meanwhile, could be Linear PCM or AAC.

It’s common for videographers to debate the pros and cons of different codecs, as if these are video formats. They’re not – but some cameras may list codecs in the video settings and confuse the issue, making you think they are different recording formats. In fact, the format is the same, but the codec may change.

It gets worse with Apple ProRes, which is a codec but is often talked about as if it’s a file format (container). Indeed, some cameras may present Apple ProRes as a recording option because it’s a big selling point for the best hybrid cameras. In fact, Apple ProRes is not a format in itself, but typically found in the .MOV (QuickTime) container. 

What’s happening here is the codec is being given more importance than the file format/container, and this is a shift we're probably going to have to get used to. It's a confusing time because camera menus may quote codecs, containers or both.

Basically, codecs are not containers, but they are perhaps more important choices for camera settings than whatever file format/container they are wrapped in. Just remember that codecs just handle the video content that goes into the containers (files) that we save, edit and share. 

When we say that camera xyz supports H.264, H.265, Apple ProRes, we’re not talking about file formats you can select directly, but that the camera has file formats (containers) for these codecs.

It might sound like a tedious distinction, but it's an important one.

Check out definitions of other video jargon in our comprehensive A-Z dictionary of photography terms

Rod Lawton
Contributor

Rod is an independent photography journalist and editor, and a long-standing Digital Camera World contributor, having previously worked as DCW's Group Reviews editor. Before that he has been technique editor on N-Photo, Head of Testing for the photography division and Camera Channel editor on TechRadar, as well as contributing to many other publications. He has been writing about photography technique, photo editing and digital cameras since they first appeared, and before that began his career writing about film photography. He has used and reviewed practically every interchangeable lens camera launched in the past 20 years, from entry-level DSLRs to medium format cameras, together with lenses, tripods, gimbals, light meters, camera bags and more. Rod has his own camera gear blog at fotovolo.com but also writes about photo-editing applications and techniques at lifeafterphotoshop.com

You must confirm your public display name before commenting

Please logout and then login again, you will then be prompted to enter your display name.