Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage example seems broken and incomplete #69

Open
unfa opened this issue Oct 14, 2023 · 3 comments
Open

Usage example seems broken and incomplete #69

unfa opened this issue Oct 14, 2023 · 3 comments

Comments

@unfa
Copy link

unfa commented Oct 14, 2023

Hi! I'm relatively new to using VapourSynth, but I see it as an incredible tool fro my video production work, as it has tools I don't see anywhere else.

I'm trying to do some camera movement smoothing (remove shaking, maybe remove motion blur if possible?), however I am having a hard time using mvtools plug-in Vapoursynth.

The usage section in in readme seems to error out and have some errors in the syntax:
https://github.com/dubhater/vapoursynth-mvtools/blob/master/readme.rst#usage

I'm probably doing something wrong, but maybe everyone using these is so familiar with it that they didn't really need to real in. I'm new and finding information about using VapourSynth and it's plug-ins seems difficult to find. Maybe plug-ins don't provide any usage information in their Git repos.

Is there anywhere a complete vapoursynth script that demonstrates using mvtools on a video file that I can just preview in VSedit and take apart to achieve what I want?

The best I managed to do so far using the example is this:

import vapoursynth as vs

clip = vs.core.ffms2.Source(source="my_video_clip.mkv")

super = vs.core.mv.Super(clip, hpad=16, vpad=16, pel=2, levels=0, chroma=True, sharp=2, rfilter=2, pelclip=None, opt=True)

vectors = vs.core.mv.Analyse(super)#, blksize=8, blksizev=blksize, levels=0, search=4, searchparam=2, pelsearch=0, isb=False, lambda, chroma=True, delta=1, truemotion=True, lsad, plevel, global, pnew, pzero=pnew, pglobal=0, overlap=0, overlapv=overlap, divide=False, badsad=10000, badrange=24, opt=True, meander=True, trymany=False, fields=False, tff, search_coarse=3, dct=0)

#clip = mv.Recalculate(super, vectors)#, blksize=8, blksizev=blksize, search=4, searchparam=2, lambda, chroma=True, truemotion=True, pnew, overlap=0, overlapv=overlap, divide=False, opt=True, meander=True, fields=False, tff, dct=0)
#
#mv.Compensate(clip, super, vectors)#, scbehavior=1, thsad=10000, bfields=False, time=100.0, thscd1=400, thscd2=130, bopt=True, btff)
#
#mv.Degrain1(clip, super, mvbw, mvfw, thsad=400, thsadc=thsad, plane=4, limit=255, limitc=limit, thscd1=400, thscd2=130, bopt=True)
#
#mv.Degrain2(clip, super, mvbw, mvfw, mvbw2, mvfw2, thsad=400, thsadc=thsad, plane=4, limit=255, limitc=limit, thscd1=400, thscd2=130, bopt=True)
#
#mv.Degrain3(clip, super, mvbw, mvfw, mvbw2, mvfw2, mvbw3, mvfw3, thsad=400, thsadc=thsad, plane=4, limit=255, limitc=limit, thscd1=400, thscd2=130, bopt=True)
#
mask = vs.core.mv.Mask(clip, vectors)#, ml=100.0, gamma=1.0, kind=0, time=100.0, ysc=0, thscd1=400, thscd2=130, bopt=True)
#
#mv.Finest(super, bopt=True)
#
#mv.Flow(clip, super, vectors, time=100.0, mode=0, bfields=False, thscd1=400, thscd2=130, bopt=True, btff)
#
#mv.FlowBlur(clip, super, mvbw, mvfw, blur=50.0, prec=1, thscd1=400, thscd2=130, bopt=True)
#
#mv.FlowInter(clip, super, mvbw, mvfw, time=50.0, ml=100.0, bblend=True, thscd1=400, thscd2=130, bopt=True)
#
#mv.FlowFPS(clip, super, mvbw, mvfw, num=25, den=1, mask=2, ml=100.0, bblend=True, thscd1=400, thscd2=130, bopt=True)
#
#mv.BlockFPS(clip, super, mvbw, mvfw, num=25, den=1, mode=3, ml=100.0, bblend=True, thscd1=400, thscd2=130, bopt=True)
#
#mv.SCDetection(clip, vectors, thscd1=400, thscd2=130)

clip = vs.core.mv.DepanAnalyse(clip, vectors, mask)#, bzoom=True, brot=True, pixaspect=1.0, error=15.0, binfo=False, wrong=10.0, zerow=0.05, thscd1=400, thscd2=130, bfields=False, btff)

data = vs.core.mv.DepanEstimate(clip)#, trust=4.0, winx=0, winy=0, wleft=-1, wtop=-1, dxmax=-1, dymax=-1, zoommax=1.0, stab=1.0, pixaspect=1.0, binfo=False, bshow=False, bfields=False, btff)

data = vs.core.mv.DepanCompensate(clip, data)#, offset=0.0, subpixel=2, pixaspect=1.0, bmatchfields=True, mirror=0, blur=0, binfo=False, bfields=False, btff)

clip = vs.core.mv.DepanStabilise(clip, data)#, cutoff=1.0, damping=0.9, initzoom=1.0, baddzoom=False, prev=0, next=0, mirror=0, blur=0, dxmax=60.0, dymax=30.0, zoommax=1.05, rotmax=1.0, subpixel=2, pixaspect=1.0, fitlast=0, tzoom=3.0, binfo=False, method=0, bfields=False)

clip.set_output()

I have managed to guess how to obtain various pieces of data like super, mask, vectors and data, but I have no idea how to get these: mvbw, mvfw, mvbw2, mvfw2, mvbw3, mvfw3.

@4re
Copy link

4re commented Oct 14, 2023

It's actually on the readme you linked http://avisynth.org.ru/mvtools/mvtools2.html
I guess because transcribing everything would be a pain in the ass for no reason, the readme on this repo is meant to be used as a way to see differences in arguments and function call names.

@unfa
Copy link
Author

unfa commented Oct 14, 2023

Ah, so I need to learn how the AviSynth scripts differ from VapourSynth and translate the examples myself?

@dubhater
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants