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. |
|
|
Thread Tools | Search this Thread | Display Modes |
15th December 2017, 22:57 | #1 | Link |
Guest
Posts: n/a
|
Problems with Histogram/Tweak and Other Teething Problems
I'm having trouble with Histogram. At first, I tried to load the plugin, but that generated an error message telling me that the plugin was already loaded, at which point I realized that it is now built in. So I removed the call to LoadPlugin(), but I now receive an error message saying that there is no function called hist.
I took the code from the usage section of Histogram. Code:
core.std.hist.Color2(video) Last edited by Richard1485; 16th December 2017 at 18:58. |
16th December 2017, 13:17 | #6 | Link |
Registered User
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
|
Every plugin should start with the core, but once it is there you can't call it again in the same call.
Then the namespace of the plugin follows it, it is like the container of all functions the plugin has. That's what you usually see like std, resize, hist... And after that, you call the function you want from that plugin, Color2 for example. Code:
clip = core.resize.Bicubic(clip, 640, 480) clip = core.hist.Color2(clip) Code:
clip = core.resize.Bicubic(clip, 640, 480).hist.Color2(clip) Ofc to create the core there are many methods, you can use Code:
from vapoursynth import core Code:
import vapoursynth as vs core = vs.get_core() |
16th December 2017, 14:20 | #7 | Link | |||
Guest
Posts: n/a
|
Quote:
Quote:
Quote:
I'm really glad that you posted this. I've been seeing the two ways of doing it all over place and wondered which was right or whether they were linked to different versions of Python or whatever. I started by following the documentation, which uses the new way, but after what you've said, I think that I might use the old way. In fact, my current script has a mix of the two because some functions refer to vs, which in the new way remains undefined. |
|||
16th December 2017, 15:08 | #8 | Link | |
Registered User
Join Date: Feb 2016
Posts: 6
|
Quote:
You can chain methods AND use new lines - if you make each line only do one job errors are much easier to track down. By wrapping the block in parenthesis you can newline as much as you like. This is the preferred way in Python. Some MWE: Code:
import vapoursynth as vs core = vs.get_core() clip = (core.std.BlankClip() .resize.Bicubic(1280, 720) .text.ClipInfo() .std.Turn180() ) clip.set_output() Code:
import vapoursynth as vs core = vs.get_core() clip = core.std.BlankClip() \ .resize.Bicubic(1280, 720) \ .text.ClipInfo() \ .std.Turn180() clip.set_output() |
|
16th December 2017, 15:43 | #9 | Link |
Guest
Posts: n/a
|
^ The second option looks like the way I do things in AviSynth, although I tab the backspaces to make them line up and look a little neater. I'll try the first in VapourSynth. It does look more elegant.
EDIT: I now have a problem with Tweak(). Code:
import adjust video2 = core.adjust.Tweak(video,hue=XX) Code:
ModuleNotFoundError: No module named "adjust" Code:
Drop adjust.py someplace where Python can find it, then use import adjust in your scripts. The documentation has a Plugin Autoloading section, but it doesn't seem to refer to .py files, and I'd prefer to load things manually anyway, at least for the time being. Last edited by Richard1485; 16th December 2017 at 16:37. |
16th December 2017, 17:04 | #10 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
I place .py in the python => lib => site-packages directory . Then you can import it with "import adjust" Another useful .py is HAvsFunc.py by HolyWu - it has many familiar avisynth functions https://forum.doom9.org/showthread.php?t=166582 (PS. when I come across "std", I take penicillin ) Last edited by poisondeathray; 16th December 2017 at 17:09. |
|
16th December 2017, 17:44 | #11 | Link |
Guest
Posts: n/a
|
Thanks! Unfortunately, that generates a syntax error that points to line 7 of adjust.py itself, possibly because it was written with an older version of Python in mind. I'm using 3.64 with the latest 64-bit version of VapourSynth.
That's probably wise. Last edited by Richard1485; 16th December 2017 at 17:49. |
16th December 2017, 17:52 | #12 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
I think I'm using this one https://forum.doom9.org/showthread.php?t=172808 |
|
16th December 2017, 18:43 | #15 | Link |
Guest
Posts: n/a
|
Got it! I removed core before adjust.Tweak() and moved import adjust so it came before core = vs.get_core(), and it's working. I think the VapourSynth port of Tweak() works like SmoothTweak() in AviSynth in that when one adjusts hue it shifts the chroma in a linear fashion along an axis. With the original Tweak(), I could rotate/turn the chroma like turning a key in a lock.
|
16th December 2017, 18:56 | #17 | Link |
Guest
Posts: n/a
|
In that case, I wish I could get the original one to work, but it doesn't. Maybe it's meant for 32-bit VapourSynth; I'm using the 64-bit version.
EDIT: It's a shame that one cannot have both approaches to hue. The ability to rotate the chroma is useful, in my opinion. |
16th December 2017, 19:18 | #18 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
If you want to use both at the same time, just rename one (e.g adjust2.py) and use a different namespace e.g import adjust2 as adjust2 Code:
import vapoursynth as vs import adjust import adjust2 as adjust2 core = vs.get_core() #clip = whateversourcefilter() clip = adjust.Tweak(clip, hue=20) clip = adjust2.Tweak(clip, huev=10) clip.set_output() Last edited by poisondeathray; 16th December 2017 at 19:22. |
|
|
|