[Q of the Week] – codecs

let’s talk about codecs.

if you shoot video, edit video or even just watch video you might have heard the names of some codecs, things like ProRes, AVCHD, XDCAM, or H.264 and it seems like these days the list of codecs goes on, and on, and on. codecs are something a lot of people get pretty confused about so I’m going to attempt to clear the air on this topic and help you wade through all this codec mumbo jumbo.

so let’s get down to brass tacks. the first question you’re probably asking is, what is a codec? to which I’d answer: the word codec is a portmanteau of the words compressor-decompressor, or coder-decoder. then I’d cross my arms and be done with it, but because that doesn’t help anyone, let’s go even further. what this really means is that a codec is essentially an algorithm that compresses something for storage and then decompresses it when you view it. codecs are used for both audio and video and are essential for keeping files from eating up all of our precious memory card and hard drive space.

but wait, a codec is a compression scheme and compression is evil right? well not exactly, everything you’ve seen or shot and probably everything you will ever see or shoot will have some form of compression applied to it, this is not always a bad thing. what can keep compression from being evil is it’s efficiency, if a codec is really good and you can’t tell the difference between the compressed footage and original footage does it matter if it’s compressed? (it can but more on that later) think about the moment you stopped caring about the difference in sound between a good mp3 or iTunes download and a cd or record. eventually, the codecs used for digital audio downloads reached a point where for most people they sounded so close to the original that your ears could no longer tell the difference in quality and all of this was able to happen while maintaining a relatively low file size thanks to compression.

for video and filmmaking it hasn’t been as easy to find and create the ideal codec for two main reason:
because your eyes are usually tougher to fool than your ears.
because we don’t just watch our videos after we shoot them, we edit and manipulate them and this causes completely different strains on how a codec is treated.
to better understand these two reasons let’s take a minute and look at how the compression of a video codec is achieved.

a good video codec is a delicate balancing act of video quality, the amount of data transmitted to allow for that quality (which we’ll call bit rate from here on out) and the chroma subsampling ratio used relative to the compression. I know I probably shouldn’t throw around terms like chroma subsampling without giving an explanation so let me try to simply break it down. a video signal is divided into luminance (brightness) and chrominance (colour) and in a perfect world is displayed as 4:4:4 (4 (luma): 4(chroma): 4 (chroma)). the human eye is more sensitive to brightness than it is colour so chroma is usually the area that is cut down the most when compressing video. unless you’re working with something near raw and don’t mind massive files you’ll commonly see 4:2:2 for higher end digital formats (where colour information in both channels are essentially halved) and 4:2:0 for medium to lower end high definition formats (where colour is halved in one channel and almost absent in the other) and 4:1:1 for standard definition formats (where colour is quartered in both channels).

most people shouldn’t visually be able to tell the difference between 4:4:4, 4:2:2, and 4:2:0 when a good codec is used to compress it. but remember earlier when I said it can still matter even if you can’t visually tell the difference? here’s when: it matters if you’re going to either make big changes to your image with extreme colour grading or if you intend to do a lot of post graphics or effects. doing those things can push the limits of lower quality formats leading to the breakdown of the codec where you can start to see ugly macro blocking, softness, or other compression artifacts that are usually hidden.

this means that we generally always want to try and use the best codec possible to shoot and edit our footage because we now know the layout of a codec is essentially: efficiency + bit rate + chroma subsampling = final video quality. that means that unless we are dealing with an insanely efficient codec, it’s usually the higher the bit rate and the higher the chroma subsampling, the better our final image quality should be.

so let’s take a look at some popular codecs and how they stack up.

Codec Colour Space Bit Rate (Megabits/sec)
ProRes 444 4:4:4 330Mbs
ProRes 422 (HQ) 4:2:2 220Mbs
ProRes LT 4:2:2 102Mbs
Avid DNxHD 4:2:2 220Mbs
Canon XF 4:2:2 50Mbs
XDCAM EX 4:2:0 35Mbs
Canon DSLR (gen 1) H.264 4:2:0 44Mbs
Canon DSLR (gen 2) ALL-I 4:2:0 91Mbs
Canon DSLR (gen 2) IPB 4:2:0 31Mbs
Nikon D800 H.264/AVC 4:2:0 24Mbs
AVCHD 4:2:0 24 or 28Mbs (depending on frame rate)

