View Full Version : luminance levels in DVD2AVI+CCE
Fmazzanti
5th April 2003, 21:45
Hi guys,
I know this issue has been discussed before, but I can't get to a definitive answer... maybe somebody can help here. I want to use the DVD2AVI+AVS script+CCE method to encode movies to DVD-R. Now I know in DVD2AVI you can use either the 'TV scale' or the 'PC scale', and I also know that in CCE you can set the luminance range either to 0-255 or 16-235. Now considering I'm a PAL man and also that I have a nice 32" TV, what would be the best combination of luminance levels?
TV scale in DVD2AVI and 0-255 in CCE or what?
Thanks a lot...
Definitive answer: Encode a short clip with all four combinations, burn them onto a DVD-RW, and see which one looks best to you.
Fmazzanti
8th April 2003, 08:31
Yes thanks... but other than the do-it-yourself, any good advice on what is the right choice?
Thanks again...
jfcarbel
9th May 2003, 21:22
Here is what I had in my notes from research on the forums:
If your are encoding material originates on a digital format, such as DV or D8, then you want to use the 0-255 scale.
If your original source material is from a DVD, set the luminance value to 0-255 (that is set DVD2AVI to TV Scale)
If the signal originated on analog systems (i.e. a capture from analog/VHS using a DV codec), then you should use the 16-235 scale to accurately reproduce the brightness/contrast range.
My question: so for an analog VHS capture in DV, I should use 16-235 - correct?
http://forum.doom9.org/showthread.php?s=&threadid=28815
http://forum.doom9.org/showthread.php?s=&threadid=47086&goto=lastpost
Both of those threads explain this fairly well, and there is link in the first post with some good info as well.
jfcarbel I think you are mostly correct.
Cameras film colors outside of a tv's viewable range. So when you encode for tv playback, you use a luminence level of 16-235, which compresses the luma so that it conforms to the tv's spec. So really, the only time you would ever encode in 16-235 is with a non dv recording or if, at some point in your processing, your luminence level was stretched out to 0-255. This can actually happen without you even knowing it because some codecs or even software apps do this by default.
DV is unlike regular camcorders in that it records in CCIR601 already. Its colors already conform to the tv's spec, so you'd want to use a luminence level of 0-255 to prevent any further luma compression. However, this really means nothing since your luminence scale can easily be stretched out to 0-255 depending on what software you use, so the only way to be sure that you are using the correct luminence level is to do a histogram at each step, of course you'd only have to do this the first time and then you'd know.
The same goes for DVD. Its obviously encoded in the 16-235 range already, so you want to keep it that way. If using CCE, set dvd2avi to YUV output, or if you must use RGB then set it to tv scale, and then encode in the 0-255 range in CCE. If using TMPGenc, either set dvd2avi to RGB->pc scale or use tv scale and chage TMPGenc's luminence level on the Quantize Matrix tab. Its the first option under Special Setting. The good thing about DVD is you are encoding directly from a source whose luminence level is known, so you do not have to worry about your levels getting stretched out.
As far as capturing off of analog television is concerned. If its playing on the tv then it already conforms to CCIR601 spec and you'd want to encode in 0-255 to keep it that way. But it can easily get stretched out to 0-255 depending on what codec and software you are using so basically, there is no way to know without testing.
tgferg67
11th May 2003, 07:45
I find the 0-255 setting is not accurate to the original.
I did a test with 2 identical dvd players playing in sinc and compared the original to both 0-255 and 16-235 DVD2DVD-R/CCE coversions. The movie was The Count of Monte Cristo - NTSC. I A/B'd by switching instantly back and forth from one player/source to the other.
My observation was the 0-255 setting had noticable darker blacks than the original. Detailed textures, in very dark scenes, that were visible in the original were lost - blacked out with the 0-255 setting. The pictured also had a different overall look, being darker with brighter colors than the original. The 16-235 setting conversion was right on with color and blacks when A/B'd to the original.
Note: DVD2AVI is set to pc mode in DVD2DVD-R
tgferg67: and that's completely consistent with what I just posted.
If you set dvd2avi to pc scale than it stretches the luminence range out to 0-255 and you must encode in 16-235 to compress it back to spec. That is why you noticed more accurate colors, because you were encoding in the proper luminence scale.
Like I said, if you set dvd2avi to YUV output or RGB @tv scale, then encode in 0-255. This keeps the source at 16-235 throughout the entire process.
If you set dvd2avi to RGB @pc scale then you must encode in the 16-235 scale. This first stretches the lumince scale out of spec, and then just compresses it back again. Its a needless conversion, but it doesn't hurt anything as long as you realize that its happening.
You can encode in either 0-255 or 16-235 to get accurate luminence levels, its what you FEED the encoder that determines the setting you should use.
Assuming that we are frameserving via AVISynth, note that the component that does the luminance scaling is not actually DVD2AVI but the mpeg2decX.dll that decodes from the D2V project. The TV/PC scale setting is just recorded in the 'YUVRGB_Scale' line in the D2V and mpeg2dec.dll uses it to do the scaling when asked to output RGB data. Note again, this is a setting only affecting the conversion from YUV12 to RGB in mpeg2dec. That is, with a typical AVISynth script that just uses 'mpeg2source("project.d2v")', the TV/PC scale option in the D2V is simply ignored and has no effect because mpeg2dec outputs YUY2/YV12 data in the original luminance range. The only place I have seen where it is actually being used is in the YV12toRGB24() AVIsynth function exported by Marc's mpeg2dec3.dll. The other mpeg decoders (mpeg2dec.dll, mpeg2dec2.dll, Nic's mpegdecoder.dll) simply never use it because they have no RGB output facilities.
So yes, when decoding from DVD via mpeg2dec, you should always set luminance to 0-255 in CCE, the TV/PC scale setting in DVD2AVI has no effect.
Bach, what tweaks are you referring to? I'm not sure what's funny about this thread. Choosing the correct luminence level for your source is a very important step in the encoding process and the difference is definitely something which is plainly visible to even the casual viewer...Maybe I'm just misinterpreting your post.
It's not a matter of tweaking your levels, you just want to only compress your levels as much as CCIR601 requires, and no more. You don't want to throw away any more dynamic range than you are forced to.
Again, when frameserving a DVD2AVI project via mpeg2decX.dll/AVISynth, the only place where you need to take care of the correct luminance level (0-255) is in the encoding step (CCE/TMPGEnc). The TV/PC Scale option in DVD2AVI has no effect here and can be set to either option, it simply doesn't matter.
Reading this read, it appears people think that the TV/PC Scale option in DVD2AVI must be set "correctly" as well. There is no way to set it "correctly" as it's simply not used by mpeg2decX.dll.
I obviously must have given the wrong impression here. I'm not talking about dvd2avi and I'm not talking about avisynth. I'm simply saying that you must set the luminence levels correctly in your encoder for your source. All I'm saying is that you don't want to needlessly compress your luminence scale any further than you have to in your ENCODER.
Bach like I said, I considered that I may have just been misinterpreting your post. It seemed to me you were saying that the luminence range you encoded in made no difference.
All of the DVD encoding guides on this site and DoCCE4U have CCE set to 16-235 colorspace. Obviously not everyone has has their levels set correctly, and I'm suprised this hasn't been corrected yet in the guides.
I know tv/pc scale in dvd2avi has no effect when using YUV output, I have said this numerous times in the past, and that's why I said you'd need to encode in 0-255. But in my earlier posts I was not limiting the discussion only to avisynth frameserving. Like I said, if set to YUV or RGB @tv scale (d2v loaded directly into TMPGenc for example) then you'd want to encode in 0-255 range.
If set to RGB@ pc scale (same example as above) than encode in 16-235. When I say this I assume you are converting to RGB one way or another, otherwise I don't know why you'd bother setting dvd2avi to RGB instead of YUV.
I've never used DVD2DVD-r. when I responded to tgferg67 I assumed he or it (DVD2DVD-r) was doing a conversion to RGB and that tv/pc scale needed to be taken into account.
Fmazzanti
14th May 2003, 08:43
Gentleman,
you're leading the discussion to a big mess, if you let me say that.
I don't really know about that, but I'd like to have a good recipe. I encode DVDs the .dv2 -> .avs -> CCE way. So then, if I understand that correctly, I must set:
* dvd2avi: pc or tv scale, it doesn't matter.
* CCE: 16-235 if my main goal is to view the encoded material in my TV.
Or is it more complex? What iif you don't want to watch the backupped movie on a TV, but want to beam it on a screen?
Thanks...
coona
14th May 2003, 09:24
@Fmazzanti
In my opinion you should use 0-255. It results from this part of RBīs post.
So yes, when decoding from DVD via mpeg2dec, you should always set luminance to 0-255 in CCE, the TV/PC scale setting in DVD2AVI has no effect.
On the other side, all guides on Doom9īs pages recommend 16-235 :D.
No Fmazzanti, you set CCE to 0-255 for a DVD source. This has been posted in this thread about 5 times now.
Regardless of what your playback device or method is I would always use 0-255 in CCE with a DVD source. The goal when backing up a DVD should be to get the copy as close to the original as possible. A setting of 0-255 in CCE will ensure that your levels stay the same.
I hope I have now cleared this case once and for all in the Updated CCE FAQ (http://forum.doom9.org/showthread.php?s=&threadid=53770), Q12. Actually, this option in CCE is ignored unless you are feeding it RGB video.
jfcarbel
25th May 2003, 01:18
I read the FAQ and my analog captured video clips are rendered as RGB by the Matrox DV codec, so do I do the luminance level of 16-235?
I will be encoding for DVD for TV output only.
Look in the codec configuration (Device Manager - Audio, Video and Game Controllers - Video Codecs). What can be configured there for the Matrox codec? If there is really no option to keep it in YUV color space, you will have to find out if it already applies a 16-235 luminance scaling when converting to RGB. If so, choose 0-255 in CCE, 16-235 otherwise.
auenf
26th May 2003, 13:16
the config for the matrox codec are pretty boring iirc, think they just say 'use 720x576 or 720x480 only', at least thats what the software (VFW) codecs say, not sure about the hardware based codecs.
Enf...
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.