Log in

View Full Version : Vintage russian cartoon - what filters to use?


kypec
3rd June 2010, 14:05
I'd like to compress this cartoon as much as possible with x264.
Unprocessed M2V sample (11MB) (http://www.mediafire.com/file/wmkzzwyuyy2/sample.demuxed.m2v) for fellow Avisynth helpers.
The issues with the material as I see them:

Shaking: managed to cure it a bit with Stab(4,8,8) -> better ideas anyone?
Brightness (Luma) fluctuating awfully across frames: no idea how to cure this :(
Overall noise: I'm willing to sacrifice lots of details in favor of much smoother chroma areas -> suggestions welcome

Dogway
5th June 2010, 00:33
its a shame nobody has still helped you since there are so many skilled people, well, here my try. I used deflicker for luma flicker, but dont know if there is something better, noise Dfttest+tnlmeans and stabilise for jitter.

4 Mb mp4:
http://www.sendspace.com/file/i4xstj

kypec
5th June 2010, 06:25
Dogway, thank you very much for your efforts. Sample provided looks nice but please attach your AVS script with parameters used, that's what I lack most to learn more about filtering.

BTW, I've found some very interesting study about flicker removal by Francois Pitié (http://www.mee.tcd.ie/~sigmedia/pmwiki/uploads/Main.Publications/fpitie04a.pdf) claiming that they've some real GPU implementation of proposed solution but there is nowhere link to source or binary code.
Is there any skilled plugin programmer able to implement this algorithm for Avisynth (CPU or GPU)? Or has it been incorporated yet in some existing deflicker plugins?

EDIT:
Hooray, after few hours of experiments (trial and error mostly based on Dogway's suggestions :p) I've come up with the following script:# Initialize variable with path to my A/V tools
avdir=GetSystemEnv("PROGRAMFILES")+"\AVTools\"
# Load all the plugins that will be used in the script
LoadPlugin(avdir + "dgmpgdec\DGDecode.dll")
LoadPlugin(avdir + "plugins\ColorMatrix.dll")
LoadCPlugin(avdir + "plugins\yadif.dll")
# Open source video clip
MPEG2Source("C:\Users\pdzugas\Documents\encoding\NoPockaj\e10.d2v",info=3,cpu=4)
# Transform to desired colour space
ColorMatrix("Rec.709->Rec.601",hints=true)
# Deinterlace video if necessary
#~ Yadif()
orig=last
LoadPlugin(avdir + "plugins\DePan.dll") # DePan (v1.10.1)
LoadPlugin(avdir + "plugins\DePanEstimate.dll") # DePanEstimate (v1.9.2)
LoadPlugin(avdir + "plugins\RepairSSE3.dll") # Repair (v1.0PR)
Import(avdir + "plugins\Stab.avsi") # Stabilize script (v1.0)
LoadPlugin(avdir + "plugins\hqdn3d.dll") # HQDN3D (v0.11)
LoadPlugin(avdir + "plugins\deflicker.dll") # DeFlicker (v0.4)
LoadPlugin(avdir + "plugins\aWarpSharp.dll") # aWarpSharp (2009.06.19)
# Stabilize small shaking
Stab(1,10,10)
# Remove flickering (luminance fluctuations across frames)
Deflicker(percent=90,lag=25,scene=25,info=false)
# Denoise, mostly spatially
hqdn3d(ls=8.0, cs=10.0, lt=6.0, ct=4.5)
# Sharpen the image, make it crisp and less blurry
aWarpSharp2(thresh=120, blur=3, type=0, depth=16, chroma=4)
# Crop to get rid of black borders
Crop(2,14,-6,-0)
# Resize video
Spline36Resize(640,480)
#~ StackHorizontal(orig,last)


Visual quality of processed video is much more pleasing to my eyes. Going to encode the episodes...

Atak_Snajpera
6th June 2010, 22:34
Vintage russian cartoon
LOL! Wilk i zając ;)

BTW. Wouldn't be better if you changed order?
0) Crop(2,14,-6,-0)
1) Spline36Resize(640,480)
2) hqdn3d(ls=8.0, cs=10.0, lt=6.0, ct=4.5)
3) aWarpSharp2(thresh=120, blur=3, type=0, depth=16, chroma=4)
4) Deflicker(percent=90,lag=25,scene=25,info=false)
5) Stab(1,10,10)

Dogway
7th June 2010, 01:33
I think its more efficient to stabilise before temporal denoising, I think deflicker denoise a little too, I would do:

5) Stab(1,10,10) #I meant stabilise.avs not stab.avs, but nice if this works too.
4) Deflicker(percent=90,lag=25,scene=25,info=false)
0) Crop(2,14,-6,-0)
2) hqdn3d(ls=8.0, cs=10.0, lt=6.0, ct=4.5)
3) aWarpSharp2(thresh=120, blur=3, type=0, depth=16, chroma=4)
1) Spline36Resize(640,480)

EDIT: yep, similar as you have!

kypec
7th June 2010, 06:01
LOL! Wilk i zając ;)

BTW. Wouldn't be better if you changed order?
0) Crop(2,14,-6,-0)
1) Spline36Resize(640,480)
2) hqdn3d(ls=8.0, cs=10.0, lt=6.0, ct=4.5)
3) aWarpSharp2(thresh=120, blur=3, type=0, depth=16, chroma=4)
4) Deflicker(percent=90,lag=25,scene=25,info=false)
5) Stab(1,10,10)
Cropping must go definitely after stabilize because the stabilization process introduces jumping left/top black border 1 pixel wide (at least in this case does). I know that resizing done first (downsized frame) yields to less computationally demanding processing for all the remaining filters but here it's not that critical either. I achieve ~5-8 fps @ slower encoding preset which is fine by me. :p

egrimisu
14th June 2010, 16:56
i know this cartoon " Nu zaietz pagadi " :)

kypec
16th June 2010, 08:05
i know this cartoon " Nu zaietz pagadi " :)
I'm pretty sure every user from former Eastern Europe block aged 30+ is very familiar with Nu Pogodi! cartoon series. Right now I'm presenting it to my 3-year old daughter and she's laughing just like we were back then.:p Still, it's one of the best things we imported from USSR ever.:)