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 18th March 2021, 18:35   #61  |  Link
Arx1meD
Registered User
 
Arx1meD's Avatar
 
Join Date: Feb 2021
Posts: 121
Updated post #1
Arx1meD is offline   Reply With Quote
Old 18th March 2021, 19:18   #62  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
I have a lot of background stabilizing images, having written several VirtualDub and Vegas scripts to permit stabilization of events within Vegas Pro using Deshaker inside of VirtualDub:

Deshaker Guide

Deshaker VirtualDub & Vegas Scripts

I am therefore very interested in this work, but don't want to take the time to get it up and running without some idea of how well it works. I just skimmed through all the posts looking for links to "before/after" examples. Has anyone posted an example of how well this works?
johnmeyer is offline   Reply With Quote
Old 18th March 2021, 19:58   #63  |  Link
Arx1meD
Registered User
 
Arx1meD's Avatar
 
Join Date: Feb 2021
Posts: 121
johnmeyer,
I tried Deshaker for VirtualDub, but I didn't like it. It is possible that I configured it incorrectly.
This script uses DePanEstimate to find motion vectors. Then DePan makes full or partial compensation based on these vectors. After working with DePan, black borders remain. FillBorders or AVSInpaint fixes them.
Check out the example in post #1 - "Original and stabilized clip".
Arx1meD is offline   Reply With Quote
Old 18th March 2021, 23:27   #64  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
I think you wrong

Quote:
For Win64 copy 32-bit version in C:\Windows\System32 and copy 64-bit version in C:\Windows\SysWOW64.
Right is 32 bit ver to SysWOW64 and 64 bit ver to System32
kedautinh12 is online now   Reply With Quote
Old 19th March 2021, 01:07   #65  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by kedautinh12 View Post
I think you wrong
Right is 32 bit ver to SysWOW64 and 64 bit ver to System32
Yep, Nice one, I did not spot that.
__________________
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 19th March 2021, 02:33   #66  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
Originally Posted by Arx1meD View Post
This script uses DePanEstimate to find motion vectors. Then DePan makes full or partial compensation based on these vectors. After working with DePan, black borders remain. FillBorders or AVSInpaint fixes them.
Check out the example in post #1 - "Original and stabilized clip".
Wow, how did I miss that link? Old age, I guess.

I too use Depan all the time inside of my movie film restoration script. If time permits, I'll IVTC your clip, apply that script and see if I can improve it, beyond simply stabilizing it.
johnmeyer is offline   Reply With Quote
Old 19th March 2021, 05:44   #67  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
The test clip has lots of problems besides gate weave:

1. Horrible encoding artifacts.
2. Really bad flicker
3. Dirt

To fix these I first IVTC'd the clip. Since it is animation where the dup pattern is unpredictable I used large Cycle/CycleR values in TIVTC. I am not an animation expert so I don't know if the result of removing duplicates will make the cartoon play strangely. Someone else will have to address that. However, to remove dirt, denoise, eliminate flicker, etc. you have to remove all dups.

I used Depan to stabilize, but it didn't do a good job with the rotational stability issues. Most film doesn't have these. So I used Deshaker instead.

I took that stabilized footage and fed it into my film script (which is posted elsewhere in this forum). I turned off the Depan stabilization, since that work was already done, but enabled Deflicker, set DCT=1 for the noise reduction, and enabled GamMac. Each of these three things helps reduce flicker.

I turned up the dirt and noise reduction too far which results in some Jello artifacts. If this was important (to me) I'd go back and fiddle around with those. Here is the result:

https://www.mediafire.com/file/svdnm...noise.mp4/file
johnmeyer is offline   Reply With Quote
Old 19th March 2021, 07:41   #68  |  Link
Arx1meD
Registered User
 
Arx1meD's Avatar
 
Join Date: Feb 2021
Posts: 121
Quote:
Originally Posted by kedautinh12 View Post
I think you wrong

Right is 32 bit ver to SysWOW64 and 64 bit ver to System32
Thank you for noticing the mistake.

Last edited by Arx1meD; 19th March 2021 at 07:58.
Arx1meD is offline   Reply With Quote
Old 19th March 2021, 08:58   #69  |  Link
Arx1meD
Registered User
 
Arx1meD's Avatar
 
Join Date: Feb 2021
Posts: 121
johnmeyer,
thanks for your work. I was unable to make a video comparison because you changed the frame rate by 10 fps. I made a comparison with screenshots only.

Deshaker for VirtualDub stabilized the clip better, but changed the zoom a lot. In my case, this is unacceptable.
If you need to fix the rotation then set MethodMS=2 and mirror=true to fix black borders.

P.S. Flickering is also poorly corrected. For cartoons, this is a big problem that I cannot solve normally.

Last edited by Arx1meD; 19th March 2021 at 09:15.
Arx1meD is offline   Reply With Quote
Old 19th March 2021, 16:57   #70  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Sorry it wasn't to your liking. Best of luck with your efforts.
johnmeyer is offline   Reply With Quote
Old 19th March 2021, 21:17   #71  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
It kinda bugged me that I don't think you really understood what I did with the deflicker, and that the stabilization was pretty good. Also, when you remove the duplicates, you HAVE to time it to play at 10 fps in order to get the right speed. If you want it to play at 23.976, then you have to re-insert duplicates.

