Vimeo Videos Too Dark

When exporting a compressed video from Final Cut X and uploading to Vimeo the result for me looks quite bad. The exact same happens using Compressor.

What I see is that the highlights become lowered, making it darker, and the blacks become raised, uncrushing them, making them brighter and noisier. There is also a slight red shift. Not a good look.

I have seen some people calling this the ‘gamma problem’. So at first I tried to use a gamma filter in compressor to adjust it. However, I found that this also produces an unsatisfactory result, no matter what settings I tried. It did get brighter but also became slightly washed out looking. Not a good look either.

This has been annoying me for ages but I finally had enough and was determined to investigate in more detail. I hoped that if I understood what was being mistranslated, I might be able to find a better solution. Something was definitely getting mistranslated.

It turns out that unlike still images on the internet, which are properly colour managed all the way through the various stages in the pipeline, the situation with video on the internet is still a real mess.

Each target encoder and then player may interpret things quite differently and make mistakes, even if your source material is correct. Vimeo re-encodes videos when you upload, then their player plays that encoding not yours.

So I began comparing footage in different players and using a colour meter to assess in what way they really were different.

Initially I was trying new settings and then uploading to vimeo but this was a painfully slow method of testing new methods. I had to find a quicker way of doing it.

I was not really making much progress and about to give up, when by a beautiful coincidence, I discovered that VLC on a mac also made exactly the same translation errors that Vimeo did. This was incredible news because now I could speed up my search massively. I could try new settings to see if they worked in seconds without waiting for an upload.

I spent some time looking at video encodings and my hypothesis became that this was not a ‘gamma problem’ at all, but rather caused by different colour spaces using differing value ranges for brightness. Some use a range of 0-255 for black to white and some a range of 16-235.

I became suspicious that at some stage in the pipeline the wrong range was being used for a translation, resulting in the damaged highlights and lowlights.

This gave me hope that I might be able to somehow fool the pipeline into giving a correct result by actually feeding it the wrong input! I just had to discover what created the exact reverse of the problem. I could then mangle the input so that a later translation error would correct it back again to something more like the original.

When problems are strange and non standard like this one, tools like Compressor often don’t give enough options to play with, so I used a less friendly but much more powerful command line tool called ffmpeg which has a lot more options.

I tweaked colour translation parameters over and over again by trial and error until I found a combination that produced a closer result to my original master video when played in VLC.

When I stumbled on the ‘correct’ settings, I got a result with much more accurate brightness range. The original problem was that my videos became darker, noisier and redder. Now I had something which seemed to give a correct brightness range but also had a slight green shift.

However for me this was still a big improvement as the thing that annoyed me most was the destruction of the video’s dynamic range.

So what was the trick in the end? It was to add a video filter in the compression pipeline before the compression stage so that it remaps the colours between standards bt601 and smpte240m. This is very strange as HD should be bt709.

So here is how I encoded a video using ffmpeg for more accurate brightness on vimeo. It does produce a slight green shift but it also seems less obvious than the darker/red shift I was getting before. There may be better settings that are even more accurate but these are the best that I have found so far. Let me know on twitter if this works for you.

Try more options. You may get lucky. Let me know if you do. The reverse trick may work if your videos have the inverse problem of being too bright and washed out. I have seen people complain about that with different pipelines.

The critical parameter to play with is -vf colormatrix=bt601:smpte240m which means filter video to remap the colour matrix.

ffmpeg -i -vf colormatrix=bt601:smpte240m -c:v libx264 -preset slow -crf 18 -maxrate 10000k -bufsize 1500k -c:a libfdk_aac -b:a 320k Compressed.mkv