Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 27th October 2012, 04:42   #1  |  Link
B3-bomber
Registered User
 
Join Date: Oct 2008
Posts: 16
Help me adjust brightness for a dark video source

preferably without screwing up the other colors. i am not sure what type of brightening would work best. i can PM details about what source and other things i notice with it (like default driver brightness makes it appear fine, while washing out colors on EVERYTHING else on my system, YAY).
B3-bomber is offline   Reply With Quote
Old 27th October 2012, 12:57   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
You are not going to get much help without posting a ~30MB sample, use eg DGIndex to cut VOB and up to MediaFire.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 27th October 2012 at 13:24.
StainlessS is offline   Reply With Quote
Old 27th October 2012, 12:59   #3  |  Link
Mounir
Registered User
 
Join Date: Nov 2006
Posts: 773
try this filter: http://strony.aster.pl/paviko/hdragc.htm
Mounir is offline   Reply With Quote
Old 27th October 2012, 13:04   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
To do an optional Auto Crop with auto levels

Code:
Function RoboLevels(clip c,float "Strength",int "Samples",float "Ignore",Bool "QBC",Float "QBC_Thresh",int "X",int "Y",int "W",int "H", \
	int "Matrix",bool "PC",bool "DEBUG") {
	c
	Frames=FrameCount
	Strength=Float(Default(Strength,1.0))
	Samples=(!Defined(Samples)) ? 24 : (Samples > Frames) ? Frames : (Samples < 1) ? 1 : Samples
	Ignore=Float(Default(Ignore,0.2))
	QBC=Default(QBC,True)
	QBC_Thresh=Float(Default(QBC_Thresh,-32.0))
	QBCropXP = Default(X,0)
	QBCropYP = Default(Y,0)
	QBCropWP = Default(W,0)
	QBCropHP = Default(H,0)
	Matrix = Default(Matrix,(width <= 720) ? 2 : 3)	
	PC=Default(PC,False)
	DEBUG=Default(DEBUG,True)
	Assert(Strength>0.0 && Strength <=1.0, "RoboLevels: 0.0 < Strength <= 1.0")
	GScript("""
		if(QBC) {
			QBCS=QueryBorderCrop(samples=Samples,thresh=QBC_Thresh,debug=DEBUG,ignore=Ignore,matrix=Matrix)
			(DEBUG)? RT_Debug(QBCS): NOP
			Eval(QBCS)
		}
		tclip=c.Crop(QBCropXP,QBCropYP,QBCropWP,QBCropHP)
		QLMMS=QueryLumaMinMax(tclip,samples=Samples,ignore=Ignore,debug=DEBUG,matrix=Matrix)
		(DEBUG)?RT_Debug(QLMMS):NOP
		Eval(QLMMS)
		if(IsRGB() || PC) {
			CSMin = 0
			CSMax = 255
		} else {		
			CSMin = 16
			CSMax = 235
		}
		ALMin = Int(CSMin - ((CSMin - QLMMMin) * Strength) + 0.5)	# Round Up
		ALMax = Int(CSMax - ((CSMax - QLMMMax) * Strength))       # Round down
		(QBC) ? Crop(QBCropXM,QBCropYM,QBCropWM,QBCropHM): NOP
		Levels(ALMin,1.0,ALMax,CSMin,CSMax,Coring=False) # DO NOT use Coring 		
	""")
	return Last
}
You also need the two scripts from 3 consecutive posts here (and RT_Stats plugin from 1st post in that thread,
both the scripts pointed to are contained in RT_Stats zip):
http://forum.doom9.org/showthread.ph...57#post1586857

EDIT: Also need GScript.
QBC controls optional cropping, others can default. If no borders present then just simple "Robolevels()" will work fine.
Above script is work in progess but works fine.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 27th October 2012 at 13:26.
StainlessS is offline   Reply With Quote
Old 27th October 2012, 17:46   #5  |  Link
travolter
Registered User
 
