PDA

View Full Version : Maintaining Colorspace ? - Megui


dbxuau
18th March 2009, 10:22
I have a small dilemma with hopefully an easy solution from you fellas. I record footage with a canon hv20. In terms of RGB, its sensor shoots its blacks at 0-16, and its whites end up being super-white at 235-255. There is small detail in those superblacks and superwhites I would like to preserve all the way through my work flow, so what I have so far is this:

1. Capture HDV (4:2:0)
2. Convert to Canopus HQ intermediary file (upconverts to YUV 4:2:2 8bit)
3. Edit in After Effects with 32bit projectmode and colorspace set to "None" so it doesn't affect my superwhites or superblacks.
4. Render a master copy into yuv 4:2:2 8bit
5. Input into AVS Script creator within Megui.

My final output is destined ONLY for computer (PC x264) specifically and do not want those super ranges clamped or clipped in any way, shape or form with the usual pc to tv rec.601 conversion crap etc.

At this point, right before I am about to encode, it asks me to convert to YV12. If I go ahead and do that, should my superblacks and whites still remain all the way through with the x264 encoding? If not, where in my pipeline to I have to make adjustments to keep the FULL range? Thank you kindly all.

Conquerist
18th March 2009, 10:44
ConvertToYV12 does not do any level conversions.
Unless you explicitly have ColorYUV(levels="PC->TV") in your avisynth script, the levels will remain untouched and the btb and wtw intact.

Also, avisynth won't touch your colorimetry unless you have either a Colomatrix or ConvertToRGB call in your script.

YV12 is 4:2:0 YUV (see here (http://avisynth.org/mediawiki/Convert) for a handy chart), so converting to it will only affect chroma subsampling.

dbxuau
18th March 2009, 11:17
thanks for the quick reply and the link. I did some testing and came up with the following:

This is what it should look like:
http://img14.imageshack.us/img14/4452/superwhite.jpg

This is what x264 puts out:
http://img14.imageshack.us/img14/8099/clampedx264.jpg

Notice how the superwhites get clipped to 100IRE. My avisynth script only has
AVISource("D:\Sequence 01-f16demo 2.avi", audio=false)
#deinterlace
#crop
#resize
ConvertToYV12
Convolution3D("movielq") # Heavy Noise

I didn't do any colorspace conversions of any sort, so I'm a bit stumped as to why x264 is clipping my highlights =( Any idea man?

Conquerist
18th March 2009, 11:50
On the second diagram, the wave doesn't seem compressed, but clipped. A PC -> TV conversion would compress the levels, i.e. L=(219/255)*L'+16 . It's being clipped, so either the decoder or the NLE assumes that imported H.264 content is at TV levels. If your NLE imports H.264 through DirectShow, make sure CoreAVC or ffdshow don't have any sort of levels correction turned on.

If you want to check that the x264 output file does have luma information in the 0 to 16 and 235 to 255 ranges, try playing the output file through ffdshow. Open the ffdshow video decoder settings (tray icon), select Levels, and check the boxes Show Histogram and Full Range.

Also worth mentioning is that if this is for web distribution and you intend for the viewer to see the btb and wtw ("destined ONLY for computer"), most computer players will always play content at TV levels, i.e. do a TV->PC conversion, unless the user changes a setting to use full range/PC levels. Silverlight is one of the few (only?) players that honors the full range bit stream flag that x264 can write with the --fullrange option. So if this is destined for web distribution, it would be a good idea to add ColorYUV(mode="PC->TV") to your script, for the sake of compatability.