View Full Version : Which filters should I use to get corrected contrast/brightness/saturation output?
Weltall
27th July 2006, 06:33
Well, I encode all my animes to x264/aac ps, but I got an awful problem: some of them have totally messed brightness, contrast or (and) saturation levels. I want to use ffdshow filtered input in my batch encoding tool (generally I use RealAnime or xAnime) to get better image. But I'm totally lost with which filters to use, configurations in each one... I want a setting that should let me always get automatically corrected saturation/brightness/contrast output, without the need to change it for each anime. If source is ok, nothing changes, if it's lacking on saturation, boost it, the opposite should be true and same should be valid for any levels of the image. I want the REAL thing, like it's supposed to be. Could someone help me?
foxyshadis
27th July 2006, 07:15
If it's too grey:
Levels(16,1,240,0,255) -> corrects "TV" levels displayed as "PC"
If it's washed out and overexposed:
Levels(0,1,255,16,240) -> corrects "PC" levels displayed as "TV"
Make sure you apply them to chroma and not just luma. Avisynth also has ColorYUV(levels="TV->PC") and ColorYUV(levels="PC->TV"), which are slightly more accurate but in practice the levels is good enough. (Especially if you need to tweak it to not be so strong.)
By switching drivers, output colorspace, or rendering engine (overay is usually "TV" colors, VMR9 used to usually be PC but on Nvidia it's now TV), you can often change the behavior and get correct results without releveling. Until you play something encoded the other way. It's real pain.
Kurth
27th July 2006, 20:58
http://img236.imageshack.us/img236/25/originalrp7.jpg
Original Picture
http://img70.imageshack.us/img70/7601/tvpcoo2.jpg
Using ColorYUV(levels="TV->PC")
http://img233.imageshack.us/img233/8180/levelsga8.jpg
Using Levels(16,1,240,0,255)
http://img233.imageshack.us/img233/5174/pctvwa6.jpg
Using ColorYUV(levels="PC->TV")
http://img233.imageshack.us/img233/543/levels2to5.jpg
Using Levels(0,1,255,16,240)
Nice commands foxyshadis ^_^
Levels(16,1,240,0,255) give the life back to the picture xD
Weltall
29th July 2006, 18:05
Thanks!! You've really helped me! See, is this right?
http://xs304.xs.to/xs304/06306/hum.jpg
Anyway, neither ffdshow level filter nor avisynth tvtopc correction are automatic, is this right? I'll always have to find out by myself in each anime? This settings are being really usefeul to me, but I wanted to know if there's is some kind of definitive, totally automatic filter. And, I've corrected brightness and contrast with that but, what about correct saturation? The other filters in ffdshow, like picture properties, aren't them useful for what I want?
Some corrected images with ffdshow level filter:
http://xs304.xs.to/xs304/06306/eita.jpg
http://xs304.xs.to/xs304/06306/bleach.jpg
Revgen
29th July 2006, 19:51
I'd suggest you purchase CoreAVC instead. The colors are shown more correctly
Weltall
29th July 2006, 20:32
I didn't understand... I'm not worried about decoding, but encoding instead. I just want corrected output. Btw, I use CoreAVC already.
foxyshadis
30th July 2006, 00:54
Revgen, you still have to switch between corrected and uncorrected output mode manually with coreavc ("fix VMR9 color range") depending how your card & drivers, so I don't see how that applies.
Weltall, the histogram in ffdshow's levels is your best bet; while something plays you can easily spot full range or TV range. Unfortunately there's no filter that automatically fixes the range, but it's something I've had on my to-do list recently. An auto-white plugin will help, but it'll change other parts too.
Weltall
31st July 2006, 05:07
So I don't need to use any other ffdshow filters than "Levels" to get corrected output?
I was wondering about picture properties, for example, because Leves settings just correct brightness and contrast. If I change saturation in picture properties I won't have real saturation?
Either, is Levels settings in that screenshot I've posted here corrects? I didn't understand that "Levels(16,1,240,0,255)" well. Is that right then?
foxyshadis
31st July 2006, 06:18
Well, changing the levels to 16/1/240 will correct it to display as encoded (it affects the brightness and color, unless you check luma only), but if it needs more fiddling because it has other color/brightness/contrast problems, then sure, make all the changes you need.
Levels(16,1,240,0,255) is the avisynth way (wasn't sure what you were using), and your screenshot is the correct translation.
I do browse these forums often, no need to notify me. ;)
Weltall
31st July 2006, 07:10
Ok sorry :o
And thank you for everything, I think I can encode video in peace now :)
Btw, do you know about Replaygain normalization method? I think it's better than simple normalization (I think avisynth use this), but neither realanime 5 nor xanime use it. Both accept directshow processing. Do you know how can I get replaygained sound in the converted output through ffdshow or some other method?
foxyshadis
31st July 2006, 08:30
If you create the audio yourself, through belight, you can specify replaygain parameters and mux it in after the video's done encoding. (You'll have to disable their internal audio encoding and calculate the bitrate manually, if they support it; I'm more familiar with megui's.) FFDshow, mplayer, and mpc's internal decoder should support them, but I can't say for sure.
Weltall
31st July 2006, 22:28
How can I do this with belight? I didn't find it.
Sirber said he could add replaygain to realanime if I find how, but I didn't lol
Do you know how?
About your opinion, it's worthy to use replaygain for movies/animes, or it's only useful for music? I'm not sure about this, cause I've read in some post someone wrote DSPGuru said it isn't good, but I didn't find why.
DarkZell666
1st August 2006, 11:50
MSU offers a vdub filter for automatic color correcting.
I suggest you give it a try :)
> infos here < (http://www.compression.ru/video/color_enhancement/index_en.html)
foxyshadis
1st August 2006, 13:28
Oh, I just remembered, in belight it's called "postgain". I believe mode hybridgain also enables replaygain in vorbis. (It uses replaygain on codecs that support it and hard gain on those that don't.) You can apply your favorite dynamic compression there too.
I honestly have no experience with replaygain personally, you could ask the audio forum or hydrogenaudio what typical movie soundtracks are like. (Though I imagine they benefit more from compression than gain.)
Weltall
2nd August 2006, 23:32
Ok then, I'll try to ask there. Thank you!
@DarkZell666
I don't use virtualdub.
DarkZell666
7th August 2006, 13:26
@DarkZell666
I don't use virtualdub.
Vdub filters can be used in AVS scripts you know :)
A quick guide to doing so is lying somewhere in the forum (Avisynth subforum most probably :))
digitalone
25th January 2007, 16:20
i am facing similar problem guys. the video encoded with staxrip(x264) is darker compared to nero. the parameters i used with them are mentioned below.
1. StaxRip (x264)
--pass 2 --bitrate 781 --stats "C:\Temp\Temporary Files\Chapter 4.stats" --ref 10 --bframes 3
--b-pyramid --weightb --b-rdo --bime --direct auto
--filter -2:0 --analyse all --8x8dct --no-fast-pskip
--subme 7 --me umh --trellis 2 --mixed-refs --progress --threads auto --no-psnr
--output "C:\Temp\Chapter 4_EncoderOutput.264" "C:\Temp\Chapter 4.avs"
2. Nero Recode
Profile: Standard AVC
Rate Control: High Quality Encoding (2-Pass)
Decision Quality: Best
Motion Vector: -32 to 31.75
Max. Ref Frames: 10
Max GOP Size: 300
Max B-Frames: 3
Encoding Results:
Original Video:
http://maxupload.com/thumb/A5B6221F.jpg (http://maxupload.com/img/A5B6221F.jpg)
Nero Recode:
http://maxupload.com/thumb/3FDFD4CB.jpg (http://maxupload.com/img/3FDFD4CB.jpg)
StaxRip (x264):
http://maxupload.com/thumb/25DC5304.jpg (http://maxupload.com/img/25DC5304.jpg)
i tried the solution ColorYUV(levels="TV->PC") provided by foxyshadis in this thread but the result didn't get any better. i want to have better result with staxrip as it provides lots of settings to customize compared to recode. Can anyone please help me?
DarkZell666
25th January 2007, 16:32
It would have been easier to compare if you managed to capture the same frame on all 3 videos.
Also, the encoding settings from nero & x264 aren't relevant. Rather post the avs script StaxRip has generated (or yours if you did it yourself).
Edit: Using ColorYUV(levels="TV->PC") actually makes the picture darker, to make it brighter it's the opposite: ColorYUV(levels="PC->TV")
digitalone
25th January 2007, 20:39
I'll try to get the SS again. here is the avisynth script StaxRip generated...
AviSynth Script:
MPEG2Source("C:\Temp\Chapter 4.d2v")
Crop(0,102,-4,-110)
BicubicResize(704,288,0,0.5)
ColorYUV("TV->PC")
Additional Info from .d2v file:
Stream_Type=1
MPEG_Type=2
iDCT_Algorithm=2
YUVRGB_Scale=1
Luminance_Filter=0,0
Clipping=0,0,0,0
Aspect_Ratio=4:3
Picture_Size=720x480
Field_Operation=1
Frame_Rate=23976 (24000/1001)
Location=0,0,0,1BE92
i'll try the opposite way. do let me know if you have more suggestions. thx mate.
digitalone
26th January 2007, 17:32
@DZ666: here's one more attempt from me mate. the video has got brighter(using ColorYUV(levels="PC->TV") but with somewat color loss. sharpness is less too. i guess sharpness issue can be solved if i use Resize(Sharp) parameter. but on the whole the video doesn't look as lively as nero recode. appropriate contrast/saturation needs to be set.
Encoding Results:
Original Video:
http://maxupload.com/thumb/F4F6C6CC.jpg (http://maxupload.com/img/F4F6C6CC.jpg)
StaxRip:
http://maxupload.com/thumb/BE465669.jpg (http://maxupload.com/img/BE465669.jpg)
Nero Recode:
http://maxupload.com/thumb/FB13E7E1.jpg (http://maxupload.com/img/FB13E7E1.jpg)
if you want i can post StaxRip log. thx for ur help mate.
DarkZell666
27th January 2007, 19:29
Actually in the first set of screenshots you posted, I find nero completely oversaturated the colors, and that StaxRip (via x264) produced something much closer to the original.
In the second set of screenshots, the x264 version indeed looks a bit washed out, but that's the effect of ColorYUV(levels="PC->TV"), so I believe removing it would have produced something closer to the original again :)
Weltall
31st March 2007, 22:42
I think nero's is better. Try to use Megui with newer avisynth. Megui is always updated, and I have a hard time using Staxrip. Nevermind if you already tried it.
ColorYUV(levels="TV->PC") makes the picture more colored and darker, but it takes rid of the gray tone. PC->TV makes the opposite, since PC colors are more vivid than TV's and doesn't have that.
Actually, I use ffdshow level correction, but insted original mode I use Didee's YlevelsS, so the picture didn't get darker in "darker areas" (like original does), but the picture gets more vivid and without the gray tone of death. By the way, this should be used for badly produced videos only, when you notice that. For videos that have the right colors, where white is actually white, not gray, you just should encode without any color conversion or brightness/contrast correction filters, this will give you the best results :)
Foxyshadis has "enlightened" me
chros
3rd September 2007, 12:13
@Foxyshadis: any proggess in this?
I've got the same problem with Apple's trailers, when I reencode them (1080p) into 720p :(
(ffdshow's auto-levels is working badly, and resetting the levels for each 2 mins trailer is very painly ... :( )
eg: http://images.apple.com/movies/wb/10000_bc/10000_bc-tlr1_h1080p.mov
graph: Haali's media splitter -> ffdshow h264 decoder
avs script:
DirectShowSource("1080p.mp4", audio=false, fps=23.976)
Levels(9, 1, 237, 0, 255, coring=false)
LanczosResize(1280,544)
Histogram("levels")
Info()
ref. black: frame 202
ref. white: frame 811
Histogram("levels") for the visual graph (like in ffdshow).
If you comment/uncomment the Levels function, you can see the result ...
So we need a function/plugin, which:
- scan through the whole (!!!) clip, and look for the smallest and largest numbers of luma
- then it modifies the Levels function according to this values
Thanks
Sagekilla
3rd September 2007, 18:12
I love you foxy... Thank you so much, I've been trying to fix that problem for ages! That simple ColorYUV tweak practically got rid of ALL the blocking problems in dark areas I've been getting, plus coloration on all my movies looks perfect.
foxyshadis
3rd September 2007, 18:57
@Foxyshadis: any proggess in this?
I've got the same problem with Apple's trailers, when I reencode them (1080p) into 720p :(
(ffdshow's auto-levels is working badly, and resetting the levels for each 2 mins trailer is very painly ... :( )
eg: http://images.apple.com/movies/wb/10000_bc/10000_bc-tlr1_h1080p.mov
graph: Haali's media splitter -> ffdshow h264 decoder
avs script:
DirectShowSource("1080p.mp4", audio=false, fps=23.976)
Levels(9, 1, 237, 0, 255, coring=false)
LanczosResize(1280,544)
Histogram("levels")
Info()
ref. black: frame 202
ref. white: frame 811
Histogram("levels") for the visual graph (like in ffdshow).
If you comment/uncomment the Levels function, you can see the result ...
So we need a function/plugin, which:
- scan through the whole (!!!) clip, and look for the smallest and largest numbers of luma
- then it modifies the Levels function according to this values
Thanks
If you just want largest and smallest, the whole clip isn't needed. There isn't really that much variation compared to 1% or even 0.1%. But that won't work, since dct scrambles the pixels enough that you'll get much higher or lower absolutes than you want displaying. I haven't figured out a better way than lowest average frame luma or some threshold of pixel values. I don't really have much time for plugin hacking these days.
Hmm, I wonder if this could be combined with the autocrop function.
chros
4th September 2007, 08:27
But that won't work, since dct scrambles the pixels enough that you'll get much higher or lower absolutes than you want displaying. I haven't figured out a better way than lowest average frame luma or some threshold of pixel values.
Sorry, I can't understand this ... :(
DarkZell666
4th September 2007, 14:32
I means that if you have a very dark grey area at brightness level 20, once encoded+decoded, you'll end up with some pixels that are darker than 20 and others that are brighter. Your constant 20-brightness area will end up like some 10-to-30-brightness "dithered" area, which stops the levels detection from working properly.
Your clip won't be as visually optimized as you would want it to be because of those "invisible" brightness glitches.
kabal223
31st January 2010, 15:43
I want a setting that should let me always get automatically corrected saturation/brightness/contrast output, without the need to change it for each anime.
Sorry for this monstrous BUMP, but I want to know if this feature was implemented in ffdshow or if someone did a avisynth filter...
Thanks!
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.