PDA

View Full Version : Colorspace conversions


TheManuel
26th October 2006, 19:03
These are probably easy questions to answer for many of you.
I am trying to understand where the colorspace conversion should occur on my analog video to DVD processing pipeline. I am capturing my home videos from a Hi8 camcorder which I understand operates in the 4:2:2 colorspace. I assume YUY2 is the specific native format (or is it UYVY?). My final format is 4:2:0 YV12 which is the standard in DVD.
I am using a capture card with a Phillips SA7xxxx chipset (I'm not at home right now so I can't confirm the exact chipset designation). I use Virtual VCR for the capturing process. I compress the raw video with HufYUV because it is the only lossless video codec that can do the job in my aging computer without dropping frames. This requires that I set the capture in VirtualVCR to YUY2 since HufYUV cannot handle YV12.
I afterwards edit with VirtualDub and I am very careful to ensure no further colorspace conversions are performed (I have not started using filters yet) so the edited video is converted to YV12 by AviSynth and frameserved to HC for final MPEG2 encoding.

My questions are:
1) Are my assumptions correct about the source's colorspace (YUY2 or UYVY or other)? If so, it seems that a conversion is inevitable somewhere along the way from camcorder to DVD.
2) Does the capture card support several colorspace formats or does it operate in a single native format and therefore potentially introduces a further colorspace conversion step?
3) Do multiple conversions back and forth between YUY2 and YV12 in the digital domain introduce degradations in the image quality?
4) Am I worrying to much about colorspace conversion? (subjective question)

Thanks.

JohnnyMalaria
26th October 2006, 19:35
I am capturing my home videos from a Hi8 camcorder which I understand operates in the 4:2:2 colorspace. I assume YUY2 is the specific native format (or is it UYVY?).

No - the output from the Hi8 camcorder is an analog video signal. The concept of 4:2:2 etc doesn't mean anything. The S-video signal comprises two components - the Y (luma) and C (chroma). They are both continuous, analog signals.

Your capture card will sample the Y signal at a fixed rate - say 720 times per line - to give, say, 720 pixels horizontally.

The C component has to be separated into the two color components - 'U' and 'V'. This, too, is done by the card and, once done, the U and V components can be sampled at a fixed rate. If sampling rate of the U and V is the same as for the Y, you would get 4:4:4. Sampling at half the rate (technically on both fields of the frame) will give 4:2:2.


My questions are:
1) Are my assumptions correct about the source's colorspace (YUY2 or UYVY or other)? If so, it seems that a conversion is inevitable somewhere along the way from camcorder to DVD.

See above.

2) Does the capture card support several colorspace formats or does it operate in a single native format and therefore potentially introduces a further colorspace conversion step?


I don't know about this particular card.

3) Do multiple conversions back and forth between YUY2 and YV12 in the digital domain introduce degradations in the image quality?


It can cause headaches!

Ideally, keep to YUY2 (4:2:2 planar) throughout the processing chain until the last step. Only then convert to YV12 (4:2:0).



4) Am I worrying to much about colorspace conversion? (subjective question)



Yes :) Since you are capturing from an analog format and you can capture to 4:2:2, you are 'good to go'.

TheManuel
26th October 2006, 23:06
Thanks for your detailed response, John.

On retrospect, I guess the card supports several colorspace formats since VirtualVCR allows me to choose from several different ones (at least YUY2 and YV12 work for sure, as I have used them) and I doubt that VirtualVCR performs any colorspace conversions by itself.

