View Full Version : Is there a Tutorial for QTGMC with VapourSynth?
8-BaLL
29th May 2015, 15:27
Hey guys,
Id like to test VapourSynth and so far Ive installed it succesfully.
Im new to the scripting with python however.
Since I didnt find much info in google, is there some sort of tutorial how to run QTGMC with vapoursynth and is there a collection of all required plugins for QTGMC which are VS-compatible?
This is the simple task I wanna use (Avisynth script):
loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\LSMASHSource.dll")
LWLibavVideoSource("D:\testfile.ts")
qtgmc(preset="very slow")
selecteven()
spline64resize(1280,720)
can someone translate it to VS-script, so I can copy paste it please?
Thanks
captainadamo
29th May 2015, 15:32
Check out this thread (https://forum.doom9.org/showthread.php?t=166582&highlight=qtgmc).
8-BaLL
29th May 2015, 15:55
Its not a tutorial though, I dont understand **** in that thread... :)
Looks like this tool needs another year or 2 to become somewhat "usable". Not having a preview program like AVSPmod is really a pita, plus I cant find anything about Megui beeing able to handle VSynth scripts...
I guess this VS really has potential, but due to the lack of comfortable use of it, it will stay a niche tool for a long time.
captainadamo
29th May 2015, 15:59
The first post isn't that long and has exactly what you need to run QTGMC:
Usage Example:
Firstly, put havsfunc.py to Python\Lib\site-packages.
Code:
import vapoursynth as vs
import havsfunc as haf
core = vs.get_core()
clip = yourclip
clip = haf.QTGMC(clip, Preset='Medium', TFF=True)
8-BaLL
29th May 2015, 16:15
Is there some sort of preview to see the changes I do in the script or to see the effect of the script, like the image quality etc...? Like the preview in MeGui or AVSPmod?
sneaker_ger
29th May 2015, 16:20
http://forum.doom9.org/showthread.php?t=170965
Or just load in MPC-HC or VirtualDub.
captainadamo
29th May 2015, 16:22
Vapoursynth Editor (https://forum.doom9.org/showthread.php?t=170965).
8-BaLL
29th May 2015, 16:29
Ok thanks, how do I translate this line into VS counterpart?
LWLibavVideoSource("D:\testfile.ts")
mawen1250
29th May 2015, 16:30
I think what you need is to first spend some time reading the official documentation (http://www.vapoursynth.com/doc/).
8-BaLL
29th May 2015, 16:32
I did but it seems like its a little outdated, for example it says to use "ret = core.ffms2.Source" while in QTGMC example it uses "clip="
Just as an example. Another example it doesnt recognize "LWLibavVideoSource" although its supposed to be in "Native Plugins"...
captainadamo
29th May 2015, 16:36
Ok thanks, how do I translate this line into VS counterpart?
We have a forum search feature here. But here (https://www.doom9.org/showpost.php?p=1640720&postcount=82) is an example.
I did but it seems like its a little outdated, for example it says to use "ret = core.ffms2.Source" while in QTGMC example it uses "clip="
Just as an example.
That's just a variable name for the clip that is returned from the source filter and it can be anything you want. You can either change both to be "ret" or both to "clip" or basically anything you want as long as it's consistent. Everyone names their variables slightly differently.
sneaker_ger
29th May 2015, 16:49
Just as an example. Another example it doesnt recognize "LWLibavVideoSource" although its supposed to be in "Native Plugins"...
Native plugin means it's not an AviSynth plugin.
I think l-smash would be something like "core.lsmas.LWLibavSource()". They are all in their respective namespaces, here "lsmas".
YamashitaRen
29th May 2015, 17:01
Just as an example. Another example it doesnt recognize "LWLibavVideoSource" although its supposed to be in "Native Plugins"...
This one is a bit hard to find so I'll help you :
Clip=core.lsmas.LWLibavSource("D:\testfile.ts")
I let you find which dll you need etc...
By the way, Vapoursynth is mature enough to be efficiently used for whatever you need. Don't be afraid by python.
The only problem that you're likely to encounter is the lack of native plugins... which is not a problem when you only want to use QTGMC ;)
edit : preceded by sneaker_ger
captainadamo
29th May 2015, 17:17
But even if it lacks a native plugin you want it is not a big deal as long as you stick to 32-bit since it should support it through the Avisynth compatibility layer. And if it's important enough to have someone is likely to step up and port it over.
8-BaLL
29th May 2015, 17:29
OK I give up... Its a freaking journey to figure out how to spline64resize something, not to mention everything else.
Reason why avisynth is so popular is because its almost selfexplanatory and works in a logical way. The first post in the VS thread is from 2011 and this forum subsection has like 10 threads. There is a reason why...
Ill have to experiment with Avisynth MT then I guess to improve the speed. At the current stage VS is not of much use for me.
captainadamo
29th May 2015, 17:36
OK I give up... Its a freaking journey to figure out how to spline64resize something, not to mention everything else.
Yeah, a journey that took me 5 seconds to find this page (http://www.vapoursynth.com/doc/functions/resize.html) from the documentation you were linked. It was very hard to click under the "Table of Contents" header the part that said "Function Reference" then click "Resize".
Reason why avisynth is so popular is because its almost selfexplanatory and works in a logical way. The first post in the VS thread is from 2011 and this forum subsection has like 10 threads. There is a reason why...
Not really. Avisynth does many things illogically and its syntax is hardly "selfexplanatory". There are plenty of semantic gotchas that people new to Avisynth have issues with. You're confusing your familiarity with it for the qualities you claim it has.
sneaker_ger
29th May 2015, 17:38
Yep, it's not that hard, really.
http://www.vapoursynth.com/doc/avisynthcomp.html
http://www.vapoursynth.com/doc/functions/resize.html (or the great fmtconv (http://forum.doom9.org/showthread.php?t=166504))
8-BaLL
29th May 2015, 17:42
I was looking at exactly the same page and trying out what is shown there.
this line:
resize.Lanczos(width=1280, height=720) and just
Lanczos(width=1280, height=720)
and all possible other combinations dont work, it says:
"Python exception: name 'resize' is not defined"
Also how do I use spline64 or spline36 or spline16 or lanczos4? None of that shit is explained there. Just "Spline", just "lanczos"... etc.
sneaker_ger
29th May 2015, 17:47
Use fmtconv for advanced resizing stuff, I think the inbuilt resize only has 1 option each. (The doc should be updated to say which one) fmtconv comes with a very good documentation.
Always use variable for clips:
ret=core.resize.Lanczos(ret, width=1920, height=1080)
captainadamo
29th May 2015, 17:50
I was looking at exactly the same page and trying out what is shown there.
this line:
resize.Lanczos(width=1280, height=720) and just
Lanczos(width=1280, height=720)
and all possible other combinations dont work, it says:
"Python exception: name 'resize' is not defined"
Because it has to be called off of the vscore object in your script. The example scripts you've been given show how to call functions. You could have also searched this board and would have found example of how to resize.
Also how do I use spline64 or spline36 or spline16 or lanczos4? None of that shit is explained there. Just "Spline", just "lanczos"... etc.
You need something like ftmconv. Vapoursynth only has basic resizers.
8-BaLL
29th May 2015, 17:56
Use fmtconv for advanced resizing stuff, I think the inbuilt resize only has 1 option each. (The doc should be updated to say which one) fmtconv comes with a very good documentation.
Always use variable for clips:
ret=resize.Lanczos(ret, width=1920, height=1080)
thanks but even if I use this line, I get the error:
Failed to evaluate the script:
Python exception: name 'resize' is not defined
Traceback (most recent call last):
without this line I can see the video in the preview. With it, I get the error.
This is how the script looks:
import vapoursynth as vs
import havsfunc as haf
core = vs.get_core()
src = core.lsmas.LWLibavSource(source=r'D:\testfile.ts')
ret=resize.Lanczos(ret, width=1280, height=720)
#clip = haf.QTGMC(clip, Preset='Medium', TFF=True)
src.set_output()
captainadamo
29th May 2015, 17:56
You call it as:
core.resize.[Resizer]
just as with all other functions you call it has to be called from that core object.
YamashitaRen
29th May 2015, 17:58
For his defense, he wants to spline64 so swscale isn't an option :D He'll have to use fmtconv like sneaker_ger pointed out.
@8-BaLL
Syntax is always the same.
It's something like Clip=core.resize.Bilinear(clip=Clip) (with swscale)
Or Clip=core.fmtc.resample(clip=Clip,kernel="bilinear") (with fmtconv)
core is... core or whatever you named it.
resize/fmtc is plugin namespace.
resize/resample is plugin function.
Read Vapoursynth and fmtconv doc, they have some good examples.
And I'll finish with a little piece of advice :
Stop acting like it will not work.
If you start with this mindset, you'll have trouble to do what you want. No matter what you do, it's always easier to fail. So, if you want to success, you'll have to start believing that you are able to sucess ;)
edit :
I think the inbuilt resize only has 1 option each. (The doc should be updated to say which one)
That's one of the great swscale mysteries :D
captainadamo
29th May 2015, 18:00
For his defense, he wants to spline64 so swscale isn't an option :D He'll have to use fmtconv like sneaker_ger pointed out.
Which we both of us said a number of times.
And I'll finish with a little piece of advice :
Stop acting like it will not work.
If you start with this mindset, you'll have trouble to do what you want. No matter what you do, it's always easier to fail. So, if you want to success, you'll have to start believing that you are able to sucess ;)
Or just do more than the bare minimum to try to figure things out. There are probably dozens of examples from this board that could have solved all of the issues they are having. The problem is they seem to expect to be spoonfed everything.
sneaker_ger
29th May 2015, 18:01
Yeah, sorry, my example was wrong (did I say it's not hard? :D ). The others corrected for me.
captainadamo
29th May 2015, 18:03
Yeah, sorry, my example was wrong (did I say it's not hard? :D ). The others corrected for me.
Or having just simply typed "resize.Spline" into the forum search gives examples to have shown them what was wrong.
8-BaLL
29th May 2015, 18:41
after looking into "fmtconv" I finally quit :)
Just an example out of the readme:
Colorspace conversions
YUV 4:2:0 to RGB:
c = core.fmtc.resample (clip=c, css="444")
c = core.fmtc.matrix (clip=c, mat="601", col_fam=vs.RGB)
c = core.fmtc.bitdepth (clip=c, bits=8)
Like how do you need 3 lines for tasks like that? Keep in mind the plugin usually uses 3 lines for most simple tasks if not more.
And then when I managed to resize the image using spline 64, it automatically deinterlaced the video, even though I didnt want it to and didnt specify it.
This line was used:
src=core.fmtc.resample(clip=src, kernel="spline64", w=1280, h=720)
Looks like the default setting automatically deinterlaces if you dont explicitly tell it to NOT DEINTERLACE.
Overall, I find most tasks way too overcomplicated. An Avisynth script with 2-3 lines would be like a 7-8 line script (or more) for the most tasks in VS.
I think we will see an Avisynth 3.0 release with native mutli-core support etc., before VS gets to the point where its simply manageable and not a PITA to figure out things, where you need to study pages of readme files, if you want to do some "tricky" stuff like splitting and merging mutliple files for example with different resolutions, so youre gonna want to resize the files in the process before you merge them again etc.
For tricky stuff like I mentioned above, you would have to study a fkn book in order to be able to do it with VS :D
Another example:
YUV colormatrix conversion from BT. 601 to BT. 709. For example to insert a DVD content in an HDTV stream. Note that we need to convert the clip to 4:4:4 in an intermediate step because matrix can only process 4:4:4.
c = core.fmtc.resample (clip=c, css="444")
c = core.fmtc.matrix (clip=c, mats="601", matd="709")
c = core.fmtc.resample (clip=c, css="420")
c = core.fmtc.bitdepth (clip=c, bits=8)
like WTF? :) Dont mean to bash VS as it might work well overall for what it was meant to be, but really- simplicity is something different.
Yes, because haf.Resize(clip, kernel="spline64") is rocket science.
sneaker_ger
29th May 2015, 18:55
VapourSynth supports high bitdepth(>8 bit). Since fmtconv works with high bitdepth internally it defaults to outputting high bitdepth so you can keep working with the increased precision instead of throwing it away like you are used to from AviSynth. The last "bitdepth" is only to dither down if you need e.g. 8 bit or 10 bit output. It should usually be at the very end of the script.
captainadamo
29th May 2015, 18:59
Looks like the default setting automatically deinterlaces if you dont explicitly tell it to NOT DEINTERLACE.
No, that setting is for signaling whether the content is interlaced or not. It's exactly the same as the interlaced parameter to the Avisynth functions that do colorspace conversions. That parameter is important for making sure your chroma doesn't get borked when upsampled.
For tricky stuff like I mentioned above, you would have to study a fkn book in order to be able to do it with VS
Or you just spend more than 5 seconds trying to learn something before giving up? You clearly don't want to even put in basic effort to learn things so clearly you should just stick with what you know already.
RTW47
29th May 2015, 19:02
just encapsulate long code into a function(s), import file as a Python module and use one-liners
captainadamo
29th May 2015, 19:03
Just encapsulate long code into a function(s), import file as a Python module and use one-liners
Not going to work. That would require actually expending effort on their part. If it's not spoonfed it's unacceptable. Probably forgetting the fact that they didn't learn all of Avisynth and its complexities in 5 minutes.
mawen1250
29th May 2015, 19:13
I suppose you should first learn some basic knowledge about image processing, color space conversion, interlaced, etc.
If you want do those stuff in a single line, just wrap them into a function.
For example, here's what I have done: http://forum.doom9.org/showthread.php?p=1715377#post1715377
And then you might complain about that huge amount of arguments...
captainadamo
29th May 2015, 19:15
I suppose you should first learn some basic knowledge about image processing, color space conversion, interlaced, etc.
If you want do those stuff in a single line, just wrap them into a function.
For example, here's what I have done: http://forum.doom9.org/showthread.php?p=1715377#post1715377
And then you might complain about that huge amount of arguments...
And those three modular functions are far easier to call and understand than many of the Avisynth plugins with functions that have can have upwards of a dozen or more of poorly documented parameters that make it nearly impossible to know if you are even calling it correctly. Once you delve outside of trivial scripts, Avisynth can be far from simple and easy to understand.
8-BaLL
29th May 2015, 19:21
I mean I understand the tool is still in development and was basically developed by 1 guy. It will probably become more user friendly some time. But untill then, I will indeed stick to Avisynth.
But nevertheless I still think if you have some tricky tasks, like multiple splitting+merging from different sources, that have different pixel sizes, while using different filters/plugins on different sources and stuff like that- the way it works in Avisynth is way more intuitive and logical with stuff like "+", "++", "." etc. whereas in VS youd have to "code" your parameters for like 25 mins and study a book before that to achieve the same result that you need a few minutes to accomplish in AVS. :)
Nevertheless, thanks for the tips guys.
captainadamo
29th May 2015, 19:23
I mean I understand the tool is still in development and was basically developed by 1 guy. It will probably become more user friendly some time. But untill then, I will indeed stick to Avisynth.
But nevertheless I still think if you have some tricky tasks, like multiple splitting+merging from different sources, that have different pixel sizes, while using different filters/plugins on different sources and stuff like that- the way it works in Avisynth is way more intuitive and logical with stuff like "+", "++", "." etc. whereas in VS youd have to "code" your parameters for like 25 mins and study a book before that to achieve the same result that you need a few minutes to accomplish in AVS. :)
Nevertheless, thanks for the tips guys.
Yeah Avisynth is so intuitive that there are examples where even its main developer (http://forum.doom9.org/showpost.php?p=1590322&postcount=99) gets the semantics of the scripting language wrong and has to be corrected. There are plenty of other examples of that that can be found where the semantics of the language are bizarre and poorly understood. And I can assure you that no one new to Avisynth will "intuitively" know the difference between '+' and '++'. You only understand it because you've used them enough to know.
Sure, Vapoursynth can always be improved, but to act like Avisynth is not full of ambiguities and complexity just doesn't match reality. As I said previously, you confuse your prior, existing knowledge with Avisynth being intuitive.
captainadamo
29th May 2015, 19:39
the way it works in Avisynth is way more intuitive and logical with stuff like "+", "++", "." etc. whereas in VS youd have to "code" your parameters for like 25 mins and study a book before that to achieve the same result that you need a few minutes to accomplish in AVS. :)
I missed it previously, but your claim about concatenating clips in VS is plainly false and once again shows you put no effort in reading any of the documentation you were given. From here (http://www.vapoursynth.com/doc/pythonreference.html):
The addition operator can be used to splice clips together:
clip4 = clip1 + clip2 + clip3
# Equivalent to:
clip4 = core.std.Splice([core.std.Splice([clip1, clip2], mismatch=False), clip3], mismatch=False)
Amazing how it only took me again only 10 seconds to find this instead of needing 25 minutes and studying.
jackoneill
29th May 2015, 20:34
Please, there is no need to bite a newcomer's head off.
Chaining filters with a dot is possible in VapourSynth too. I think that's actually missing from the documentation. (Not for much longer, though.)
core.ffms2.Source("asdf.mov").fmtc.resample(css="444").fmtc.matrix(mat="601", col_fam=vs.RGB).fmtc.bitdepth(bits=8).set_output()
There is an apparently unnecessary resampling step because the colorspace conversion (fmtc.matrix) requires all planes to have the same dimensions. The colorspace conversion filters in Avisynth upsample the chroma behind the scenes, which is why you see a single operation.
cretindesalpes
29th May 2015, 21:49
Like how do you need 3 lines for tasks like that? Keep in mind the plugin usually uses 3 lines for most simple tasks if not more.
Actually fmtconv does simple things. The apparently simple operations you want to do are complex in reality (and they are even more complex than described in the doc, fmtconv totally ignore gamut settings at the moment). So you need several steps to achieve them. fmtconv lets you do them with all the flexibility you may want.
BTW I’m currently working on a big wrapping function for fmtconv so you could convert between formats more intuitively with a logical and consistent default behaviour for the intermediate steps.
foxyshadis
30th May 2015, 00:27
captainadamo, people are going to get frustrated over using VS, because they're not programmers, and especially while the project is young and there's not a lot of tutorials or mindshare around. Not everyone's touched a real programming language before, and it's only going to be worse when people who've never even used Avisynth start asking. Unless it's an obvious troll, better to be as polite as possible in these kind of threads or avoid them, even when you're nudging them to search. Since there's no user/dev board split, that means everything will show up here.
It'd be a good idea to make these threads repositories of good scripts, instead of results full of "Use search!" where the answer is usually in the middle of some long-ass thread somewhere.
Pointing out the fmtconv is annoyingly low-level isn't wrong, I'm hoping some good wrappers that emulate the more complex Avisynth filters appear eventually. EDIT: Ah, cretin is already on it. :p
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.