Log in

View Full Version : deflicker for 10 bit source?


BabaG
8th December 2022, 21:33
i have a script that uses the deflicker plugin but am getting an error that it only supports 8 bit sources. my sources are 10 bit. for the the tests i made in coming up with the script i must have used 8 bit and not thought about it. is there an alternative to 'deflicker' that will accept 10 bit? workaround?

thanks,
babag

coolgit
8th December 2022, 21:57
Convert to 8 bits then use deflicker then back to 10 bits.

kedautinh12
8th December 2022, 22:47
Can you share your deflicker script?? i will findout if it have newer ver (maybe)

BabaG
8th December 2022, 23:21
here's the relevant part:import("/home/babag/.wine/drive_c/Program Files (x86)/AviSynth+/plugins+/RemoveDirt.avs")
import("/home/babag/.wine/drive_c/Program Files (x86)/AviSynth+/plugins+/RemoveDirtMC.avs")

AddAutoloadDir("C:\users\babag\Downloads\Video\AVISynth\AVISynth\Tests",toFront=true) # Load additional scripts and filters

FFMPEGSource2("source_file_2880x2160p_DNxHR_444_12bit_23976fps.mov", atrack=1)
#ConvertToYV12(matrix="rec709")
z_ConvertFormat(pixel_type="YUV420P16")

Crop(240,0,-240,-0)

BilinearResize(width/2, height/2)

Deflicker() # Mainly for use on hand developed film. Only supports 8 bit.

because of the source material, digitized hand-developed 16mm film that was shot and processed many years after its expiration date, it's a bit of an odd script. i can post more if necessary but this gets us up to the error at the deflicker plugin. the deflicker plugin is version: Deflicker-v0.6.7z

the line:

ConvertToYV12(matrix="rec709")

was used when testing with 8bit files.

the line:

z_ConvertFormat(pixel_type="YUV420P16")

is something i was recommended to use to preserve 10 bit sources.

thanks,
babag

Reel.Deel
8th December 2022, 23:39
Deflicker does not support >8bit. Pinterf added support for other planar colorspaces (Y, YV16,YV24) and x64 but no HBD. One alternative is http://avisynth.nl/index.php/ReduceFlicker - it supports >8bit.

FranceBB
8th December 2022, 23:48
+1 for reduceflicker()

Honestly,


ReduceFlicker(strength=3, aggressive=true)


is probably everything you need

BabaG
8th December 2022, 23:58
thanks for the 'ReduceFlicker' tips. i'd seen it but didn't know if it would handle >8bit. will download and try some tests.

the flicker being addressed in the script with the deflicker plugin is not a rapid flicker. it's a slow, gentle variance in brightness caused by the hand-developing. i'll be curious to see how ReduceFlicker works compared to deflicker, which does a good job on this long, slow density variation.

may have hit another snag too. got an error about 'awarpsharp.' seems connected to this line later in the script:
UnsharpMask(strength=50, radius=2, threshold=0)

thanks again,
babag

Reel.Deel
9th December 2022, 00:05
Replace UnsharpMask with the script version from here: https://forum.doom9.org/showthread.php?p=1875711#post1875711
I recommend changing the name to UnsharpMask2 so there is no conflict in names if you have the WarpSharp plugin loaded.

Do you mind sharing a sample of the troublesome video?

kedautinh12
9th December 2022, 01:35
Here unsharpmask for HBD
https://github.com/Dogway/Avisynth-Scripts/blob/0231e9ad341ecdaa76932686f78fc65c2a106b98/MIX%20mods/SharpenersPack.avsi#L637

BabaG
9th December 2022, 07:08
thanks for the continuing tips. back to testing this.

@Reel.Deel
was able to get virtualdub to load the script after making the change you suggest and renaming to unsharpmask2. problem now is that, while virtualdub loads the avs file, the image remains a simple black frame. tried rendering it out and the render is also black throughout. i have two masters at 2880x2160p and they both do this. one is grass valley hqx and the other is dnxhr 12 bit. both do the same thing: they each load but display only a black frame. handbrake is able to open and display preview frames for both of these masters. mpv player also plays them both. avspmod shows both masters as black.

edit:
both the dnxhr and gv-hqx files original files open properly in virtualdub so, i guess, it's something to do with my avisynth script. maybe the loading of the file?
FFMPEGSource2("film_source_2880x2160p_DNxHR_444_12bit_23976fps.mov", atrack=1)
#FFMPEGSource2("film_source_2880x2160p_GV-HQX_23976fps.mov", atrack=1)
#ConvertToYV12(matrix="rec709")
z_ConvertFormat(pixel_type="YUV420P16")


@kedautinh12
tried the sharpening pack as well as the hbd function as a standalone as i wasn't sure what i was supposed to do since there were a lot of functions all in one pack. in any event, i got an error that there was no function named ex_bs. it's this line:
thres = ex_bs(thres, 8, bi, fulls=rgb, flt=true)
and is at line 649 in the overall pack.

thanks for any ideas.
babag

kedautinh12
9th December 2022, 07:17
You need ExTools and RgTools to work
https://github.com/Dogway/Avisynth-Scripts/blob/master/ExTools.avsi
https://github.com/pinterf/RgTools/releases

BabaG
9th December 2022, 07:26
thanks, kedautinh12. seems i have rgtools but not extools. downloaded and installed. will probably try tomorrow.

thanks again,
babag

BabaG
9th December 2022, 20:50
currently working on why the image is black and it seems to be this:Levels(20, 1.0, 240, 0, 255)
is there an alternative?

thanks,
babag

poisondeathray
9th December 2022, 21:15
currently working on why the image is black and it seems to be this:Levels(20, 1.0, 240, 0, 255)
is there an alternative?

thanks,
babag

Those are 8bit values. I'm pretty sure you posted about this already

10bit code values go from 0 to 1023 . A rough approximation would be to multiply by 4. coring=false means don't clip the values to limited range

Levels(80,1,960,0,1023, false)

EDIT:

z_ConvertFormat(pixel_type="YUV420P16")

Or if it's converted 16 bit you're working with, they go from 0 to 65535 . You didn't post your script or specify where you have your levels

BabaG
9th December 2022, 21:53
thanks, pdr, and you're right, of course. i did get bit by this before. got lost navigating all of the various things i don't really understand about this stuff but am approaching the end, i hope, of the process. moving now from test materials to real world, hence, the higher resolutions and bit depths.

thanks again,
babag

anton_foy
9th December 2022, 22:17
StainlessS made it like this:
https://forum.doom9.org/showthread.php?p=1975161#post1975161

gispos
9th December 2022, 22:58
Replace UnsharpMask with the script version from here: https://forum.doom9.org/showthread.php?p=1875711#post1875711


Here unsharpmask for HBD
https://github.com/Dogway/Avisynth-Scripts/blob/0231e9ad341ecdaa76932686f78fc65c2a106b98/MIX%20mods/SharpenersPack.avsi#L637
The better alternative, same quality as the original.

https://github.com/realfinder/AVS-Stuff/blob/Community/avs%202.5%20and%20up/UnsharpMask_avsi.avsi

kedautinh12
10th December 2022, 02:47
The better alternative, same quality as the original.

https://github.com/realfinder/AVS-Stuff/blob/Community/avs%202.5%20and%20up/UnsharpMask_avsi.avsi

Better? I think it's same cause Dogway base it and change from masktools to extools

gispos
10th December 2022, 12:40
Better? I think it's same cause Dogway base it and change from masktools to extools
But is still different.
I had compared the versions and UnsharpMask_avsi is almost identical to the original (That I like).
Other versions give different results. I just wanted to point out an alternative that gives almost the same result.