I must have shown my greenness talking about color sampling for an analog source. I was confused by a table I saw on the web showing approximately equivalent digital properties of several different analog sources here (http://www.digitalfaq.com/dvdguides/capture/understandsource.htm).

One more question, then; is it better, qualitywise, to sample the source video at its final format since the beginning (4:2:0) and avoid any conversions or rather to capture in the higher color resolution format (4:2:2) to have more data to work with during post-processing and downconvert at the end?

Thanks again.

JohnnyMalaria
27th October 2006, 01:18
One more question, then; is it better, qualitywise, to sample the source video at its final format since the beginning (4:2:0) and avoid any conversions or rather to capture in the higher color resolution format (4:2:2) to have more data to work with during post-processing and downconvert at the end?

Thanks again.

As a general rule, keep as much information as possible until the very end. If you are just going to do a simple conversion without any editing (other than straight cuts), then you could capture as 4:2:0, but as soon as you introduce any image processing (e.g., fades, wipes, titles etc etc, keying), you should use the format with the most information.

TheManuel
27th October 2006, 01:39
Thanks again.

sadie
28th October 2006, 12:50
This is as good as any point to hopefully get a couple of answers regarding some nagging doubts about the color space business. Alright, by now I think I've got working knowledge of the basic theory behind the spaces, sampling approaches, YCC world vs RGB. Yet I cannot see the practical implications of all this as they play out in the conversion processes.

To use a framework that might better illustrate my confusion, I'd like you to answer for me the following statements. TRUE or FALSE:

1 - The internally processed DV footage in my 3CCD camcorder is YUY2 4:2:2.
2 - The capture into Pinnacle Studio editor is 4:2:2 as well
3 - The edit/render process in Studio, Premiere, etc necessitates a conversion to RGB ONLY in those clips where filters have been applied.
4 - 'Smart rendering' in Studio etal, means that those areas where RGB filters have been applied are converted back to 4:2:2 when saved to a 'same as source' avi file. Other untouched unfiltered portions of original capture are merely copied straight through in 4:2:2 space.
5 - Virtualdub converts to RGB in full process mode, but acts as 'pass-through' vehicule in fast process mode.
6 - When authored/burnt to mpeg2 4:2:2 space is converted to 4:2:0 YY12.
7 - TV playback retains 4:2:0 space.
8 - Computer playback converts back to RGB

Alright, based on the above please put into context why any video I open in a single window under ffdshow universally will show 'YV12, adj' regardless of how it's been processed/encoded. Also, more perplexing, why a few days ago did an attempt to employ an avs script with tomsmocomp (using no convertto...instructions) in order to transcode my source DV file into xvid with virtualdubmod result in the following message: "Tomsmocomp: Supports YUY2 and YV12 color formats only"? Put differently, why should I have had to convert (from RGB?) to a color space that presumably the file is already in to have the deinterlace filter work?!?

Secondly, Johnny Malaria said: "It can cause great headaches". May I ask what, when, why and how? And will my neighbor's brother-in-law see the difference anyway. To partly anticipate an answer does playback of DV material on my monitor suck for the same reason a Windows screen capture sucks on the TV: different color spaces? Or is there more to the story? Thanks

JohnnyMalaria
28th October 2006, 18:54
TRUE or FALSE:

1 - The internally processed DV footage in my 3CCD camcorder is YUY2 4:2:2.


FALSE - If your camcorder is NTSC, then it is 4:1:1. For PAL, it is 4:2:0


2 - The capture into Pinnacle Studio editor is 4:2:2 as well


FALSE - If you're capturing DV (i.e., transferring it via Firewire), then it will be either 4:1:1 or 4:2:0 (NTSC or PAL, respectively).


3 - The edit/render process in Studio, Premiere, etc necessitates a conversion to RGB ONLY in those clips where filters have been applied.


TRUE (-ish) - Depends on the filter (whether it supports native YUV processing or not) and the version(s) of Studio and Premiere. I'm not familiar with Studio, but I do know that Premiere used to be RGB only. Only the more recent versions support native YUV processing.


4 - 'Smart rendering' in Studio etal, means that those areas where RGB filters have been applied are converted back to 4:2:2 when saved to a 'same as source' avi file. Other untouched unfiltered portions of original capture are merely copied straight through in 4:2:2 space.


TRUE and FALSE - The color space is either 4:1:1 or 4:2:0 (NTSC or PAL), otherwise generally true.


5 - Virtualdub converts to RGB in full process mode, but acts as 'pass-through' vehicule in fast process mode.


TRUE as far as I know but I'd prefer to defer to Virtualdub gurus.


6 - When authored/burnt to mpeg2 4:2:2 space is converted to 4:2:0 YY12.


FALSE - And this is where one of the headaches comes in! For PAL DV, the data are 4:2:0 - so that's simple (4:2:0 to 4:2:0). For NTSC DV, the data are 4:1:1. Conversion to 4:2:0 requires a lot of additional processing to make it look good. Basically, the incoming 4:1:1 has to be converted to 4:2:2 (which implies interpolation etc) and the intermediate 4:2:2 then converted to 4:2:0.

If done crudely, you end up with the equivalent of 4:1:0 which will look dreadful.

A Google search on "4:1:1 to 4:2:0" yields a lot of useful information about this (link: http://www.google.com/search?num=100&hl=en&lr=&newwindow=1&as_qdr=all&q=%224%3A1%3A1+to+4%3A2%3A0%22 )


7 - TV playback retains 4:2:0 space.


FALSE - Ultimately, the TV playback has to be converted back to an analog Y/C signal and then the TV itself converts it to RGB for each of the electron guns in the tube (for CRT TVs).


8 - Computer playback converts back to RGB


DEPENDS - Many graphics cards support YUV overlays which means the graphics card can accept YUV data. The card then does whatever it needs to do in order to display it correctly.