Join Date: Apr 2009
Posts: 138
I was testing RoboLevels in AVSP and its working pretty well .. but using it realtime the video become freezed and does not start.
I need to use extra line in my script to do it realtime into ffdshow?
travolter is offline   Reply With Quote
Old 27th October 2012, 18:42   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
@travolter,
You could try it with QBC=false to switch off cropping, and/or Debug=true, and see what comes out of DebugView.
As far as I'm concerned, if it works ok in AVSP then it should work ok in whatever player you are using.
(as far as I know, ffdshow is just a codec) What is the actual player you are using.
Perhaps the player is failing because of the long timeout until first frame delivered, then its a player fault.
You might reduce timeout by setting samples lower but this may affect how well it auto levels.
You could also skip robolevels (just a temp name, a testing script to develop a plugin) and test with
QueryBorderCrop() and QueryLumaMinMax() separately just to see what the player dont like.
Have you tried with Mplayer or any other player?
I (just a few days ago) did 60 test clips which all worked perfectly in GOM, Mplayer HC, and MS MPlayer2 (the old one, dont like new one).
If posting further on this, please do it in the RT_Stats thread so as not to clutter this one. Thankyou.
EDIT: Make sure you are using latest version of RT_Stats and scripts.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 27th October 2012 at 18:49.
StainlessS is offline   Reply With Quote
Old 27th October 2012, 23:12   #7  |  Link
B3-bomber
Registered User
 
Join Date: Oct 2008
Posts: 16
see new post

prefer that place since i can delete it later. can also auto expire.

Last edited by B3-bomber; 28th October 2012 at 03:15.
B3-bomber is offline   Reply With Quote
Old 27th October 2012, 23:45   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Sorry if I was unclear, those were only d2v files.

Load VOB into DGIndex,
move bottom slider to START of area of interest and then press '[' to set start.
move slider to END of area of interest and then press ']' to set end.

Then on file menu click on "Save Project & Demux Video", it will save with name ending ".demuxed.m2v".
Check file size is suitable and then repost.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 28th October 2012, 03:25   #9  |  Link
B3-bomber
Registered User
 
Join Date: Oct 2008
Posts: 16
http://www.sendspace.com/filegroup/iUGvV1drrxxBJQ26sf1l0HGq9HkKm4Ov

included d2v with the demuxed vid

side note: for sure source related. watching others on current settings dont need to change brightness to see dark areas.

Last edited by B3-bomber; 28th October 2012 at 03:26. Reason: adding info
B3-bomber is offline   Reply With Quote
Old 29th October 2012, 00:20   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Have looked at your source anime, and it looks like it is the intent of the makers that it be that dark
in places, looks like a coal cellar or something. It is I think unlikely that you can do anything other
than bring up lighting levels where everything will be almost solid grey rather than black,
and expose little detail, only noise.

Perhaps look at hdragc as Mournir suggested, any global leveling will fail (as for the supplied Robolevels).

Here are stats for your source clips and auto leveled (the crop fails on dark clip as it is nearly all black and so short,
ie crops out much of the video).

Code:
darkarea.demuxed.d2v
    AVE_Y=27.58  MIN_Y= 11  MAX_Y=236  LMIN_Y= 15  LMAX_Y=227
    AVE_U=128.09  MIN_U=110  MAX_U=152  LMIN_U=120  LMAX_U=145
    AVE_V=128.44  MIN_V=117  MAX_V=203  LMIN_V=121  LMAX_V=151

darkarea.demuxed.d2v Auto Leveled
    AVE_Y=34.29  MIN_Y= 16  MAX_Y=235  LMIN_Y= 16  LMAX_Y=235
    AVE_U=128.14  MIN_U=109  MAX_U=150  LMIN_U=119  LMAX_U=145
    AVE_V=128.66  MIN_V=116  MAX_V=207  LMIN_V=121  LMAX_V=156