Here is the original and my modified version, side-by-side, with duplicates added back so it will play at 23.976.

https://www.mediafire.com/file/bcflo...moval.mp4/file

I used Depan, since you seem to like that, even though it doesn't do a very good job with rotation stability, even with rotation correction enabled.

I will be interested to hear what other people think because, to me, the right side sure looks better than the right side, especially because for this clip, flicker is a far worse problem than stability. If you walk through it frame-by-frame, the lack of flicker in the "after" (right side) is even more apparent.

Last edited by johnmeyer; 20th March 2021 at 23:13. Reason: clarification
johnmeyer is offline   Reply With Quote
Old 20th March 2021, 04:58   #72  |  Link
Arx1meD
Registered User
 
Arx1meD's Avatar
 
Join Date: Feb 2021
Posts: 121
johnmeyer, you got a good result. Only from 48 seconds the shaking remained.
What settings have you set for Depan? And what deflicker did you use?

Last edited by Arx1meD; 20th March 2021 at 05:02.
Arx1meD is offline   Reply With Quote
Old 20th March 2021, 16:29   #73  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
I only used Depan because you like it and you have spent a lot of time in this thread perfecting it. As I said earlier, I use it with the more normal gate weave on film, which usually does not include the rotation instability of your clip. So, for this clip, Depan didn't do a very good job, but I have other better ways to stabilize video (Deshaker, and the "ultimate" stabilizer, Mercalli), so I don't need help with Depan. I use it only because you didn't like my results with Deshaker.

I don't know why Depan introduced those strange jumps in the last scene.

For flicker reduction I used the Deflicker plugin, with default settings AND I changed the DCT setting in the MVTools2 denoiser to DCT=1 which substantially reduces flicker as a fortuitous side effect. Finally, I used StanlessS' "GamMAC" to help even out exposure. Between the three of them I was quite pleased with the flicker reduction.

Last edited by johnmeyer; 20th March 2021 at 16:34.
johnmeyer is offline   Reply With Quote
Old 20th March 2021, 17:33   #74  |  Link
Arx1meD
Registered User
 
Arx1meD's Avatar
 
Join Date: Feb 2021
Posts: 121
johnmeyer, thanks. I will try your recommendations not only on this clip but also on others.
Arx1meD is offline   Reply With Quote
Old 1st April 2021, 22:47   #75  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by StainlessS View Post
Side topic,
This snippit from original stab3.avsi [modded somewhat, not sure if currently working as intended]
Code:
Function FindBlackBorders(clip c, int "width", int "thr", string "path", string "filename") {
    add      = Default(width,1)     # Width for detection, normally 1 should suffix to most situations
    thr      = Default(thr,1)       # Threshold for detection, pixels lower than this value will be considered a border
    path     = Default(path, "C:")  # This is the path to store the statistics file
    filename = Default(filename, "FindBlackBorders - Statistics.log") # Filename of the statistics file
    fn       = path + "\" + filename
    Y =c.converttoy8()
    L1=Y.crop(0,0,add,0)
    R1=Y.crop(Y.width-add,0,0,0)
    T1=Y.crop(0,0,0,add)
    B1=Y.crop(0,Y.height-add,0,0)
    c.ScriptClip("""
        WriteFileIf(fn,string(L1.AverageLuma<thr||R1.AverageLuma<thr||T1.AverageLuma<thr||B1.AverageLuma<thr),
            \ Chr(34)+"CHAPTER00="+FFFormatTime(round(current_frame*1000/framerate))+Chr(34),
            \ Append=Current_frame!=0)
    """, args= "thr,L1,R1,T1,B1, fn",Local=true)
    #converttoyv12()
    # Bug or limitations of 8-bit masktools with Overlay or...
    # mt_merge (masking PC Range masks) so use Dither tools
    #Dither_merge16_8(Dither_convert_8_to_16(),Dither_convert_8_to_16(c),mt_lut("255"),luma=true)
    #ditherpost(mode=-1)
    #c.Echo(Last) # Maybe replace above dither stuff ???
    # EDIT: Not using Echo(), input clip c to Scriptclip instead.
    return last
}
test
Code:
A=Colorbars(pixel_type="YV12").Trim(0,-10).KillAudio.AssumeFPS(10.0)
B=A.Letterbox(32,0,0,0)
B++A++B
FindBlackBorders(Path = "D:\DVD", thr=20)
return last
results
Code:
CHAPTER00=0:00:00.000
CHAPTER00=0:00:00.100
CHAPTER00=0:00:00.200
CHAPTER00=0:00:00.300
CHAPTER00=0:00:00.400
CHAPTER00=0:00:00.500
CHAPTER00=0:00:00.600
CHAPTER00=0:00:00.700
CHAPTER00=0:00:00.800
CHAPTER00=0:00:00.900
CHAPTER00=0:00:02.000
CHAPTER00=0:00:02.100
CHAPTER00=0:00:02.200
CHAPTER00=0:00:02.300
CHAPTER00=0:00:02.400
CHAPTER00=0:00:02.500
CHAPTER00=0:00:02.600
CHAPTER00=0:00:02.700
CHAPTER00=0:00:02.800
CHAPTER00=0:00:02.900
What is the stuff in RED supposed to do ? [and what is the problem (I never use the dither stuff) ]
Can it be replaced by v2.60 Echo() filter ? [to return original source clip and still write log file]
EDIT: Replaced Echo, see script in GREEN.