now while the numbers aren’t exactly fair (because some formats like AVCHD are more efficient than their bit rate makes it seem) it should be fairly easy to tell which codecs are less compressed and therefore better. that means in practical use if you’ve got a 5D Mark III for example shooting in the ALL-I format instead of IPB should give you a less compressed image, giving you more room in post. or when transcoding your 7D footage for that effects heavy music video you’re doing you should consider ProRes HQ over LT, to slow the generational break down of your video as you work with it. we typically choose to transcode our DSLR footage based on what we’re doing with it and where it’s going, not every piece necessarily requires huge hard drive eating ProRes files.

now I could have gone super techno-geek on this and dove much deeper into the confusing waters of codecs (I didn’t talk about bit depth at all, or cover what really makes one format more efficient than another for example) but I think this is a good place to leave it for now, more than anything this was intended to give you a brief overview of what a codec is and why the codec in your camera is worth thinking about. for certain jobs it may be worth bypassing the internal codec in your camera with an external recorder, or maybe using a different camera all together. if you take the time and empower yourself with the strengths and weaknesses of the tools you have at your disposal you’ll be better equipped on set and in post to make decisions that will hopefully lead to a better end product.

whew.

Evan

13 Comments

    J. Lis

    I am in the process of upgrading my event videography company (mostly
    weddings for now) from SD to HD. (I took some time off to raise a
    child). Now I am returning and need to catch up tech wise. I have bought
    the Sony XDCAM PMW-200. I am now trying to figure out which camera
    would be best for my company. I would need to edit footage from both
    cameras on the same timeline and create videos for my clients. I really
    want to buy the Canon 5d Mark3. My concern is that it will be too hard
    to edit them together. I have FCP7.

    Can anybody tell me a workflow that will work and I can depend upon with
    all the footage that is inherent in event videography? I am a good
    shooter, but no tech wizard, but willing to learn for a great result. Is
    learning the tech to edit these two cameras together worth it? Or
    should I just buy another XDCAM? Eventually I want to do more than just
    event videograhy, so I am really pulling for the Canon 5D m3. Any
    advise? Or perhaps a workflow explanation for “dummies?” I need to start
    some where… Thanks so much for your time…I urgently need help
    because I need to decide which camera this week…
    I do not mind the two looking different. I can learn to work with that
    with the fact that each “scene” will be very different looks. However, I
    am concerned with learning how to shoot in a way that makes the two
    cameras footage mixable on a timeline, and then also being able to bring
    each one into FCP7 with correct settings to make them exist happily
    together. (frame rate, audio, etc, etc). I have researched and
    researched to find a tutorial that includes both, (shooting with the
    correct camera settings with the intention of bringing both cams footage
    into FCP7 in a way that cuts together, and ALSO includes
    settings/methods of how exactly to bring them in. At this point, I feel
    like I need someone to litterally come into my office and teach me how
    because I have not found a video tutorial that includes both…Perhaps
    because shooters seem to answer some blogs, and editors seem to answer
    editing questions on the net. I need to find a way to marry these two so
    that I can make it all as easy as possible (shooting and workflow). I
    understand that I have quite a bit to learn…but I am willing to put in
    the time. I have no unrealistic goal of being able to match experts
    talents at this point.

    Once I understand if there is a way of doing all of this and how
    difficult the process is, I can make an informed decision about which
    camera to buy. I am pulling for the 5D M3 because I think it would be
    best for transitioning into commercial. However my bread and butter will
    be event videography for now. If there is any way to explain this
    process with both objectives in mind, it would be amazing and totally
    help me out. or if anyone knows of a tutorial, please point me in that
    direction. Or even a class/worshop in NYC or Massachusetts?


    Evan, thank you so much for this post & the awesome workshop in Portland a few weeks ago. I’m shooting on the 550D, editing in Premiere CS5, and then exporting to h.264 mp4 format, but my videos won’t playback on many Android devices. Any suggestions for a different export setting? This video is an example of my problem http://vimeo.com/51119827 Much thanks -George

    Eric Coughlin

    Aside from Final Cut, which has been discussed, if you’re editing in Premiere CS5 or 6, which I believe handles native files better than Final Cut, is there any advantage to transcoding to an intermediary codec?

    Reading in various places I’ve found what seems like mixed opinions on the possible advantages of using an intermediary codec with Premiere. One thing I read was that CS5 automatically up-converts each frame to 4:4:4 when needed, so using an intermediary codec does not give an advantage in regard to color correction. Is this true?

    Also, if that is true, then would Premiere also up-convert it when using plugins such as Magic Bullet or NewBlueFX again making an intermediary codec of no advantage (at least in regards to color grading)?

    bogart

    Hello Evan.

    This is an awesome reference, thank you for postingTo follow up on the question from Jono, If you’re using FCPX, there’s no need for you to compress the file from your camera because it automatically does it for you or you will work from the native format. Is this correct? So in case of Canon Mark II, it has H.264, so there’s no need for you to upconvert it ProRes?

    I’m a newbie and please pardon my ignorance :)

      evan

      hey Bogart, thanks for the kind words! you’re right about the way FCPX works, basically you’ve got 2 options in FCPX: 
      1. work from the native DSLR files 
      2. transcode to some flavour of ProRes, you can either wait for the transcode to finish if you want or edit while it transcodes in the background.
      so as far as editing goes there no technical “need” to convert it to ProRes. that said, most people still find they have smoother performance on their machine when editing in ProRes because the computer won’t have us much to decode on the fly and like I said in the main blog post you kind of slow the decay of your file as you do stuff if you work in a higher quality format.

    Rafa

    For weddings on 5DmkIII, what codec would you use  IPB or ALL-I?  What compression would you use? Pro Res 422 LT?

      evan

      hey Rafa, it depends on how post heavy your weddings are. we like to get as close as possible in camera when we do weddings so tons of heavy correction is not needed, because of that we’re able to shoot IPB and get longer record times on our cards. when it comes to editing them we typically use ProRes LT for high end pieces like our highlight films and XDCAM EX for everything else.

    Connor Trotter

    Should you compress the footage from the camera before or after editing?

      evan

      Connor, I’d say that depends on your NLE. if you feel it can smoothly handle the native footage then feel free to compress only on export, but if your NLE doesn’t work that well with native footage, or you’re doing something higher end where you’re trying to slow that generation loss then compress before your edit.

    Mike Copeland

    Can you elaborate on your DSLR workflow when the end result is for TV Broadcast?  Ex. What did you do to 5D or 1D footage for A Game of Honor to play it on Showtime?  I am just starting to get into TV spots and not just web video, so any insight would be greatly appreciated.  

      evan

      hey Mike it’s actually pretty simple. it all depends on who is handling post, you or the broadcaster/broadcaster’s production company. on A Game Of Honor we’d sometimes get first crack at editing our own selects so we could then hand over just what we felt were our best shots to save them time looking through everything, in that case we’d edit as normal and just export the selects in whatever format they needed. if it was a situation where we weren’t doing that we’d hand over ProRes files for times they were using Premiere and DNxHD for times they were editing on Avid.


    Thanks Evan! That’s a great breakdown of codecs. One question, when shooting say on a 5Diii in IPB and then importing into an editor like FCPX… if you choose ProResHQ how does that manipulate the data? Is it uncompressing it and then doing something magical to convert it? Surely it can’t be adding information? I’ve heard it’s better to grade with etc but how does that work given the highly compressed codec that you start with? 

    Thanks
    Jono

      evan

      hey Jono, thanks for the question. to put it simply you’re right, you can’t add information that wasn’t there in the first place, that means transcoding to higher quality format after the fact isn’t improving the look of your footage. what is happening though is it’s slowing it’s breakdown. using a more robust codec will allow it to take more abuse as you do everything you may need to do to it in an edit, so hopefully you don’t see the nasty effects of heavy compression as quick. but I think there’s a limit to what makes sense to transcode to, for example: transcoding to ProRes 444 wouldn’t be better than HQ because you’re not really gaining anything at that point and the files would be so big you’d just be throwing your disk space away for no reason. so you’ve got to consider your source format when picking the format you’re using for your transcodes. hopefully this properly answered your question!

Leave a Comment