lightarea.demuxed.d2v
    AVE_Y=66.54  MIN_Y= 13  MAX_Y=237  LMIN_Y= 16  LMAX_Y=234
    AVE_U=132.75  MIN_U=112  MAX_U=170  LMIN_U=118  LMAX_U=168
    AVE_V=123.93  MIN_V= 91  MAX_V=139  LMIN_V= 99  LMAX_V=136

lightarea.demuxed.d2v Auto Leveled
    AVE_Y=66.93  MIN_Y= 16  MAX_Y=235  LMIN_Y= 16  LMAX_Y=235
    AVE_U=132.75  MIN_U=112  MAX_U=170  LMIN_U=118  LMAX_U=168
    AVE_V=123.93  MIN_V= 91  MAX_V=139  LMIN_V= 99  LMAX_V=136
As you can see, MIN_Y and MAX_Y reasonably close to optimum anyway (although robolevels scan on full movie
would be be better than only on 10 to 20 seconds of clip).

EDIT: Global leveling (eg RoboLevels, on FULL movie) would not do any harm and may help just a little, but nothing spectacular would result
in the deliberately dark sections.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 29th October 2012 at 01:13.
StainlessS is offline   Reply With Quote
Old 29th October 2012, 03:02   #11  |  Link
B3-bomber
Registered User
 
Join Date: Oct 2008
Posts: 16
i know i wont get it fully lightened without breaking stuff. but the brightness setting that i have on my monitor that shows it as it was aired on TV is much too high for overall viewing. this also doesnt seem to affect the actual other scenes oddly enough (my guess is they just plain did the entire thing a tad too dark). there have been a lot of complaints about the non TV sources for this. so yeah it may be deliberate but there is still some censorship built in and i just want it to play as a mostly normal scene and not a big wall of black (some eps are basically 80% of the super darkened crap because of this).


p.s. why the hell wont quick reply work even when i fully refresh the page? it shows me as logged in still too. unless i go out of the thread and reload it through clicking the thread it blocks me. at least using the post button works.

also may i get a little more detailed info on what to do for the robot thing or is there something simpler? i could actually give an idea of the light levels needed to see the show as it was on TV if i had a way to figure out if out driver and monitors did the same level of lighting...

Last edited by B3-bomber; 29th October 2012 at 03:06.
B3-bomber is offline   Reply With Quote
Old 29th October 2012, 04:28   #12  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
You need RT_Stats and GScript,
RT_Stats: http://forum.doom9.org/showthread.php?t=165479
GScript: http://forum.doom9.org/showthread.ph...hlight=gscript

Also MS DebugView: http://technet.microsoft.com/en-us/s.../bb896647.aspx

Rough script:
Code:
VIDOEOFILE="D:\AVS\AVI\lightarea.demuxed.d2v"
MPEG2Source(VIDOEOFILE)

# Your source above,  
# RT_Stats & GScript plugins in avisynth plug dir and import below or put in plugs dir

Import ("D:\avs\BANK\QueryBorderCrop.avsi")
Import ("D:\avs\BANK\QueryLumaMinMAx.Avsi")

Robolevels(QBC=false,samples=24) # higher samples better, especially for your clip I think.
Return Last

