NOTE: This article is now out of date. A true solution has now been discovered, and you don’t have to compromise anymore.
See this article:
How to Fix the H.264 Gamma Brightness Bug in Quicktime Once and for All
— — —
In the previous article, I mentioned that I encountered a serious problem when exporting the “Wheels, Jets, & Rails” travel video for internet distribution. If you export your video with Quicktime, you may have run into this brightness bug without realizing it. Simply put, exporting video as H.264 in Quicktime artificially brightens (or lightens, depending on who you ask) your video which makes it look very washed out and unprofessional. Though some scenes aren’t affected by this bug as much as others, it reduces the overall quality of your video. For instance, the washed out effect isn’t as visible in a snowy scene, but it’s very pronounced on a summer scene. During this article, I will assume that you already have Quicktime Pro since exporting video is a Quicktime Pro feature.
(Post-Publishing Note: New techniques to do this have been added to the bottom of this article.)
That Darn Gamma
No matter what I did, the resulting H.264 video was too bright, which is what happens when the gamma correction is set too high. (If you’re curious how gamma works, Wikipedia has an excellent description of Gamma Correction.) I wondered if using the MP4 filetype was causing the problem, but it wasn’t. Whether exported in an .mp4 or a .mov file, the resulting file was artificially brightened. To demonstrate this, I’ve used source video for an upcoming video to recreate the problem in the thumbnail on the right.
I did some research and discovered the H.264 Gamma thread on Apple Discussions where I learned that Quicktime’s H.264 encoder has had this gamma bug for about 3 years, and Apple has yet to fix this problem. Apparently, it’s caused by Quicktime forcing H.264 video to a 1.8 gamma level. There is a way, which is outlined on the thread, to correct this problem without rendering video again by using alpha transparency, but that only works on MOV files and doesn’t preserve hinting (i.e. the ability for you to start watching a video before its finished downloading).
I also heard that VisualHub does not have this problem, so I downloaded the trial version and began a series of experiments to find out what setting was best. An article from DearCali.com (which has since changed owners) was very helpful, but after trying many combinations in VisualHub, the gamma problem remained in every H.264 video I exported. (Yes, even after forcing ffmpeg, you geeks.) So I did what I should have done in the beginning, I manually applied a brightness filter in Quicktime.
As far as I know, this is the most straightforward, universal, and foolproof solution to this problem.
How To Counteract the Gamma Bug
To counteract this problem, you only need to add one step your normal process. (See “How to Encode a Video for a Podcast” for specific instructions on how byteful video is exported.) Once you have your final video, open it up in Quicktime and export the movie as “Quicktime Movie” again. It’s easy to make a mistake that would result in the loss of quality here, so follow these steps closely:
- Click “Settings” and set your Compression Type to “Apple Intermediate Codec”, and make sure your Frame Rate is set to “Current” FPS. Click “OK”.
- Now click “Filter”. As you can see, there are many filters that you can apply to a video. Choose “Brightness” and pull the brightness to the left until it says “-7″. You may want to experiment with how much darker you want it be, but in my experience “-7″ seems to be just the right balance. Click “OK”.
- Make sure “Sound” is checked, otherwise you won’t have any sound! Then under “Sound” click on “Settings”. The “Linear PCM” format works, but “Apple Lossless” is a smaller file so I use that. Click “OK”, and click “Save”!
The Final Export
Exporting video in Apple Intermediate Codec is much faster than most video codecs, and this is by design. This codec was designed to be an intermediate codec to work with between computers and video cameras, without having a huge file size like most DV codecs.
Once the export is done, try exporting to H.264 again. The settings outlined in “How to Encode a Video for a Podcast” result in the most compatible and highest quality video I’ve been able to achieve with the H.264 codec. As you can see, the resulting file is nearly indistinguishable from the original.
Do you have a suggestion on how to improve this article? Or have you found a better solution to this problem? I’m open to suggestions in the comments.
2008.09.21 Addendum: It’s been brought to my attention that using Compressor 3 produces similar results as the above procedure, however I have not verified this. As always, test different methods to see what works best for you.
2009.01.30 Addendum: Another technique has been brought to my attention at Ken Stone’s page. Please let me know how this works for you.