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

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th August 2016, 00:32   #1  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 1,294
Stabilizes background jitter

in old anime sources sometimes the jitter can be fixed nicely by Stab()

and sometimes Stab() make the non background things (like Characters) stable but leave the background with jitter

this not Stab() fault, it's source fault, there are CelStabilize() that made for this case but CelStabilize is unusable because CelBackground not fully developed (has a lot of Issues like very slow working and artifacts), so is there another solution?
__________________
My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 25th August 2016, 05:16   #2  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
Depan could be set to only analyze the frame edge but stabilize the entire frame.
But depending on the film transfer that probably won't be enough - both major telecine methods (flying spot and single line ccd) can jitter over the frame height, making all global stabilization of little use.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 26th August 2016, 02:37   #3  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 1,294
ok, I made this workaround function

Code:
function Stabilisemod(clip o, bool "padding", float "repthr")
{
padding = default (padding, true)
cell_s_repthr = default (repthr, 30)

bo = padding ? o.pointresize(width(o)+16,height(o)+16,-8,-8,width(o)+16.0001,height(o)+16.0001) : o.AddBorders(8, 8, 8, 8)
s=bo.Stabilise(bo.capabsolutemetric(15)).crop(8,8,-8,-8,align=true)
oas=Interleave(o,s)

ScriptClip(oas,"""
                                                sc=last.cFrameDiff(prevf=true, chroma=false, denoise=true, nt=1)
                                                sc > cell_s_repthr ? Interleave(o,o) : last
                                                """, args="o, cell_s_repthr").Selectodd()
}
__________________
My Avisynth Stuff

Last edited by real.finder; 23rd November 2016 at 18:21.
real.finder is offline   Reply With Quote
Old 26th August 2016, 09:04   #4  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 1,294
it will not work after scenes changed or moving... I think it need auto trim base on scenes to make it work on group of frames instead of all frames (especially Previous frames) automatically (in 1 pass like AutoAdjust do)
__________________
My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 27th August 2016, 18:39   #5  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 1,294
new workaround function, this time it use trims sections base on scenes changed

Code:
function Stabilisemod2_all(clip o, bool "padding", float "repthr", float "difthr")
{
difthr = default (difthr, 30)
global  cell_s_padding = padding
global  cell_s_repthr  = repthr
global  cell_s_difthr  = difthr
ScriptClip(o, """
                                                sc=last.cFrameDiff(prevf=false, chroma=false, denoise=true, nt=1)
                                                sc < cell_s_difthr ? trim(0,current_frame-2) ++ trim(current_frame-1, FrameCount()-1).Stabilisemod(cell_s_padding, cell_s_repthr) : last
""")
}

function Stabilisemod2(clip o, bool "padding", float "repthr")
{
global  c_min_scene_size = 5
global  c_scene_num = 1
global  c_scene_begin = 0
global  c_scene_end   = -1
global  cell_s_padding = padding
global  cell_s_repthr  = repthr
ScriptClip(o, """
source=last
vectors     = source.MSuper(pel=2, hpad=12, vpad=12, rfilter=2,    isse=true).MAnalyse(isb=false, search=3, searchparam=3, isse=true,    lambda=440, dct=4)
source.MSCDetection(vectors, thscd1=248, thscd2=50)

    # detect new scene
    global  newscene = (current_frame < c_scene_end + c_min_scene_size) ? false \
                                                                    : (AverageLuma>250)

    # remember where scene started for subsequent filtering.
    # this probably doesn't work well if not accesing the clip linearly.
    c_scene_begin = newscene ? c_scene_end+1 : c_scene_begin
    c_scene_end   = newscene ? current_frame-1    : c_scene_end
    global  c_scene_num  = (newscene && (current_frame > 0)) ? c_scene_num+1 : c_scene_num
    c_scene_num > 1 ? source.trim(0,c_scene_begin-1) ++ source.trim(c_scene_begin,c_scene_end) ++ source.trim(c_scene_end+1,source.FrameCount()-1).Stabilisemod(cell_s_padding, cell_s_repthr) : source
""")
RequestLinear(8,10, 5, false, false)
}
__________________
My Avisynth Stuff

Last edited by real.finder; 28th August 2016 at 06:25.
real.finder is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 18:11.


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