Function RoboLevels(clip c,float "Strength",int "Samples",float "Ignore",Bool "QBC",Float "QBC_Thresh",int "X",int "Y",int "W",int "H", \
	int "Matrix",bool "PC",bool "DEBUG") {
	c
	Frames=FrameCount
	Strength=Float(Default(Strength,1.0))
	Samples=(!Defined(Samples)) ? 24 : (Samples > Frames) ? Frames : (Samples < 1) ? 1 : Samples
	Ignore=Float(Default(Ignore,0.2))
	QBC=Default(QBC,True)
	QBC_Thresh=Float(Default(QBC_Thresh,-32.0))
	QBCropXP = Default(X,0)
	QBCropYP = Default(Y,0)
	QBCropWP = Default(W,0)
	QBCropHP = Default(H,0)
	Matrix = Default(Matrix,(width <= 720) ? 2 : 3)	
	PC=Default(PC,False)
	DEBUG=Default(DEBUG,True)
	Assert(Strength>0.0 && Strength <=1.0, "RoboLevels: 0.0 < Strength <= 1.0")
	GScript("""
		if(QBC) {
			QBCS=QueryBorderCrop(samples=Samples,thresh=QBC_Thresh,debug=DEBUG,ignore=Ignore,matrix=Matrix)
			(DEBUG)? RT_Debug(QBCS): NOP
			Eval(QBCS)
		}
		tclip=c.Crop(QBCropXP,QBCropYP,QBCropWP,QBCropHP)
		QLMMS=QueryLumaMinMax(tclip,samples=Samples,ignore=Ignore,debug=DEBUG,matrix=Matrix)
		(DEBUG)?RT_Debug(QLMMS):NOP
		Eval(QLMMS)
		if(IsRGB() || PC) {
			CSMin = 0
			CSMax = 255
		} else {		
			CSMin = 16
			CSMax = 235
		}
		ALMin = Int(CSMin - ((CSMin - QLMMMin) * Strength) + 0.5)	# Round Up
		ALMax = Int(CSMax - ((CSMax - QLMMMax) * Strength))       # Round down
		(QBC) ? Crop(QBCropXM,QBCropYM,QBCropWM,QBCropHM): NOP
		(DEBUG)? RT_Debug("Levels("+String(ALMin)+",1.0,"+String(AlMax)+","+String(CSMin)+","+String(CSMax)+",Coring=False)"):NOP
		Levels(ALMin,1.0,ALMax,CSMin,CSMax,Coring=False) # DO NOT use Coring 		
	""")
	return Last
}
I've added the RT_Debug line near the end to show something like

Code:
Levels(16,1.0,233,16,235,Coring=False)
You need to run DebugView and then run the script and Debugview will capture output.
The imported scripts are included in RT_Stats zip.
EDIT: The samples=24, line is the default, might want to increase to as big as you can stand,
(only samples 24 frames by default, spread evenly throughout clip).

EDIT: Also see here: http://forum.doom9.org/showthread.ph...12#post1598112
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 29th October 2012 at 05:30.
StainlessS is offline   Reply With Quote
Old 29th October 2012, 08:36   #13  |  Link
B3-bomber
Registered User
 
Join Date: Oct 2008
Posts: 16
ok i still need help putting this stuff together. managed to get the 2 .zip, script had an issue at robotlevels line. if there is stuff that is supposed to be in a .avs in the plugins folder i need to know what the names are supposed to be and the contents.

warning: i have problems with complex avs scripts. at one point i tried animeIVTC script. i NEVER got all of that to function even with all the supposed required files.

also, what am i supposed to use to run this script? is it supposed to be in a .avs script and if yes what do i use to run it (got the errors in megui trying to preview the vid output) it didnt like this line either: MPEG2Source(VIDOEOFILE) says no function (yay for fresh installed avisynth and no plugins).
B3-bomber is offline   Reply With Quote
Old 29th October 2012, 10:51   #14  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by B3-bomber View Post
i could actually give an idea of the light levels needed to see the show as it was on TV ...
Maybe your TV set needs calibrating. It looks to me too like your sample is supposed to be very dark.
Quote:
also may i get a little more detailed info on what to do for the robot thing or is there something simpler?
There are lots of simpler filters to brighten things up. I often use YLevelsS:

http://avisynth.org/mediawiki/Ylevels

Or HDRAGC, as suggested earlier.
manono is offline   Reply With Quote
Old 29th October 2012, 15:20   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
VIDOEOFILE="D:\AVS\AVI\lightarea.demuxed.d2v" where the d2v file is the one output by DGIndex.

RT_Stats, Grunt and GScript dll's need be in plugins dir.
Also put the two script from RT_Stats zip either in plugs dir or Import them as in example, obviously edit the directory names.

