This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[HELP] filldrops - Replace dupe frames with exact dupe frames
#1
Im very fond of the filldrops vs filter, but rife, svp and mv-tools doens't always give to good of a result on frames with certain objects in the frame i.e text, banners etc.
I was thinking of using "chronos fast" or "apollo fast" interpolation in topaz video enhance ai instead, as it gives better results on that kind of content. 
The thing is that the duplicate frame replacer function in VEAI doesn't seems to work very well, only when you got a source with exact/low compression artifacts duplicate frames it works in a good manner.

I was wondering if it's possible to use filldrops to instead of interpolating frames use it to create exact copies of the previous frame?
I would then use that processed video with VEAI's duplicate frame replacer and interpolation to get a good result.

Cheers
Reply
#2
One would need to write a separate function for replacing frames which differ less than X from their predecessor with a copy of it, but in general it's doable.
Maybe I find some time tomorrow to think about it and write a script for this and write some instructions down how one can manually add this to Hybrid, since I do not plan to add this permanently in Hybrid.
Does VEAI's 'duplicate frame replacer' not have some threshold so that frames with less than X difference will be replaced? (seems like an obvious option)

Cu Selur
Reply
#3
Great, thanks!

Yes, VEAI got a slider to adjust the sensitivity of the detection, but it doesn't work very well.
From my experience either it doesn't detect dupes at some lower values or for some reason creates more dupes when increasing that value.

I've read in a lot of their changelogs in recent versions that they've got problmes with the "de-duplication" functions.
Last version(4.0.5) was supposed to get this fixed:

Improvements to frame de-duplication in frame interpolation.

But i haven't got it to work near as good as with filldrops
Reply
#4
Create a AddDuplicates.py file in your Hybrid/64bit/vsscripts folder with the following content:
import vapoursynth as vs
core = vs.core

def addDup(clip, thresh=0.3, debug=False):
    core = vs.core
    if not isinstance(clip, vs.VideoNode):
        raise ValueError('This is not a clip')
        
    def selectFunc(n, f):
        if f.props['PlaneStatsDiff'] > thresh or n == 0:
            if debug:
                return core.text.Text(clip=clip, text="Org, diff: "+str(f.props['PlaneStatsDiff']), alignment=8)
            return clip
        else:
            added = addingDups(clip, n)
            if debug:
                return core.text.Text(clip=added, text="addingDups, diff: "+str(f.props['PlaneStatsDiff'])+" < "+str(thresh), alignment=8)
            return added
              
    diffclip = core.std.PlaneStats(clip, clip[0] + clip)
    fixed = core.std.FrameEval(clip, selectFunc, prop_src=diffclip)
    return fixed

def addingDups(clip, firstframe=None):
    if firstframe is None or firstframe == 0:
        return clip
    
    clip1 = core.std.AssumeFPS(clip, fpsnum=1, fpsden=1)
    r = core.std.Trim(clip1, first=firstframe-1, length=1) # predecessor of current frame
    a = core.std.Trim(clip1, first=0, last=firstframe-1) # frames before current frame
    b = core.std.Trim(clip1, first=firstframe+1) #frames after current frame
    join = a + r + b
    return core.std.AssumeFPS(join, src=clip)

In Hybrid go to "Filtering->Vapoursynth->Custom" set 'Insert before' to 'End' and enter:
# getting Vapoursynth core
import sys
import os
# Import scripts folder
sys.path.insert(0, os.path.abspath('%SCRIPTPATH%'))

import AddDuplicates
clip = AddDuplicates.addDup(clip,thresh=0.3, debug=True)
(adjust 'thresh' and 'debug' to your liking)
If I have not overlooked anything, this should insert single duplicate frames if the previous and the current frame differ less than thresh.

Cu Selur

Ps.: this will only work for single inserts, not multiple in a row.
Reply
#5
No, there seems to be a mistake in the Custom section,.. -> need to think about it a bit more
Reply
#6
Problem is '%SCRIPTPATH%', there is a bug in Hybrid which does not properly replace the variable.
=> you need to add the full path to Hybrid/64bit/vsscripts there. (and you need to use / not \)
Reply
#7
Smile 
Excellent! It seems to work like i thought right away Smile
Thank you very much!
Reply
#8
Happy that helped. Smile

Cu Selur
Reply
#9
How can I leverage filldrops in Hybrid to replace duplicate frames with exact copies of the previous frame?
I'm exploring alternatives to interpolation methods like chronos fast or apollo fast in topaz video enhance ai, as they don't always yield satisfactory results, especially with frames containing text or banners.
The duplicate frame replacer function in VEAI doesn't seem effective unless the source has exact or low compression artifacts.
The provided solution involves creating an AddDuplicates.py file and using Vapoursynth in Hybrid. Can someone explain the process and its limitations, especially regarding multiple consecutive inserts?
Reply
#10
Sorry, but at least I have no time and motivation to train a LLM.

Cu Selur
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)