View Full Version : 2 types of Brightness!?
mantis2k
23rd February 2010, 11:50
I got a movie with white subtitles on a white background, which I cannot see. Let's say I were to use TMPGEnc Advanced Colour Correction to try:
*Brightness
*Contrast
*Gamma
*Hue
*RGB/YUV adjust
*Saturation
AviSynth Filters:
*Denoise
*Chroma fixes
*Sharpen
*you name it
Seemingly, nothing will improve the quality!
However, an internal VirtualDub filter contains a different kind of Brightness control that solves the problem! It miraculously reveals the white subtitles hidden among the white background and all the glare.
How can I adjust "Linear Brightness" in AviSynth???
hanfrunz
23rd February 2010, 12:09
Can you give us a sample please?
Didée
23rd February 2010, 13:04
I reckon the video is 16-235 TV scale, and the subtitles are Y>235 (255, eventually). Various Avisynth filters per default will clamp the result to 16-235, so you lose any overbrights that may have been.
Try "levels(200,1.0,255,0,255,coring=false)" just to check if it makes something visible.
Also, in case that a YUV->RGB conversion is involved (though better not...), try matrix="PC.601".
mantis2k
23rd February 2010, 20:40
Try "levels(200,1.0,255,0,255,coring=false)" just to check if it makes something visible.
All the colours go funny and look inverted, but it does reveal information. Would be good if I was looking to remaster the subs as optional, but I am simply looking to improve the visibility of the embedded subs.
Also, in case that a YUV->RGB conversion is involved (though better not...), try matrix="PC.601".
That worked without affecting the brightness too much, but can't use it with ColorYUV(autogain=true), which is my main filter for colour correction.
mantis2k
23rd February 2010, 20:46
Original
http://www.rarekungfumovies.com/ms1.jpg
ConvertToRGB(matrix="PC.601") "boiling" now visible!
http://www.rarekungfumovies.com/ms2.jpg
ConvertToRGB(matrix="PC.601") and ColorYUV(autogain=true, autowhite=true) no good!
http://www.rarekungfumovies.com/ms3.jpg
Didée
23rd February 2010, 21:00
My levels suggestion was not meant as a solution. I was merely showing you the main cause of your Avisynth problem: clamping of values.
However, an internal VirtualDub filter contains a different kind of Brightness control that solves the problem! It miraculously reveals the white subtitles hidden among the white background and all the glare.
What internal filter, with what settings? And please, an example of that spectacular result?
Because, from the filters that "my" VirtualDub has, there is no filter that does the magic you're describing...
mantis2k
23rd February 2010, 21:08
Original
http://www.rarekungfumovies.com/ms1.jpg
VirtualDub filter
http://www.rarekungfumovies.com/ms4.jpg
All the other Brightness filters I've come across do not reduce the bright shiny whites!
Didée
23rd February 2010, 22:27
Oh, THAT filter? Voodoo!
Vdub's brightness/contrast filter is just a linear scaler. No magic involved.
VirtualDub Brightness:
http://img521.imageshack.us/img521/8618/virtualdubbrightness.th.jpg (http://img521.imageshack.us/i/virtualdubbrightness.jpg/)
Avisynth Levels: (in RGB space, to be comparable with Vdub)
http://img91.imageshack.us/img91/4987/avisynthlevels.th.jpg (http://img91.imageshack.us/i/avisynthlevels.jpg/)
Give or take a notch, both are the same.
mantis2k
23rd February 2010, 22:40
Right! I just figured out how to use the levels filter properly just before you posted that.
Emulgator
23rd February 2010, 23:27
BTW, AdjustY gives you the opportunity to have an arbitrary Y-transfer function.
Maybe you can fold the bright letters back to grey or whatever is readable.
mantis2k
23rd February 2010, 23:32
BTW, AdjustY gives you the opportunity to have an arbitrary Y-transfer function.
Maybe you can fold the bright letters back to grey or whatever is readable.
Please can you post an example line of code that uses this function?
Emulgator
24th February 2010, 00:58
adjustY("spline(Y, 0, 0, 200, 200, 201, 0, 255, 0, false)", false)
This would clip everything above Y=200 to ultrablack Y=0.
Works nicely here on the usual overexposed clip.
For your subs you may try
adjustY("spline(Y, 0, 0, 200, 200, 201, 120, 255, 120, false)", false)
Modify the 200 until you catch only the subs.
Modify the 120 to determine the shade of grey they should appear in.
Of course this will only work if the subs stay the brightest part in the picture.
If sky gets brighter, well, then it would take a mask for the subpic area
and some hope that it won't get brighter there...
The first "false" decides to make linear sections, if "true" -> cubic splines.
The last "false" decides if frame numbers (N) are needed as part of the calculation.
We don't need these here.
"Y" makes all Y pixel sample values as input variable.
The following pairs are x,y values that describe the spline.
So 0,0 -> 200,200 Y will be linear, from 201 -> 255 Y will be clamped to 120.
Or you force the subs to ultrablack Y=0 and assign a colour like yellow to this value.
It takes adjust.dll from warpenterprises server.
mantis2k
24th February 2010, 01:05
damn, I'm getting an error message: "planar formats not supported!"
mantis2k
24th February 2010, 01:16
Got the right color mode, but found it to not be very useful. Thanks anyway; I appreciate your efforts. So far, the best script for seeing the subs is:
Levels(0, 1, 255,0, 150, coring=false)
Didée
24th February 2010, 01:27
Most probably, that ain't work out. The actual content is not only overbright, it even is clipped at Y=255 (see histogram, Y=255 is overpopulated). And just in the three small samples that were posted, there's quite some fullbright content crossing the subtitle area. Trying to do brigthness-masking the subtitles, you're crying for artifacts.
Little joe visits the veterinarian, holding a roast chicken in his hand: "Doctor, is there any hope?"
mantis2k
24th February 2010, 08:06
Trying to do brigthness-masking the subtitles, you're crying for artifacts.
Is there a more advanced technique I can use? I don't mind artifacts, as the movie was captured full frame, so has a bit of resolution to play around with and could be smoothed down.
mantis2k
24th February 2010, 08:49
#Input source
mpeg2source("c:\clip.d2v") #,cpu=4)
#Deinterlace: Field Blended to Progressive (25 fps)
Restore24(r24fps=25.000,numr=3125,deno=6250,useLL=true,stringuent=false,fulltriples=false,r24deint=1,fra=1,frr=1,edgetype=0,edgemode=2,edgeeval=2,r24size=.75,r24ysize=0.75,nr=-5,ldmp=32.0,debug=0)
#Remove noise
ConvertToYUY2()
PixieDust(5)
ConvertToYV12()
#Auto color correction
ColorYUV(autogain=true, autowhite=true)
#scales a [0,255] clip to [16,235]:
Levels(0, 1, 255,0, 175, coring=false)
#Sharpen picture
MSharpen()
#Crop away side borders and junk
crop(60,0,-50,-0)
#Resize and add borders for 2.40:1 (16:9)
BilinearResize(720,426)
addborders(0,75,0,75)
Download Sample A... (http://www.rarekungfumovies.com/a.mpg)
http://www.rarekungfumovies.com/sc1.jpg
Is anyone able to provide a better script to improve the brightness and colour any better?
Download Sample B... (http://www.rarekungfumovies.com/b.mpg)
http://www.rarekungfumovies.com/sc2.jpg
Is anyone able to get this line to show up using any brightness-masking technique that you are aware of?
Didée
24th February 2010, 08:53
Browse the movie, decipher the subs, write them down, then use SRT or ASS soft subtitling.
mantis2k
24th February 2010, 09:00
Didée, if I had more time then that would be a good idea, but as it stands I could really do with a decent script that--not only improves visibility of the white embedded subs--but also improves the general overbrightness of the video frames.
Emulgator
24th February 2010, 09:08
If you could upload a sample somewhere, I would be willing to play with it,
(I am still waiting for my hoster to find my already ordered 20GB Webspace for ftp.)
mantis2k
24th February 2010, 12:02
If you could upload a sample somewhere, I would be willing to play with it,
(I am still waiting for my hoster to find my already ordered 20GB Webspace for ftp.)
Thanks! I've linked the samples above; just in case, here they are again:
Download Sample A... (http://www.rarekungfumovies.com/a.mpg)
Download Sample B... (http://www.rarekungfumovies.com/b.mpg)
Emulgator
24th February 2010, 16:30
Ah, in between the screenshots..
BTW, all 4 links point to the same file "a.mpg"
Edit: No, I just checked the file , I can't get my foot in the door.
Late Edit: I got my foot in, couldn't believe it..
Histogram shows it nicely.
All is at the ceiling. At Y= 254, still parts of the sky and shirt top the subs.
Levels PC->TV dos not help, shifts the point to 234.
And 1 step is too narrow for my approach anyway.
Exposure fluctuates more than 5 steps.
Didée was right, the chicken is dead.
Retyping and maybe delogo...
mantis2k
24th February 2010, 17:39
Thanks for checking! Do the histograms indicate the possibility of improvement? I've never understood how to read histograms or how they can help with any solutions. I am a complete amateur, but have managed to improve the subs and color to some extent, so I don't believe the chicken is dead yet--let's say his head is still shaking! :) I realise not much can be done with such a poor source, but even so, with the experience some of you guys have out there, I'm sure somebody could come up with something a bit better than my pathetic attempt at a script. I desperately need help on this one and am prepared to offer a cash reward just for advise regarding a general clean up based on reference clips etc.
Note: edited links so both clips work now.
Emulgator
24th February 2010, 17:41
For watching try
adjustY("spline(Y, 0, 15, 16, 16, 235, 225, 240, 230, 255, 235, true)", false)
This uses cubic splines and can be watched a bit better.
Not good enough for real subtitle separation, but improves readability a bit
and may help to fit all PC scale sources softly into TV scale without clipping.
To fix this footage is quite a...challenge.
separatefields exhibits vertically blurred fields roughly every other field.
But not only odd or even... Besides of some IVTC: followed by TGMC restoration, then colour correction, scratch removal, sharpening, dehaloing...
mantis2k
24th February 2010, 17:49
For watching try
adjustY("spline(Y, 0, 15, 16, 16, 235, 225, 240, 230, 255, 235, true)", false)
Thanks again. I'll try that as soon as I get home.
separatefields exhibits vertically blurred fields roughly every other field.
Yeah, deinterlacing is quite tough. I was wondering if that function could help in other ways, but am out of my depth.
But not only odd or even... Besides of some IVTC: followed by TGMC restoration, then colour correction, scratch removal, sharpening, dehaloing...
I don't even know if I'm using the right filters for those functions and in the right order. I would love to know more about alternative color correction techniques suitable for a source so overbright and red. Increasing saturation seems to make it worse.
Emulgator
24th February 2010, 17:49
mantis, I sent you a PM.
StainlessS
26th February 2010, 21:42
ColorYUV(autowhite=true,autogain=true,cont_u=100,cont_v=0,levels="PC->TV")
Note cont_v=0
done this from memory, dont have clip anymore.
also try cont_u=110 and 120. :)
EDIT:- Just to correct color, not make subs visible.
Also, might wanna play with ColorYUV2() where I implemented
chroma gamma, just about to place it in Avisynth Usage sticky
section. Dated Today
mantis2k
26th February 2010, 22:51
ColorYUV(autowhite=true,autogain=true,cont_u=100,cont_v=0,levels="PC->TV")
Note cont_v=0
done this from memory, dont have clip anymore.
also try cont_u=110 and 120. :)
EDIT:- Just to correct color, not make subs visible.
Also, might wanna play with ColorYUV2() where I implemented
chroma gamma, just about to place it in Avisynth Usage sticky
section. Dated Today
:thanks: That's the best solution so far in terms of color correction! Using levels at the start also solves the subs problem, but maybe I can fiddle this further. With such perfect colour correction I might be able to increase the saturation without bringing that nasty red back, so here comes test #347.... will this movie ever be ready? :)
Emulgator
27th February 2010, 08:18
mantis, a first approach is on my ftp in 20 mins.
All subs are readable again, colours are a bit restored, but not fully there yet.
If I had more time, this movie can be surely saved.
I did not do any manual IVTC yet, so you have some frames that are sharp
and some that are blurred due to the changing long pattern.
But you get the idea, I hope.
http://www.dvd-manufactur.de/files/A-1.jpg
http://www.dvd-manufactur.de/files/B-2.jpg
http://www.dvd-manufactur.de/files/C-2.jpg
http://www.dvd-manufactur.de/files/C-3.jpg
http://www.dvd-manufactur.de/files/C-4.jpg
http://www.dvd-manufactur.de/files/D-1.jpg
http://www.dvd-manufactur.de/files/E-1.jpg
mantis2k
27th February 2010, 09:01
mantis, a first approach is on my ftp in 20 mins.
All subs are readable again, colours are a bit restored, but not fully there yet.
If I had more time, this movie can be surely saved.
I did not do any manual IVTC yet, so you have some frames that are sharp
and some that are blurred due to the changing long pattern.
But you get the idea, I hope.
Thanks! I look forward to checking it out... I am reaching the end of my lousy attempt, but have learnt a lot in 1-2 weeks mainly thanks to Stainlesss. I just need to fiddle around with the gamma/chroma (new feature in ColorYUV2) then we can see how close I get to your solution. More important than the color correction is the deinterlacing. There's nothing else that works other than modified restore24, so even if the color correction is nice, the progressive motion also needs to be smooth.
Emulgator
27th February 2010, 09:18
Now the screenshots are there in my post #29.
mantis2k
27th February 2010, 09:55
http://www.rarekungfumovies.com/subs.jpg
http://www.dvd-manufactur.de/files/A-1.PNG
It seems you've managed to bring out the subs a lot better! Well done!! I would be interested to see how the following frames look after your treatment:
http://www.rarekungfumovies.com/subs2.jpg
mantis2k
27th February 2010, 11:33
Emulgator, thanks for sending the script--superb effort tweaking that adjust/spline function!!!!! Incredible results... I was able to reveal the subs without darkening the picture and losing colour information. Top man!
Emulgator
27th February 2010, 12:07
Glad to help !
http://www.dvd-manufactur.de/files/MF-B-2.jpg
http://www.dvd-manufactur.de/files/MF-C-2.jpg
mantis2k
27th February 2010, 17:58
OK, I think I'm done with this project now unless I decide to put it through one of those SSSSLLLLOOOOOOOOWWWWWW denoisers... Thanks again for all your help!
http://www.rarekungfumovies.com/17178a.jpg
http://www.rarekungfumovies.com/17178b.jpg
http://www.rarekungfumovies.com/32931a.jpg
http://www.rarekungfumovies.com/32931b.jpg
http://www.rarekungfumovies.com/3319a.jpg
http://www.rarekungfumovies.com/3319b.jpg
http://www.rarekungfumovies.com/65065a.jpg
http://www.rarekungfumovies.com/65065b.jpg
http://www.rarekungfumovies.com/65186a.jpg
http://www.rarekungfumovies.com/65186b.jpg
http://www.rarekungfumovies.com/67109a.jpg
http://www.rarekungfumovies.com/67109b.jpg
http://www.rarekungfumovies.com/70094a.jpg
http://www.rarekungfumovies.com/70094b.jpg
http://www.rarekungfumovies.com/8265a.jpg
http://www.rarekungfumovies.com/8265b.jpg
http://www.rarekungfumovies.com/89177a.jpg
http://www.rarekungfumovies.com/89177b.jpg
http://www.rarekungfumovies.com/94886a.jpg
http://www.rarekungfumovies.com/94886b.jpg
Who Am I ?
28th February 2010, 18:18
Ok, so I haven't read any post in the thread , in a bit of a hurry but I've worked with lots of such sources and AFAIK colormill.vdf always gives you the better results, can't explain in detail right now but give it a shot ( google for it, need rgb input and works fine with virtualdubmod )
addborders(0,170,0,170)
lanczos4resize(1024,576)
is all I did with colormill, Frame 264 of sample 1
http://i46.tinypic.com/2rejgra.png
http://i47.tinypic.com/1692nhy.png
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.