For anyone who has ever experienced problems when exporting H.264 video, this article was meticulously researched just for you.
Have you ever exported h.264 video only to find the colors washed out or faded? Maybe your blacks have become crushed into dark grays? When exporting episodes for my YouTube Channel, I encountered this problem, too. And today, I’d like to clear away the confusion and openly show how I solved this problem once and for all, creating beautiful video that looks good on your computer, as well as video sharing sites like YouTube and Vimeo.
First of all, while researching this article I was shocked at what I discovered to be true versus what I’d heard. It seems there’s a lot of confusion around video, and that’s not surprising considering how absurdly complex it can be. So let’s clarify it!
A False Solution
Originally, I heard this problem was easily solved using the Handbrake encoder because it used a different encoder than Quicktime, namely the award-winning x264 encoder. Yet after conducting various tests, I was able to repeatedly demonstrate that using Handbrake does not solve the brightness bug at all. It doesn’t desaturate the colors as some methods do, but it does change the brightness curve. Here’s a simple animation that I created that alternates between a frame from my original uncompressed video and the same frame from Handbrake’s version of the video:
The main problem with this gamma shift (which is sometimes inaccurately referred to as a color shift) is that your video’s “black levels” become unrealistic, and you loose the ability to have rich shadows. Instead, the video gets lighter and washed out (some call it “brighter”, but that’s not technically accurate). But the solution I’m about to share with you prevents this distortion of color and washed out gamma levels. It’s a “one gamma-color-shift fix for Quicktime to rule them all”, kinda thing.
And in case you’re curious, this was done using a slight variant on the iPod encoding preset included in Handbrake. These results mean that Handbrake decides to treat gamma in the same inaccurate way that Quicktime Pro does. Therefore, it would never be able to solve my problem.
So now that Handbrake had failed, what could I do?
Then it occurred to me, what if I bypassed Handbrake altogether? What if I used the x264 encoder directly with Quicktime Pro?
I decided to give it a try.
I remembered that x264 was also available as a standalone Quicktime plugin, so I did some research. At first, all I found was a stand-alone plugin from 2006, so I grabbed it off of MacUpdate. After a quick install process, I ran a few tests and exported a few different times, trying different settings each time. And, while the gamma problem was completely gone, I could not get any resulting movie files to play on any mobile devices.
Basically, I tried every variation of advanced settings, and nothing would work. This plugin simply doesn’t have the specific settings needed to create a video that will play on an iPhone or iPod.
So I had to resume my research, and I soon realized that Japan is still producing truly awesome people.
What finally saved me was a newer plugin by a Japanese genius named Takashi Mochizuki. This plugin is still based on the award-winning x264 project, but it has over ten times as many fine controls on its settings page than the other x264 plugin. Most importantly, it corrects the problem! This incredible beast is called x264Encoder, and it’s available on: http://www003.upp.so-net.ne.jp/mycometg3/ Update: His site has disappeared. New download link below.
After reading some of the documentation and conducting various tests, I finally refined a way to create flawless H.264 video that works on a variety of devices, all without any gamma bug. I’d finally discovered the best video compression technique for color consistency.
But before you can delve into the powerful controls of this new plugin, you have to install it and relaunch your video editor. (I prefer Final Cut Pro, but it also works with iMovie.)
x264Encoder Quick Install
- Download the plugin on Takashi’s site. (UPDATE: A kind reader has informed me that Takashi’s site is down, but I’ve gone ahead and put the original files up on this server for your convenience: http://myth.li/private/x264codec11.zip
- Copy the x264Encoder.component to Mac HD/Library/QuickTime/
- Make sure you’re opening the Library folder at the root level of your hard drive. Don’t put it in the library folder in your Home, because that won’t work.
- If you have trouble with installation, please read the directions that come with the plugin.
- Quit any video editing programs you have open because they’ll need to be relaunched to see the new Quicktime encoder you’ve just installed. (Although it’s best to reboot entirely.)
- Open your video editing program and do one of the following:
- In Final Cut Pro, choose:
File menu > Export > Using Quicktime Conversion - In iMovie, choose:
File menu > Export > Quicktime Tab
Choose, Compress movie for: Expert Settings
Click “Share”
- In Final Cut Pro, choose:
- Then enter the detailed settings below.
Detailed Instructions for Flawless H.264 Output
Select: “Format: Quicktime Movie”
Click “Options” button
Make sure “Video”, “Sound”, and “Prepare for Internet Streaming” are all checked.
Then, under “Prepare for Internet Streaming”, choose “Fast Start”.
Under Sound, click “Settings” button
Change the settings to this:
Format: AAC
Rate: Recommended
Render Settings: Quality: Normal
MPEG 4 AAC LC Encoder Settings: Target Bit Rate: 160kbps
Click “OK”
Under Video, click “Size” button
Just look at this to make sure that it’s the size you want. (I mention this because when testing, I noticed that this would default to “Compressor Native” which was too small.)
Click “OK”
Under Video, click “Settings” button (this is the really important part)
Change the settings to this:
Compression Type: x264 Encoder
Frame rate: Current
Key Frames: Automatic
UNCHECK Frame Reordering
Encoding: Best Quality (Multi-pass)
Data Rate: Restrict to 1500 kbps (if you want iPods to be able to play it)
Alternatively, you could just make your settings look like this:
Then click “Options” button at the bottom left of the window.
This is where it starts to look a little crazy, but it’s easier than it looks.
So hang in there! This is totally worth it.
Now, you will see this vast array of options:
But you don’t have to worry about setting all of this up because presets are included!
Click the “Load Preset” button at the bottom left, and a sheet will slide down.
Presets make it easy to make iPhone-ready video
If you’d like people on mobile devices like the iPhone, iPad, or iPod touch (as well as the PSP and Zune) to be able to play your video, choose the “iPod Tuned” preset. (According to the x264 docs, this takes a bit longer to encode than “iPod Default”, but the results look better. It’s worth it.)
Click “OK”
And while we’re here, click on the “Values” tab to look at all the settings you don’t have to worry about because Mochizuki-san provided some excellent presets! Domo arigatou, Mochizuki-san!
The Key is Setting the Gamma
To finish up, let’s activate the color spacing tag that fixes the problem that spawned this entire situation.
Click on the “Tagging” tab and check the checkbox “Add gamma 2.2 (SD/HD content)”. Adding this gamma tag simply and elegantly solves the problem without any unnatural color filtering or adjusting. That’s why this method is superior to all other methods. No “BlackWhite” restore, brightness filter, or strange alpha channel methods are needed. This is an important point. Shifting the brightness or contrast during exporting in order to fix the gamma problem is a bad idea. Not only does the export take longer, but worse, you always lose more quality than if you hadn’t adjusted. That’s why I’m so thankful that Mochizuki-san has put so much work into this plugin.
Now that you’ve set the gamma, your settings are complete!
Click “OK”
Click “OK” again
Click “OK” once more
Then click “Save”, and wait. (It may take hours depending on the speed of your machine and the length of your video. I recommend that, before you spend hours encoding your entire video, you experiment on a clip only a few seconds long to confirm that it looks the way you want it.)
The result? Beautifulness.
The resulting video will not only have the same brightness as the original, but it will also play back on mobile devices like the iPhone, iPad, or iPod touch. And there should be no significant brightness shift compared to a Mac and a Windows-based PC when playing back the same video file. (Although calibrating your monitor certainly helps!)
I thank Takashi very much, because at the end of the day, using this plugin lets me say two words I love to say:
Problem solved.
Oh, and while you’re here, check out my YouTube channel, filled with videos of my wild Hawaii adventure! Aravinda Loop channel →
OMFG thank you thank you thank you. I gave up years ago on this bug and in utter disgust with Apple. The disgust remains but IT WORKS!!! Cannot believe it. All that junk on the internet about the transparency layer in the quicktime settings, what a cruel joke that was.
This actually worked. I wanted my video at the same resolution as the original, so I didn’t use the Ipod Tuned settings but instead the Component Tuned ones. Still worked like a GD charm. So awesome.
SO AWESOME
Hey Bob!
Thanks so much for sharing your success! I love to hear from readers, and I’m so glad that my hours of research and troubleshooting have benefitted more than just myself! (Isn’t that what makes the internet so awesome, though?)
Actually, I’m pretty sure you can use any resolution with the “iPod Tuned” settings, but anything bigger than 640×480 just won’t play on an iPod or iPhone. (Although I’m pretty sure the new iPhone 4 can play back at resolutions higher than 640×480, but it JUST came out.)
So glad it worked for you though!
Spread the word! 🙂
Thank you for taking the time to find and clearly explain, this no-bullshit solution. This saves me wading through the morass of posts about how there is no problem other than user error or lack of knowledge.
Great article man … 🙂
Any solution for Windows users ?!? 🙁
I’m also breaking my head on this problem ….
BR,
Yogi
Great article! But I have the same problem as Yogi. Any solution for us Windows users? Please help asap!
well…
this seems to correct the gamma issue when played back in QT. without the need to manually crush blacks or even check the ‘final cut compatability’ box in the preferences.
HOWEVER… the gamma check box in this plugin doesn’t work when uploading to youtube. the videos look gamma shifted upon final processing in youtube. seeing as youtube is the ending spot for my work, THAT’s where it has to look good, not QT.
any advice for settings that the youtube’s encoder can identify and use accordingly?
Thanks for this article!
I would like to use this codec when encoding movie from Keynote’s presentation. I don’t have an idea how to “tell” Keynote to use it, there is no preferences at all… Damn you Apple, just let us export in the ways we like it exported.
Does anybody know how to force Keynote to use this encoder?
CoSTa,
When you click Share, choose ‘Custom’ instead of ‘Full Quality’… you can then select the x264 Encoder instead of the default H.264 when you click ‘Settings’ next to Video.
I’m converting a file but I trust this will fix the problems I was experiencing. Many thanks!
Oh God, please, can you PLEASE do a tutorial on how to fix this ON A PC!!! I dont have a Mac, and I don’t use FCP. I use Premiere Pro. The gamma shift is draining ANY interest in uploading my video anymore.
Please help, I’m so desperate and drained with this bug. You guys are so lucky to have it working on a Mac!
i found this amazing research on h.264 a blessing, for so long h.264 and quick time suck – first is there any chance you could do a breakdown of of HD uncompressed to x264 encode without loss of quality, i mean 1 to 1 1080p to 1080p.
Also i tried to follow your suggestions and reference but still a little washed out – the first time i did it i was blown away but realized that i had -7 brightness filter in QT7 i removed it and got a little washed out HD animation, so seeing that -7 brightness filter gives me the closest i have ever seen to uncompressed hd animation i might have to go with that , if you could let me know what i have done wrong would be great.
Sterling, if you’re following these instructions exactly, the color should not shift… unless you’re monitor calibration is at 1.8 gamma or something.
Did you make sure to insert the 2.2 gamma flag into the video? As I said in the article, adjusting the brightness in quicktime is not necessary.
Thanks for this great article! I have been searching for a solution for this for years.
I’ll be using this in all my upcoming videos.
Thank you so so much for the super helpful post! It’s exactly what I was looking for.
Problem is: I found a bug in the encoder. It inserts random frames in the video, out of order. Case in point: I was exporting a 4 min video, and at 3:28, it inserted a frame in between two shots. I went to FCP to see if I had erroneously left a frame there, but that wasn’t the case.
I re-exported the video a second time, and this time it inserted a frame at random in between two shots at 00:20.
It’s a great tool – the final image is indeed as contrasty as in FCP – but ultimately unreliable because of the random frame issue…
Do you have any suggestions on fixes?
Actually, I managed to eliminate the problem the fourth time I exported the file: here’s what I tweaked
– i selected the iPod Default preset
– adjusted the frame rate under “behavior” (it was 23.98)
– clicked on “3rd pass”
Surprisingly, the resulting file is only 51MB (the first three attempts gave me a 251MB file, with the random frames)
@Nathan
I’m really glad that this article helped you! Feel free to spread the word 🙂
@Elena
You’re very welcome! I Suspect that the frame rate was what was causing the problem. Because, according to the plugin author, 3rd pass is very useless and impossible to tell the difference from only doing 2 passes about 99.9% of the time.
Have you tried doing the exact same fix you describe except not doing a 3rd pass?
I’d be very interested to hear your results, and I know I’m not the only one.
I cant wait to test it!!!!
BTW how did you find this plugin?
Thank you for this.
I am normally not one to be too fussy with video quality. but the difference is DRASTIC between my FCP viewer and the QT export.
@Dave
did you ever solve the Youtube issue?
anyone else have this youtube issue. and how about Vimeo?
thank you again internet people.
So the solution is really to use x264, rather than a fix of H264. I did a test and it works well, but it seems that this really can’t be called a fix for the H264 problem since you’re using a different codec.
Actually Dale, H.264 is a video standard. While x264 is a free software library used to create H.264 video without the problems of some other encoders.
This article is about how to create H.264 video in the best way possible.
Really nice article man. Very helpful.
I can’t believe you’ve solved this with this fantastic plugin. Can’t thank you enough. The washed out look with H.264 was SO SO SO frustrating especially with company logos and jpegs and now I never have to deal with it again!!!… plus the export is even faster than H.264! Crazy good!
Hey–this is GREAT, but I’m wondering if there is a way to use this encoder from within Handbrake, when I’m having to rip DVDs?
@TonyW & Pearl
So glad you’re finding the solution useful! It took a while to test the different configurations and then to write this article, so it’s very encouraging to hear the people continue to benefit from my many hours of testing.
@Kirk
As far as I know, there’s no way to do this since the encoder is built into Handbreak. However, the Handbreak guys may have a work-around. You could post on their forum and ask.
Love it! Thanks for this. One little problem though. I have a red bar that still lose quality. I used all the settings you provided on here and everything, the red bar still sucks! Here’s an image showing the issue:
video_compression.png
Is there a way to fix this? Thanks!
Excellent question, Alex.
Simply put, the color red can be tricky. Some of the best codecs I’ve ever used still distort red objects or make them blurry. And I’m not entirely sure why.
In this case, you’ve clearly lost saturation in the red bar in the video. I have a few questions and then a few things you can try.
1. Just to make sure, I must ask: Did you click the “add 2.2 gamma” box in the encoder?
2. In the first dialog box (before you clicked “options”), did you choose under encoding “Best Quality Multi-Pass”?
3. What application are you exporting from? After Affects directly or opening up an exported AE mov into QT pro and exporting it from there?
Here are some things I’d try: apply a filter to the video that increases contrast in the red area of the spectrum. If your editor doesn’t have fine color controls, try increasing the saturation of all the colors. Or, if that red bar is an imported graphic, bring it back into your graphics editor and make the red bar more saturated. You could also try upping the bitrate.
Hi!
Thanks for the excellent tutorial. I, however, seem to still have the washed out-problem. In our production we use both PCs and Macs so it has to work on both platforms. I used one of our macs and installed the x264-encoder and followed your instructions to the point. The video looks absolutely great on any of the macs, but playing the video on the PCs gives me the same washed out gray results as usual. The only way I can make them look good on the PC is by using the “straight alpha”-hack.
Any ideas?
@Sebastian
Those results are very unusual. First, have you tried it on another PC?
Also, have you tried updating Quicktime on that PC?
Does it exhibit the same problem on a mobile device like an iPod or iPhone?
Have you tried exporting with Compressor instead of Quicktime Pro?
Quicktime is supposed to honor the ICC profile embedded in the video, otherwise colors wouldn’t be consistent anywhere. Try each of those things I mentioned, in order.
Hi Andrew,
quick question about the codec as I’m having some unbelievably frustrating problems. The x264 codec’s installed, I’ve followed all the steps you provided to the letter and still when I export from Final Cut Express, it looks exactly the same as if i’d used the H.264 codec when opened in quicktime pro, or anything else. The whole thing looks lighter and slightly washed out. I’ve tried messing around with the settings for hours testing different things, but the result’s still the same. Even in the preview in Final Cut it looks fine before I export. Just when it’s all done, the result’s still washed out and lighter etc.
No idea what to do now really. Any suggestions?
Hi Matt,
That does sound frustrating. Let’s see what we can do. There are a few things I would try, in this order:
1. Are you choosing “x264 Encoder” and not “H264” under “compression type”? This may sound obvious but it’s easy to confuse the two.
2. Have you tried rebooting and then doing it all over again? Sometimes OS X needs to be restarted when you install a new codec.
3. If you’ve chosen “x264 encoder” and have rebooted, try checking the “add gamma 2.2″ checkbox” under the “tagging” tab.
Let me know how it goes! And good luck 🙂
It just doesn’t seem to be working for some reason. I tried all those things yesterday, numerous times, and it’s still coming out the same. Are there any other things you can think of trying, or any other things that might be causing it? I honestly can’t think of what else to try now :s
Hi Andrew, I worked with Matt on our film and we finally got it working! We didn’t change anything, but just left the computer over night. Anyway, a huge thankyou, you’ve been a lifesaver in helping with this and the new footage looks 100X better than the washed out version: http://vimeo.com/33340378. Thanks again!
@Matt
What is your playback method? Make sure that Quicktime player settings have the “enable final cut studio color compatibility” checkbox UNCHECKED. (This is kind of a cheat that apple never should have implemented.) Also, try exporting your project in the Apple Intermediate codec, then open that resulting file in Quicktime Player, and try exporting as x264 from QT Player. Be sure to DOUBLE check all of the settings since they all count.
@Tom
You just left it overnight! Weirdsville. You didn’t reboot or anything? Anyway, so glad it’s working for you! I really enjoyed the shortfilm, and I’ll be tweeting out about it soon. So glad I was able to help!
Hi Andrew! I couldnt solve the problem! I dont know why, I did exactly as you explained step by step but it keeps exporting washed out or brighter images than the original ones. Im using lion and final cut pro 7
please help me!
Ignacio
Are you sure you’re selecting x264 in the codec selection? It’s easy to pick h.264 but that’s not what you want. Also, have you tried rebooting since you installed the codec? Sometimes that’s necessary.
@Andrew (& Ignacio)
Many thanks for sharing your expertise with us. I’ve been spending hours and hours to find the best conversion from an FCP SD edit to iPad 2 and your method is really excellent. I have a few remarks though:
1) for me, checking the ‘add gamma 2.2’ didn’t work. On the other hand, selecting ‘SD 6-1-6’ instead of the default ‘no nclc atom’ DID work. A few images had too much contrast, but in general the result was very good
2) I first did the conversion from an exported self-contained QT:
this DID NOT work. I had to do the x264 conversion IN FCP !
This proves for me that Quicktime really sucks sometimes.
Thanks again
Werner
@Werner
Unchecking ‘add gamma 2.2? selecting ‘SD 6-1-6? worked for me too! thank you!
@Andrew (or anyone that knows the answer)
What settings would you suggest for making the best looking H.264 movies if they don’t need to be ipad/ipad/iphone compatible – i’m making them mostly for ppt presentations and
digital video players.
thanx!
JC,
The x264 codec makes the best h264 video all around, in my experience. The reality is that the iPhone/iPad format is the standard now, and anything that works on them will work on any modern video player. I suppose the main thing you could do if you wanted even more quality is increasing the bitrate. Perhaps to around 3000kbps.
Thanks so much for posting about this! The results I am getting are closer, but still not quite as deep as my original video.
Something interesting that may give you a clue as to how to help me: my exported video looks *more* saturated if I leave the “add gamma 2.2” selection *UNchecked* than if I leave it checked. If it’s checked, the video looks just as bad as before this work around. If it’s UNchecked, the video looks closer, but it’s still not as rich as what I’m seeing in FCP. I’m using FCP 6 on OS 10.6.8. Any suggestions would be very helpful and thank you so much for what you’ve already done!
Great article! However.. I’m still having issues. I’ve followed everything, restarted multiple times, and made multiple presets in Compressor to try and change things up, but it still turns out brighter. Interesting tid bit however.. I tried using Quicktime Conversion when exporting from FCP, selecting x.264 and matching up the settings, and it worked correctly. The same piece I used Compressor on was lighter than the Quicktime Conversion piece. Any ideas!? I’m stumped here.
OS X 10.6.8, FCP Studio 2.
@Jeff
I had trouble with compressor, too. Just use QT conversion.
Thanks a lot for your tutorial! I was going crazy because of this bug (I didn’t know it was a bug until I found some people talk about this…).
However, just like Taylor three posts above, the colors are not as good as they appear in FC, (and it’s better to leave unchecked the 2.2 gamma as said by many) but they are A LOT better than without this plugin ! 😀
Thanks again for sharing this !
This is great! just tried it and the outcome is SO much better! I thought it was just something you had to deal with… the whole not what it looks like in my timeline thing! THANK YOU!!!!!!
This helped a ton. Thank you.
THANK YOU! I spent days trying to solve this. I started with FCP X and got disgusted by how it made my videos look so washed out. I tried QuickTime 7 Movie Player, FCP, FCP Express and tried every movie editor available, all resultif in a great loss of overall quality, just because of the color change. My only wish was to cut my great videos without noticeable losses. I take them using the Olympus Pen E-PL5. My idea was to cut the h.264 without reencoding, unfortunately this always results in display problems even when cutting only at keyframes. So I could not go around reencoding. Now I cut using QuickTime Movie Player and export using x264Encoder and the result is practically identical to the original!! THANKS THANKS!!
Hi,
Thanks for the tutorial, it really improved the quality of the video drastically.
However, the first few seconds of the video are distorted (it’s a keynote presentation, so the first slide is distorted).
Any idea why this can be?
Thanks,
Eddie
Hello,
I’d like to ask you some help for the gamma compensation process, because I am trying this solution with premiere pro CC but
when I actually press the export button then I get an error saying something go wrong while compiling the movie.
Any suggestion
Thank you
Have a nice day
Max
@Max; I finally figured out that same problem… When you open the codec settings and change to your likings after you close the dialog box DO NOT render or you will experience crash. INSTEAD save project and exit Adobe. Then restart your application. Your codec settings will be saved the way you changed them and now you;re ready to render.
Its a weird work around but it works 😉
It’s really great to see that this post continues to facilitate problem solving!
Good catch, Rick. I haven’t used Premier in a long long time, so I’m glad I’ve kept comments on for this article, otherwise the solution might have never been revealed.
@rick and to all,
I tried the procedure quitting Adobe CC after the codecs settings.
To keep the software I had to try the export with failure results, then quit Adobe CC
and then reopen it. At this point the settings were the ones I wanted.
So I export the file but the final result does not seems to have the gamma correction.
I mean the exported video compared to the original one when no other action but the
gamma correction from the x264 was applied, looks different.
This is really a problem.
I’d like to compile a movie with lots of shots I recorded with a GoPro hero 3.
The original videos looks great and it is extremely important to keep their original quality in the exported one. Especially for those underwater shoots.
I do not know if I have some Adobe CC installation problem, and I do not know how to fix this very annoying gamma shift.
Please, any further help?
Thanks to all
Max
Thanks very much for sharing this research, it worked for me!
Dear all,
what would be the procedure to perform the export with adobe premiere pro CC
with the x264 codec setting?
I get the same error when I attempt to export but from the Max post and the following one, it seems there is a way to get around this problem. Probably it is better explicated in the
Rick post but I can’t see it anymore….
Is it possible to load it again in the page?
If I do what Max says the settings are not saved in Adobe.
Thank you in advance
Nept.
Hello,
I am still trying to fix this gamma shift problem with Adobe CC.
There is not way I can make it work with the x264 settings.
The main problem is the error i get from Adobe and that I can’t remove not even using the procedure from “rick”…
it is really frustrating to shoot high quality video with gopro and get them
distorted when opened by other program to compile a film..
please any help?
Thank you all in advance
Max
Hi,
so, by saving the export setting I can use the x264 encoder.
The only problem so far is that the results is still not ok even if I enable the 2.2 of the gamma correction.
I, copied at the root level the x264Encoder.component in the folder specified above.
But I was wondering if it is the only action I have to do or if maybe I will have to compile
the package before.
I am using mac os “maverick”
I am not expert of this operative system yet.
Anyway any hints are very appreciated…
Thanks
Max