Quote:
what am i supposed to use to run this script?
It looks like you do not use avisynth outside of eg MeGUI, use anything eg Mplayer to open script.

EDIT: Or see Manono's suggestions above
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 29th October 2012 at 15:25.
StainlessS is offline   Reply With Quote
Old 29th October 2012, 17:34   #16  |  Link
LemMotlow
Registered User
 
Join Date: Jul 2011
Location: Tennessee, USA
Posts: 266
d l t d

Last edited by LemMotlow; 1st March 2013 at 10:53.
LemMotlow is offline   Reply With Quote
Old 29th October 2012, 20:40   #17  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by LemMotlow View Post
Histograms of frames in the smples m2v's show the levels and colors are out of spec (darks compressed and crushed, brights off the wall).
There's nothing wrong with blacks being below 16 and whites above 235. Happens all the time. With :

LanczosResize(624,352)
ColorYUV(Analyze=True)
Limiter(Show="Luma")


you get the first picture below left from frame 199. The red dots show values below 16 (and barely below at that). Although it's quite dark, it's not really out of the ordinary for a really dark scene. The second picture below right is with:

YLevelsS(0,10.0,255,0,255)
Tweak(Bright=-14,Cont=0.93,Coring=False)
LanczosResize(624,352)
ColorYUV(Analyze=True)
Limiter(Show="Luma")


In neither of your two samples did I see any blown whites, although maybe they do blow out elsewhere.
Attached Images
  
manono is offline   Reply With Quote
Old 30th October 2012, 03:23   #18  |  Link
B3-bomber
Registered User
 
Join Date: Oct 2008
Posts: 16
i watched this on TV using CRT. it wasnt overly dark then. i can watch it that way on this screen but it requires setting brightness to default on drivers (value of 0). doing that washes out EVERYTHING (OS menus, background, any other program used) but the video when it comes to colors.

they did this to the released source as a double censor thing. they already have blurred details on entrails and other body parts.

manono that screenshot on 2nd part looks a lot more how it was supposed to be. i dont expect it to ever be perfect but those really dark scenes should at least resemble the "night" scenes in most anime where u can see some stuff, not be pitch freaking black like it essentially is now. i never had any problems with the maximum, just didnt wanna wash out color detail for normal scenes.

i'll mess with this a bit later tonight maybe if not tomorrow night. at least having something work properly would be awesome (errors are annoying).

side note: i can pm what to search for to prove the complaints about the video being too dark. it isnt just my screen. just ask if u need info.

Last edited by B3-bomber; 30th October 2012 at 03:45. Reason: adding info
B3-bomber is offline   Reply With Quote
Old 30th October 2012, 03:44   #19  |  Link
LemMotlow
Registered User
 
Join Date: Jul 2011
Location: Tennessee, USA
Posts: 266
d l t d

Last edited by LemMotlow; 1st March 2013 at 10:54.
LemMotlow is offline   Reply With Quote
Old 30th October 2012, 21:37   #20  |  Link
manono
Moderator
 
Join Date: Oct 2001
Location: Hawaii
Posts: 7,406
Quote:
Originally Posted by LemMotlow View Post
That tells me that detail isn't just "dark", it's compressed and crushed.
It doesn't tell me that at all. The parts of the picture in my earlier post that are below 16 are just pure black with nothing else there.

Quote:
The histogram for the original frame #39 in the "lightareas" sample showed brights smashing against the right wall of color histograms, with the brightest blues seriously clipped.
I see none of that. Have a look at the three pictures below, two with different kinds of histograms, the third using my earlier script. The only parts above 235 (the green dots) are the shiny metal of the bridge, there's very little of that, and it's completely normal. All this makes me wonder just how you're making your conversion to RGB in the first place. And why convert at all?
Attached Images
   

Last edited by manono; 30th October 2012 at 21:43.
manono is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:23.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.