Compositing into 4:2:0?

Rick Burnett

Section Moderator
I've been doing a lot more visual fx lately and one thing I notice is that given the source material I am creating doesn't have 4:2:0 artifacts within it OR on the boundaries of where it interacts with the original video, I can tell that it wasn't in the regular shot.

I mostly use AE, and I've not been able to find ANYTHING on reducing the chroma sampling as a plugin, or, how one layer affects the colors in another.

Any ideas on this?

Rick
 
I've been doing a lot more visual fx lately and one thing I notice is that given the source material I am creating doesn't have 4:2:0 artifacts within it OR on the boundaries of where it interacts with the original video, I can tell that it wasn't in the regular shot.

I mostly use AE, and I've not been able to find ANYTHING on reducing the chroma sampling as a plugin, or, how one layer affects the colors in another.

Any ideas on this?



Are you saying you want to "dumb down" the generated RGB material to match the other 4:2:0 footage ?

You could export a 4:2:0 format then reimport it. AE uses nearest neighbor algorithm to upsample chroma, so it will apply that to the reimported footage

Another approach is to use another upsampling method for your 4:2:0 footage to make color edges less blocky to better match the generated RGB material

But there can be dozens of other reasons why something doesn't composite very well into a shot - are you sure it's solely due to chroma sampling ?
 
On this one I am. The problem is the edges between a vehicle I made and the sky/buildings it flys past. Other parts of the scene that have the same color transition between sky and an object have color contamination along that contrast boundary. On what I added, this is the first clue that it wasn't part of the scene. It looks crisper at the edges. I use Fast Blur to bring the resolution down on what I render to get it to the quality of the video. Most of the time this works great. What I notice is that when you have high contrast edges that are pretty large, this is where the illusion breaks down. I've composited quite a bit of stuff before from my original footage and most of the time, it isn't a problem because the contrast edges are so small (like a helicopter in the distance). This one is big, and that's why I notice it.

Thats a good point on exporting. I wonder if I export into something 4:2:0 if it will preserve the original chroma subsampling where it exists and subsample where I have higher chroma. That might just work.

Which brings about another question, how do I do that? :) What codec would do 4:2:0 but not degrade anything else?
 
It depends how your shot is setup - if you need alpha channel preserved or not

Most formats that preserve alpha and are lossless will be RGBA (4:4:4:4)

There are plenty of lossless 4:2:0 codecs for windows , but I don't know of any that have alpha 4:2:0:4

There maybe a few 4:2:2:4 codecs , and the upsample will still look blocky in AE (but not as blocky as 4:2:0) . DT video codecs has fourcc "avu2" (free), sheer video has a couple as well

If you can export a lossless 4:2:0 (e.g. huffyuv, lagarith, ut video codec), bring it back in for upsample to RGB, then isloate / roto the object that should work too, but lots of work
 
Yeah, I undersand what you are saying. Ideally what I want is something that doesn't compress, but that downsamples the chroma only. This way, I preserve what is already sub-sampled, and just spread out everything that is at a higher resolution. I am thinking, do this with the final composited image. I guess experimentation is in order, just haven't had the time to really experiment on this yet.

Basically I want to not compress, but subsample the chroma. I want to preserve what is already subsampled, and anything at higher chroma, downsample it. The biggest issue is, with 4:2:0 I understand why is happening, but not exactly how it's implemented. I need to wrap my head around that and then I can really figure out how to do it. The future solution is to record in 4:2:2 :)
 
Yeah, I undersand what you are saying. Ideally what I want is something that doesn't compress, but that downsamples the chroma only. This way, I preserve what is already sub-sampled, and just spread out everything that is at a higher resolution. I am thinking, do this with the final composited image. I guess experimentation is in order, just haven't had the time to really experiment on this yet.

Basically I want to not compress, but subsample the chroma. I want to preserve what is already subsampled, and anything at higher chroma, downsample it.

That's the purpose for lossless codecs. They are mathematically lossless. You incur no generation losses if you remain in the same color model/ color space (you can re-encode it a zillion times, and decoded image will be bit for bit identical) . If you're familiar with audio, the analogy would be FLAC vs. MP3. FLAC is lossless compression. MP3 is lossy compression

In losslessly compressed video, the only losses you incur are from colorspace transformations (e.g. RGB<=>Y'CbCr), and that's exactly what you want in this case

The other approach is to upsample your 4:2:0 material using better methods

The biggest issue is, with 4:2:0 I understand why is happening, but not exactly how it's implemented. I need to wrap my head around that and then I can really figure out how to do it. The future solution is to record in 4:2:2

The way it's implemented in AE, is Cb and Cr are point resized (nearest neighbor) to RGB. Y' is full resolution in 4:2:0 Y'CbCr, but CbCr is tiny. So for a 4:2:0 1920x1080 video, Y' is 1920x1080, but CbCr are only 960x540

When you convert to RGB, the nearest neighbor enlargement is the reason why everything is so "blocky". You can try this in photoshop or avisynth for example. Try enlarging photos with various algorithms. Bilinear will be less blocky. Bicubic will be even more sharp. Lanczos3 will be even more sharp but start to introduce ringing. There are dozens of different algorithms, and nearest neighbor is the "blockiest"

Here is a quick example from xdcam-ex material (4:2:0) . Top is a 1:1 crop, and bottom is a 4x nearest neighbor enlargement (zoom)

2rc49l5.png



i1czsj.png



Notice the "pixels" are finer with the higher quality upsample . If you were a shooter in the DV days, do you remember all that discussion how FCP vs. AVID upsample chroma? Then there were all those chroma smoothing plugins. This is the same idea, you're just upsampling the chroma differently . I didn't show it here , but if you change the avisynth algorithm to point resampling , you get the same image as AE
 
Last edited:
Back
Top