View Full Version : Unwanted contrast increase
johnmeyer
5th October 2003, 01:48
Avisynth 2.5 significantly increases the contrast of my image. The source video is DV, captured via Firewire from my DV camcorder.
To troubleshoot the problem I eliminated as many variables as possible. I used a one-line script that merely opens the video:
AviSource("e:\my video\VHS'20031001 10.36.42.avi")
I opened this script in VirtualDub and used Direct Stream Copy to create a new AVI file. I then imported the resulting AVI into Vegas 4.0. When compared with the original AVI file, the contrast is MUCH higher (the difference is not subtle).
Note: If I use "Full Processing Mode" in VirtualDub, I do not get this contrast shift.
Does anyone have any suggestions or ideas as to what is going on? I suspect this might have something to do with RGB to YUV, except I thought DV was YUV and that AVISynth operated in YUV space.
Wilbert
5th October 2003, 12:56
except I thought DV was YUV
Yes. I don't understand why, but it can also be opened as RGB (depending on the DV codec). Try the following script:
AviSource("e:\my video\VHS'20031001 10.36.42.avi").info
Does it report RGB or YUY2?
I opened this script in VirtualDub and used Direct Stream Copy to create a new AVI file. I then imported the resulting AVI into Vegas 4.0. When compared with the original AVI file, the contrast is MUCH higher (the difference is not subtle).
If you open the avi in vdub, you also see the change in contrast?
Mug Funky
5th October 2003, 16:46
a hack would be to stick a line in that says:
levels(0,1,255,16,236)
that will put the luminance levels back on track.
also, direct stream copying out of avisynth gives you uncompressed frames... maybe not such a good idea
(btw, is there any way to tell directshowsource not to do the same luma range thing with DV? i've taken to using ffdshow as a decoder for DV, seeing as directshowsource now seeks and plays audio)
johnmeyer
5th October 2003, 16:55
"Try the following script:
AviSource("e:\my video\VHS'20031001 10.36.42.avi").info
Does it report RGB or YUY2?"
It reports YUY2.
The other poster states that VirtualDub direct stream produces uncompressed files. I've used VirtualDub for years to do simple cuts on DV tiles, where I oven the AVI directly in VD, set the in and out points, and then copy back out. However, I guess what happens when reading from AVISynth is that the video is being frameserved, and the whole idea of frameserving is to hand over the actual video frame, which of course is uncompressed, and to not recompress it before handing it over. Until you mentioned this, I guess I didn't figure this out. Obviously I can't use this for a project of any lenght. Since I don't get the contrast problem with frames that are re-compressed with the Mainconcept DV codec, and since that is how I will have to proceed, my problem is "solved."
It is still of academic interest as to why I would get the contrast shift.
jorel
5th October 2003, 17:40
Originally posted by Mug Funky
a hack would be to stick a line in that says:
levels(0,1,255,16,236)
that will put the luminance levels back on track.
also, direct stream copying out of avisynth gives you uncompressed frames... maybe not such a good idea
(btw, is there any way to tell directshowsource not to do the same luma range thing with DV? i've taken to using ffdshow as a decoder for DV, seeing as directshowsource now seeks and plays audio)
levels(0,1,255,16,236)
loose too much contrast
and
Levels(0,1,255,0,255)
don't "do nothing" like wrote in the docs,
this encrease the contrast too!
!
Si
5th October 2003, 19:01
Levels is a bit broken.
Well its not really but it currently doesn't do what a lot of us think it should do. :)
The latest version contains a parameter called coring (true/false default true) but setting it to false doesn't do anything. :(
@johnmeyer
Try using ColorYUV(analyze=true) after your AVISource and see what max/ min values are being returned for Y (luma) (move back and forth in your video timeline to get the true max/min values)
Then try
AVISource(....)
COnvertToRGB()
ConvertTOYUY2()
ColorYUV(analyze=true)
and see if there's any difference
regards
Simon
ronnylov
7th October 2003, 16:30
Do you use Canopus DV codec?
http://forum.doom9.org/showthread.php?s=&threadid=33526
"Watch out though, when the Canopus decoder performs the RGB conversion it seems to use a luminance range of 16-235 instead of 0-255 used normally for computers."
Also check this thread:
http://forum.doom9.org/showthread.php?s=&threadid=58110&highlight=canopus+codec
You can use following to change the range in avisynth:
ConvertToYUY2()
ColorYuv(levels="TV->PC")
or
ColorYuv(levels="PC->TV")
depending on what direction you want to go.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.