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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th July 2015, 10:42   #1  |  Link
joj
Registered User
 
Join Date: Jan 2013
Posts: 7
SmoothSkip - Repair skippy motion

Latest version: 2.0.1 (updated 2021-09-11)

In tribute to tritical's awesome filter, this one tackles the inverse problem
of TDecimate; allowing for addressing frames that have non-smooth, skippy / juddery motion.

Example:
slowmo>

It is mostly a heuristic command and control (detect and act) filter and doesn't do any actual
image processing. The interpolation used in the sample above leveraged mvtools
and this filter just decided when to use frames from that alternate clip.

Script to create this, samples, further information as well as the source code
can be found on github.

Binary for download with source code included available here.

Code:
 
SmoothSkip( altClip, int "cycle", int "create", int "offset", float "scene", bool "debug" )

    *altclip*: The clip to pick frames from, to insert before the respective frames in a cycle having the highest frame difference
    to their respective preceding ones. Mandatory option.

    *cycle*: Number of consecutive frames forming a cycle between skips.
    Typically it would be the number of frames between skips. If the distance of the frame skipping varies, a larger cycle can be 
    specified and number of frames to inject (create) in the cycle can also be raised so that an N in M cycle can be established.
    Default: 4

    *create*: Number of frames to create in a cycle.
    This together with cycle forms the frequency of frame injection ("create" in "cycle"). For example if there is one skip seen in 
    each cycle and a cycle is 4 frames, then one new frame will be injected every 4 frames. Consequently the resulting clip will 
    have 5/4 as many frames and the frame rate increased by the same factor. If on the other hand, the cycle is less strict, 
    such as 3 frames in every 10-12 frames, then create can be set to 3 with a cycle of the upper observed bound (12 frames),
    which will result in a 3 in 12 frame insertion ratio.
    Default: 1

    *offset*: Frame offset used to pick an insertion frame from the alternate clip (altclip).
    When scripting AviSynth, users are prevented from accessing individual frames, as selecting frames is the purview of the
    application leveraging AviSynth. Filter plugins however have greater flexibility and can pick and choose which frame to use
    and this offset option gives you some flexibility in selecting replacement frames that do not necessarily reside at the same
    frame number as the primary clip's. Of course, you could achieve the effect of fixed offset like this by using Trim and Loop,
    so this is just a shorthand to save you from having to stitch and slice clips in the script.
    Default: -1 (frame with number before current_frame)

    *scene*: Scene detection threshold.
    Any frame difference ("YDifferenceFromPrevious") above this threshold will be regarded as a scene change. When a scene
    change frame is detected, the frame from the source clip will be used instead of the alt-clip. When a scene change frame is
    detected in a cycle, the frame with the next largest frame diff will be picked instead. In short, if a scene change is detected
    in a cycle, then the frame with the largest diff will be removed from skip tagging. There is one exception to this rule, and
    that is when the cycle size is one (1). In that case, if a frame is flagged as a scene change, then a freeze-frame from the 
    source clip will be added instead. This is to allow for sharp scene transitions (straight cuts), which look much better to the 
    eyes than blending or interpolating the adjacent frames across a scene change.
    Default: 32.0

    *debug*: Display various internal metrics as an image overlay.
    Default: false
Changelog:
* 2.0.1 Fixes scene-change detection for single frame cycles. Now also allows the plugin to be used more than once in a script.
* 2.0.0 Adds multithreading support, scene detection. Fixes debug paint overflow. Removes "dm" option.
* 1.0.2 Fix bounds check on user input
* 1.0.1 Fix for invalid end-frame calculation
* 1.0.0 Initial release

Last edited by joj; 12th September 2021 at 04:23. Reason: minor fix release
joj is offline   Reply With Quote
Old 20th July 2015, 03:09   #2  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Interesting, I sometimes encounter this problem after using SRestore on blended content. I'll give it a try, thanks!
Reel.Deel is offline   Reply With Quote
Old 3rd August 2015, 13:59   #3  |  Link
pbristow
Registered User
 
pbristow's Avatar
 
Join Date: Jun 2009
Location: UK
Posts: 263
Hooray! Somebody's done this! =:o>

I've been trying on-and-off to solve these kinds of problems for years. Scripted solutions were always too slow, so I clearly needed a plugin, but didn't have the skills/motivation to do the work myself. =:o?

Thankyou! I'll download it now and give it a try next time I find myself watching a jerky video.
pbristow is offline   Reply With Quote
Old 1st October 2015, 21:23   #4  |  Link
jfma
Registered User
 
Join Date: Jan 2004
Posts: 5
Great!! but...

Would you be so kind as to build an x64 version for Avisynth+ ?

jfma is offline   Reply With Quote
Old 6th August 2021, 15:44   #5  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 213
Does this actually work?

When a frame is created, it is in the wrong place.

Motion r to l

rrrr

becomes

rrlrr

hence going forwards then backwards (created frame) then forwards.
coolgit is offline   Reply With Quote
Old 12th September 2021, 04:14   #6  |  Link
joj
Registered User
 
Join Date: Jan 2013
Posts: 7
@coolgit. Well it works for me, and I've run it on about 1200 different sources.
What you describe could have been an issue with an older version, and when using it with multithreading, or with some other filters that operated in the temporal space.
I've uploaded a version I've been using the last couple of years, which doesn't exhibit the mentioned problems. For me at least.
Give a newer version a try and see if it helps. If it doesn't, provide a test clip with the script you're using and I'll take a look.

@jfma there is a 64-bit version in the last release. Been away from the video space a few years, so sorry for the late reply.

Last edited by joj; 12th September 2021 at 04:18.
joj is offline   Reply With Quote
Old 14th September 2021, 12:01   #7  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
in https://github.com/jojje/SmoothSkip/...oothSkip.h#L52 the offset is float and the scene is int "[OFFSET]f[SCENE]i"
__________________
See My Avisynth Stuff
real.finder is offline   Reply With Quote
Old 14th September 2021, 14:37   #8  |  Link
ognirats
Registered User
 
Join Date: Sep 2021
Posts: 30
Thanks you
ognirats 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 09:12.


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