Original source script
Code:
####################################
###
### FindBlackBorders()
###
###  (http://forum.videohelp.com/threads/371336)
###
### Script to find sources with black borders for example as a result of bad deshaking, run on analysis pass
### The output file is formatted to be imported to avspmod as bookmarks
### use ClipClop() afterwards on a scene by scene basis to fix this.
###
### "width" is border thickness for detection
### "thr" is threshold, pixel values below this will be considered borders
### "path" is the path to store the statistics file, with end backslash. Default is "C:"
### "filename" is the statistics file name. In case you don't want to overwrite old ones
###
### Dependencies:
###
### Required:
### ------------
###
###   masktools     (v2a48 or higher)                   (http://forum.doom9.org/showthread.php?t=98985)
###   Dither        (v1.26.5 or higher)                 (http://forum.doom9.org/showthread.php?p=1386559#post1386559)
###
####################################

function FindBlackBorders(clip c, int "width", int "thr", string "path", string "filename") {

add      = Default(width,1)     # Width for detection, normally 1 should suffix to most situations
thr      = Default(thr,1)       # Threshold for detection, pixels lower than this value will be considered a border
path     = Default(path, "C:")  # This is the path to store the statistics file
filename = Default(filename, "FindBlackBorders - Statistics.log") # Filename of the statistics file

c
converttoy8()
w=width()
h=height()

L1=crop(0,0,-w+add,0)
R1=crop(w-add,0,0 ,0)
T1=crop(0,0,0,-h+add)
B1=crop(0,h-add,0 ,0)

ScriptClip("""
x1 = AverageLuma(L1) < thr ? true : false
x2 = AverageLuma(R1) < thr ? true : false
y1 = AverageLuma(T1) < thr ? true : false
y2 = AverageLuma(B1) < thr ? true : false
function IsBorder(clip c, bool x1, bool x2, bool y1, bool y2) {return (x1||y1||x2||y2)?true:false}

q = chr(34)chr(34)chr(34)
WriteFileIf(""+path+"\"+filename+"", " "+string(IsBorder(x1,y1,x2,y2))+" ", q+"CHAPTER00="+q,
        \ "FFFormatTime_stabi(round((current_frame * 1000) / framerate()))", "", "")
""",args="thr,L1,R1,T1,B1,path,filename")

converttoyv12()

# Bug or limitations of 8-bit masktools with Overlay or...
# mt_merge (masking PC Range masks) so use Dither tools
Dither_merge16_8(Dither_convert_8_to_16(),Dither_convert_8_to_16(c),mt_lut("255"),luma=true)
ditherpost(mode=-1) }
Is this what an AvsPMod bookmark looks like ? [how it relates to clipClop, I have no idea].
Code:
CHAPTER00=0:00:02.900
Sorry for all the 'q's

EDIT:

We really need to use same method [block/scanline] for single thr, to get best best result.
FindBlackBorders is not needed in stab3

and mt_merge now don't has this problem thanks to pinterf
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 1st April 2021, 23:26   #76  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
FindBlackBorders is not needed in stab3
Yes I know, but it presumably still has some functionality.

Quote:
and mt_merge now don't has this problem thanks to pinterf
The Mt_Merge thing was [I think] just to ensure that WriteFileIf worked properley, and did write the output file.
The Mt_Merge thing is fixed anyway, either by the use of v2.60 Echo(), or my mod which changed to using c clip as input.
__________________
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 2nd April 2021, 02:53   #77  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
I made the original script long ago so I don't remember many things of it (like the Dither stuff or how I proceeded to load ClipClop formatted call, prolly through macros).
The stabilization tools pack was always a proof of concept, was never meant to be the end it all. At the time I tested DeShaker and I found it great for handheld shakiness but not for pixel or subpixel jitter like in anime.

I made stab2() to fix the following shortcomings of Depan:
Quote:
-Color tint (hue shift to green) when subpixel>0 to stablizated frames --> addressed here
-Artifacts occasionally on frame borders (1px skew) --> crop out, check example
-No advanced border fill --> addressed above ( FillBorders() )
-Some false-positives when people clapping, trembling...
-Requires mod 4 inputs?
-No medium jitter fix
-Some thick borders (false positives) aren't 0 black on the inner side
So I'm glad someone resumes the project and takes it to the next level, that's basically the purpose of open source.
Dogway is offline   Reply With Quote
Reply

Tags
deshaker

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 16:53.


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