View Full Version : Using x264 to set the gamma tag correctly for QuickTime playback?


Xandros
15th October 2010, 15:02
This old chestnut... I've got gamma shift issues on videos I've encoded with Handbrake using the x264 codec and after sifting through mountains of forum posts, blog articles all I can come up with that seems anywhere near what needs doing is this:

http://byteful.com/blog/2010/07/how-to-fix-the-h264-gamma-brightness-bug-in-quicktime/

Except that guys talking about a QuickTime plugin. I always kind of figured that the gamma tag I've heard so much about is the reason behind this annoyance I've got. However, after looking at the MeGUI x264 options (seeing as Handbrake's aren't up-to-date by a long shot), I can only fathom anything to do with gamma being the transfer setting. But that isn't the gamma tag, it doesn't make a blind bit of differences changing that from the default as I didn't expect it to.

I need some way of inserting the correct tag into these videos I'm make so QuickTime displays the gamma correctly. Ultimately, the reason for this is because I only mostly intend to watch these videos on an Apple TV (old generation) and that thing uses QuickTime. And therefore, suffers from the same problem of displaying videos kind of washed out (though they aren't quite as bad on my TV, it still is noticeable).

Now I have absolutely no understanding of how any of this works so I accept I may have just written a lot of codswallop and apologise in advanced.

Sharktooth
15th October 2010, 15:34
gamma isnt a problem with handbrake/megui/whatever-thats-not-quicktime.
the problem is probably a PC/TV luma levels difference. PC being 0-255 and TV being 16-235.
being CrapTime(tm) an a$$(tm), you would probably want to watch your encodes with another player and see that everything is ok and the real problem is CrapTime(tm).

Blue_MiSfit
16th October 2010, 09:36
If you're targeting QuickTime, I usually suggest encoding full range... that's the only way I've found to make it look right on Everyone Else's (tm) PC without them having to change anything...

Ugly.

The AviSynth plugin SmoothLevels can do nice level expansion.

Derek

Xandros
16th October 2010, 11:17
I'll give it a go but I think I may need to revert to Handbrake's tech support about the gamma tag or something in the end. Either that or just give up and put up with it. Thanks for the responses.

Sharktooth
16th October 2010, 14:16
your problem is NOT a gamma problem. there is no "gamma tag"... just add --fullrange to the x264 commandline.

Mug Funky
20th October 2010, 03:43
use the x264encoder quicktime component - it has an option for this.

the gamma thing has nothing to do with h.264 - it's just something that quicktime in general always gets wrong, and is more pronounced in quicktime for some reason.

there's also a tool whose name escapes me that can remove/modify/do-whatever's-necessary this tag to make things play back at unity gain.

interesting that the appleTV does it - the gamma thing happens on yuv->rgb conversion, and the appleTV should have an all yuv pipeline.

...but that's apple for you. why do something right when you can make a new product and force an upgrade?

Blue_MiSfit
20th October 2010, 05:19
...but that's apple for you. why do something right when you can make a new product and force an upgrade?


XD!!! Very true!

Using the x264encoder component is a fantastic idea. It's an extremely useful tool!

Derek

Mr VacBob
22nd October 2010, 04:22
The nclc atom and gamma setting only applies to .mov files - .mp4 doesn't use it, and x264 generates .mp4. If you set all of colorprim/transfer/colormatrix properly, QT will generate the appropriate nclc internally when opening the mp4 file.