Log in

View Full Version : Vapoursynth


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 [45] 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

Myrsloik
21st August 2016, 22:15
R33 RC2 32 portable (https://dl.dropboxusercontent.com/u/73468194/VapourSynth32-Portable-R33-RC2.7z)

R33 RC2 64 portable (https://dl.dropboxusercontent.com/u/73468194/VapourSynth64-Portable-R33-RC2.7z)

This should be the final rc I guess. Test it well. Will release in 3 days or so if no major bugs are found.

Selur
22nd August 2016, 04:29
Thanks.

Myrsloik
23rd August 2016, 17:01
R33 is released!!!!!1111 :eek:

The usual blog post is here (http://www.vapoursynth.com/2016/08/r33-a-somewhat-experimental-release/).

VS_Fan
23rd August 2016, 21:03
Happy 5th birthday VS !!! 2 days in advance :D:D:D

Thanks Myrsloik :)

feisty2
23rd August 2016, 21:13
Why is there a huge date gap like over a year between #1 and #2?
What happened?
edit: typo

Myrsloik
23rd August 2016, 21:13
Happy 5th birthday VS !!! 2 days in advance :D:D:D

Thanks Myrsloik :)
According to my calculations it's 4 years but maybe you started being a fan before VS turned into a mainstream sellout:D

Reel.Deel
24th August 2016, 00:31
Happy 5th birthday VS !!! 2 days in advance :D:D:D

Thanks Myrsloik :)

I remember when it was just a baby. :D

But yeah, VS has come a long way since then. Kudos to Myrsloik, jackoneill, and everyone else who has contributed. :thanks:

I used it before it was cool! :p

hydra3333
24th August 2016, 02:55
QTGMC (and other complex scripts) speed comparisons with R32 are also welcome. I'm curious how bug different it makes. Just remember to replace the relevant removegrainmodes first.
This is an important filtering announcement: Stop using RemoveGrain! ...at least some of the modes.

Several RemoveGrain functions have now gotten better substitutes in the core that support float as well.
Mode 4 replacement (always same speed or faster, much faster for 8bit): Median() http://www.vapoursynth.com/doc/functions/median.html
Mode 20 replacement (always same speed or faster): Convolution(matrix=[1, 1, 1, 1, 1, 1, 1, 1, 1]) http://www.vapoursynth.com/doc/functions/convolution.html
Mode 19 replacement (about half as fast): Convolution(matrix=[1, 1, 1, 1, 0, 1, 1, 1, 1]) http://www.vapoursynth.com/doc/functions/convolution.html
Mode 11&12 replacement (about half as fast): Convolution(matrix=[1, 2, 1, 2, 4, 2, 1, 2, 1]) http://www.vapoursynth.com/doc/functions/convolution.html

OK, QTGMC is in HAvsFunc which uses removegrain http://forum.doom9.org/showthread.php?p=1603176#post1603176. Per http://forum.doom9.org/showthread.php?p=1777252#post1777252 I have a local copy of HAvsFunc R23 with a change to temporalsoften (not in r23), do I also need to find and change these two uses of removegrain in it ?
Mode 4 replacement (always same speed or faster, much faster for 8bit): Median()
Mode 20 replacement (always same speed or faster): Convolution(matrix=[1, 1, 1, 1, 1, 1, 1, 1, 1])
Or, is there likely to be an updated HAvsFunc in the near future ?

edit:
Especially with scripts with fmtconv and removegrain replaced.
same thing applies for uses of fmtconv I suppose, any hints on what to change ?

AzraelNewtype
24th August 2016, 07:26
Using rgvs.RemoveGrain still works, it's just often slower. fmtconv also still works, it's just that there's less reason to bother with it now that the z.img based internal resizers support left-top/width-height offsets. It may have just gotten a speed boost too, but I forget now. There are still a couple extremely niche uses for fmtconv over the internal, but they are much rarer (invks, or the need for specialized dither patterns that mostly aren't going to survive lossy encoding anyway).

You should definitely swap them out anyway and run some tests, because everybody likes numbers. Hell, do tests at every individual replacement point. Go hog wild. Then you can even pull request the updated version for HolyWu, so the changes don't have to be duplicated by hand.

Myrsloik
24th August 2016, 12:09
I released R33.1 because memory leaks suck.

Boulder
24th August 2016, 16:25
While trying to build VapourSynth with MSVC 2015 (I like to play around with these open source projects to learn things), I get a bit of errors when zimg is being compiled and also a fair amount of other warnings/errors. I don't recall seeing these before. Did something change so that building with MSVC is not as straightforward as it used to be?

http://pastebin.com/8map1cJQ

Myrsloik
24th August 2016, 16:31
While trying to build VapourSynth with MSVC 2015 (I like to play around with these open source projects to learn things), I get a bit of errors when zimg is being compiled and also a fair amount of other warnings/errors. I don't recall seeing these before. Did something change so that building with MSVC is not as straightforward as it used to be?

http://pastebin.com/8map1cJQ

You have update 3 installed too, right?

Boulder
24th August 2016, 16:39
For some reason I thought Windows Update would have handled it but apparently not..at least the installer didn't complain. I'll install it and see what happens.

EDIT: works fine after installing update 3. What is Microsoft Update good for if it doesn't update Microsoft products automatically?:angry:

jackoneill
26th August 2016, 09:06
What is wrong with VapourSynth's plugin autoloading? I've seen several people using walls of LoadPlugin. What is the point?

mikewando
26th August 2016, 09:54
genericfilters is no longer included with the installer and has been deprecated for a long time, if you for some reason miss canny simply use the tcanny plugin instead for a better implementation
So I literally wrote a script with generic.GBlur(sigma=2.83) yesterday. My impression is that I should be able to replace it with some std.Convolution(matrix=[...])? To be honest I'm having a hard time replicating the output... I just can't seem to get a strong blur out of std.Convolution() no matter what kernel I try. Could someone who understands the math help me out or at least point me in the right direction? Or if someone just has a good way to get a (really) strong blur other than calling generic.GBlur(sigma=2.83) 50 times (literally) I'd be interested.

Alternatively, if someone has an elegant way to generate a gradient that would be helpful. A simple GRAY8 white to black horizontal gradient is really all I'm trying to get (for a mask in a screen wipe). At this point I probably could've just made a bitmap in gimp, but I also feel like I should be able to do it programatically.

jackoneill
26th August 2016, 10:14
So I literally wrote a script with generic.GBlur(sigma=2.83) yesterday. My impression is that I should be able to replace it with some std.Convolution(matrix=[...])? To be honest I'm having a hard time replicating the output... I just can't seem to get a strong blur out of std.Convolution() no matter what kernel I try. Could someone who understands the math help me out or at least point me in the right direction? Or if someone just has a good way to get a (really) strong blur other than calling generic.GBlur(sigma=2.83) 50 times (literally) I'd be interested.

Alternatively, if someone has an elegant way to generate a gradient that would be helpful. A simple GRAY8 white to black horizontal gradient is really all I'm trying to get (for a mask in a screen wipe). At this point I probably could've just made a bitmap in gimp, but I also feel like I should be able to do it programatically.


stripes = []

for i in range(256):
stripes += core.std.BlankClip(format=vs.GRAY8, color=i, width=1)

gradient = core.std.StackHorizontal(stripes)

AzraelNewtype
26th August 2016, 10:19
Not making any guarantees, but try using TCanny with mode=-1 for your gaussian blur needs. Actually, it's possible the gradient map mode can be hit with a hammer to serve your purposes too.

Also what jackoneill said, to avoid the problem entirely.

Myrsloik
26th August 2016, 10:21
So I literally wrote a script with generic.GBlur(sigma=2.83) yesterday....

The reason you don't get the same blur is because GBlur with those settings has radius 8. I bet the convolutions you tried had a much smaller radius. And what jackoneill said.

DarkSpace
26th August 2016, 13:35
or it could be something like this, even, which avoids the list.append stuff entirely:


stripes = [core.std.BlankClip(format=vs.GRAY8, color=i, width=1) for i in range(256)]

Selur
26th August 2016, 17:43
What is wrong with VapourSynth's plugin autoloading? I've seen several people using walls of LoadPlugin. What is the point?
Personally I don't like autoloading since:
a. I usually prefer a portable version
b. I generate my scripts and it's easier to debug if you know what is loaded and what isn't.

Myrsloik
26th August 2016, 17:49
Spoiler: the portable version has autoloading too

Selur
26th August 2016, 17:51
yes, but only if only use it for the filters that come with Vapoursynth, the others are in separate sub-folders. ;)

hydra3333
27th August 2016, 01:41
What is wrong with VapourSynth's plugin autoloading? I've seen several people using walls of LoadPlugin. What is the point?I would be one. Personal preference and habit; like an explicit typing standard in the old days, it is in your face.

trip_let
27th August 2016, 22:32
Quick question: in R33, (old) planestats MinMax got split into separate Min and Max, but how?

The (old) planestats MinMax[0] is now what, Min? And (old) MinMax[1] would be Max? Or what?

Thanks.

Myrsloik
27th August 2016, 23:09
Quick question: in R33, (old) planestats MinMax got split into separate Min and Max, but how?

The (old) planestats MinMax[0] is now what, Min? And (old) MinMax[1] would be Max? Or what?

Thanks.

Yes

Filler

mikewando
9th September 2016, 02:47
gradient = core.std.StackHorizontal(stripes)

Ahh stacking, yes that seems so obvious now.


As a side note, the bilateral plugin also contains a gaussian filter with different implementation (https://github.com/HomeOfVapourSynthEvolution/VapourSynth-Bilateral#gaussian). That filter is faster for very large sigma, as it's speed is independent of the radius.
Thanks for the note, this also helped me out with a completely different instance in which I actually just wanted a strong blur.

Selur
10th September 2016, 12:05
using R33.1 64bit portable and:
# Imports
import sys
import os
import vapoursynth as vs
core = vs.get_core()
# Import Scripts Folder
scriptPath = 'G:/Hybrid/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Import havsfunc
import havsfunc as havsfunc
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading F:\TestClips&Co\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/TestClips&Co/test.avi", cache=0)
# adding 'G:\workspace\Hybrid\resources\background.png' using Overlay
logo = core.imwri.Read(filename="G:/workspace/Hybrid/resources/background.png")
clip = havsfunc.Overlay(clipa=clip, clipb=logo)
# Output
clip.set_output()
I get:
Failed to evaluate the script:
Python exception: No attribute with the name imwri exists. Did you mistype a plugin namespace?
Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1491, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26905)
File "H:\Temp\tempPreviewVapoursynthFile12_54_07_495.vpy", line 16, in <module>
logo = core.imwri.Read(filename="G:/workspace/Hybrid/resources/background.png")
File "src\cython\vapoursynth.pyx", line 1105, in vapoursynth.Core.__getattr__ (src\cython\vapoursynth.c:20799)
AttributeError: No attribute with the name imwri exists. Did you mistype a plugin namespace?
Is there something wrong with the documentation at http://www.vapoursynth.com/doc/plugins/imwri.html or am I missing something?

Cu Selur

Ps.: also tried 'imwrif' as name, but that also isn't right, also there doesn't seem to be a specific .dll for the reader inside the coreplugins-folder, should there be?

captaiŋadamo
10th September 2016, 17:36
com.vapoursynth.imwrif is the namespace according to the source code.

Selur
10th September 2016, 17:46
So instead of 'core.imwri.Read' I should use 'com.vapoursynth.imwrif.Read' or should it be 'vs.imwrif.Read' (since I imported vapoursynth as vs), or something totally different ?

sneaker_ger
10th September 2016, 17:55
Unless something has changed it is not included in the official Windows packages.
http://forum.doom9.org/showthread.php?p=1731196#post1731196

Selur
10th September 2016, 18:13
Okay thanks, that post and the follwing explain that.
It's listed as included in the docs:
http://www.vapoursynth.com/doc/includedplugins.html
....
That should be read as "included in the source tree"
WTF? Found a download at http://forum.doom9.org/showthread.php?p=1769737#post1769737

Out of curiosity: Why isn't it included in the release packages/installer? License issues?

sneaker_ger
10th September 2016, 18:15
Read again.

captaiŋadamo
10th September 2016, 18:17
Selur, the linked post says it's not included due to its size.

Myrsloik
10th September 2016, 18:18
Okay thanks, that post and the follwing explain that.

WTF? Found a download at http://forum.doom9.org/showthread.php?p=1769737#post1769737

Out of curiosity: Why isn't it included in the release packages/installer? License issues?

It's also not included because it has serious issues and debugging or even compiling a working version is near impossible.

Selur
10th September 2016, 18:18
Sorry, overlooked that.
@myrsloik: than don't put it under 'included plugins', that is way confusing, also see documentation seems to be of since it states 'imwri' and not 'imwrif'.

Selur
10th September 2016, 19:10
# Imports
import sys
import os
import vapoursynth as vs
core = vs.get_core()
# Import Scripts Folder
scriptPath = 'G:/Hybrid/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Import havsfunc
import havsfunc as havsfunc
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/Imagemagick/libimwri.dll")
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading F:\TestClips&Co\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/TestClips&Co/test.avi", cache=0)
# adding 'F:\TestClips&Co\background.png' using Overlay
logo = core.imwrif.Read(filename="F:/TestClips&Co/background.png")
logo = core.resize.Bicubic(clip=logo, format=vs.YUV420P8, matrix_s="709")
clip = havsfunc.Overlay(clipa=clip, clipb=logo)
# Output
clip.set_output()
seems to do the job now, only problem is that this way, the alpha channel of the logo isn't transparent. :(

In case this is even possible with Vapoursynth atm.: before I send another few hours trying to figure stuff out, does anyone know how to add a logo with a transparent background onto a video and could post a sample?
My guess atm. is that I probably need to use 'alpha=True' with imwrif, when get a logo and an alpha gray scale and somehow apply those to the video.

Myrsloik
10th September 2016, 19:31
# Imports
import sys
import os
import vapoursynth as vs
core = vs.get_core()
# Import Scripts Folder
scriptPath = 'G:/Hybrid/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Import havsfunc
import havsfunc as havsfunc
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/Imagemagick/libimwri.dll")
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading F:\TestClips&Co\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/TestClips&Co/test.avi", cache=0)
# adding 'F:\TestClips&Co\background.png' using Overlay
logo = core.imwrif.Read(filename="F:/TestClips&Co/background.png")
logo = core.resize.Bicubic(clip=logo, format=vs.YUV420P8, matrix_s="709")
clip = havsfunc.Overlay(clipa=clip, clipb=logo)
# Output
clip.set_output()
seems to do the job now, only problem is that this way, the alpha channel of the logo isn't transparent. :(

In case this is even possible with Vapoursynth atm.: before I send another few hours trying to figure stuff out, does anyone know how to add a logo with a transparent background onto a video and could post a sample?
My guess atm. is that I probably need to use 'alpha=True' with imwrif, when get a logo and an alpha gray scale and somehow apply those to the video.

Yes, alpha=true and then use maskedmerge assuming you're applying it to something with the same format.

Selur
10th September 2016, 19:41
Would be nice if you or someone else could post a simple example.
I got a YUV420P8 clip (640x352) and a png (100x84 8bit) and maskedmerge requires clips with the same dimension.

trip_let
10th September 2016, 22:54
Would be nice if you or someone else could post a simple example.
I got a YUV420P8 clip (640x352) and a png (100x84 8bit) and maskedmerge requires clips with the same dimension.

Pad or resize the image to 640x352. There's AddBorders (http://www.vapoursynth.com/doc/functions/addborders.html) and the usual resizers. Or maybe I misunderstand the intent.

Selur
10th September 2016, 22:58
@trip_let: simply add ?black? borders to both the logo and the alpha channel? does that make sense?

trip_let
11th September 2016, 00:31
@trip_let: simply add ?black? borders to both the logo and the alpha channel? does that make sense?

Erm, not sure how Overlay works. Never used it.

You may want to use the mask parameter, specifying that you're allowing a change in the part where you're putting the logo (area where the mask is white), and not allowing a change elsewhere (area where the mask is black).

# black clip the size of logo
mask = core.std.BlankClip(logo)
# now change to white
mask = core.std.Invert(mask)
# add black borders to right and bottom of the area (apply logo to upper-left)
mask = core.std.AddBorders(mask, right=clip.width-logo.width, bottom=clip.height-logo.height)

warning: didn't test; am not a regular user of these functions and not that familiar with VS


Or I guess if you max out the alpha in the logo for the garbage/padding, it would be 100% transparent and not change the picture there. That's probably easier, actually.

Selur
11th September 2016, 06:49
@HolyWu: as I understood it alphy=True returns two clips, don't I need to take both?
[logo, alpha] = core.imwrif.Read(filename="F:/TestClips&Co/background.png", alpha=True)
-> okay forget that just understood the [0] and [1] part

tried:
# Imports
import sys
import os
import vapoursynth as vs
core = vs.get_core()
# Import Scripts Folder
scriptPath = 'G:/Hybrid/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Import havsfunc
import havsfunc as havsfunc
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/Imagemagick/libimwri.dll")
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/LSmashSource/vslsmashsource.dll")
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/Support/fmtconv.dll")
# Loading F:\TestClips&Co\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/TestClips&Co/test.avi", cache=0)
# adding 'F:\TestClips&Co\background.png' using Overlay
[logo, alpha] = core.imwrif.Read(filename="F:/TestClips&Co/background.png", alpha=True)
logo = core.resize.Bicubic(clip=logo, format=clip.format.id, matrix_s="709")
alpha = core.fmtc.bitdepth(clip=alpha, bits=clip.format.bits_per_sample)
clip=havsfunc.Overlay(clipa=clip, clipb=logo, mask=alpha)
# Output
clip.set_output()
but that still ignored the alpha (background all black)
https://s15.postimg.org/uc46pwdiv/test_vpy_0.png (https://postimg.org/image/uc46pwdiv/)

Selur
11th September 2016, 08:34
]Here's the png I used. :D

Cu Selur

Selur
11th September 2016, 10:19
Thanks! That works!
Positioning and only showing the logo for a short time works fine too:
# Imports
import sys
import os
import vapoursynth as vs
core = vs.get_core()
# Import Scripts Folder
scriptPath = 'G:/Hybrid/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Import havsfunc
import havsfunc as havsfunc
# Loading Plugins
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/Imagemagick/libimwri.dll")
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/Support/fmtconv.dll")
core.std.LoadPlugin(path="G:/Hybrid/Vapoursynth/vapoursynth64/plugins/SourceFilter/LSmashSource/vslsmashsource.dll")
# Loading F:\TestClips&Co\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="F:/TestClips&Co/test.avi", cache=0)
# adding 'F:\TestClips&Co\background.png' using Overlay
[logo, alpha] = core.imwrif.Read(filename="F:/TestClips&Co/background.png", alpha=True)
logo = core.resize.Bicubic(clip=logo, format=clip.format.id, matrix_s="709")
alpha = core.fmtc.bitdepth(clip=alpha, bits=clip.format.bits_per_sample, fulld=True).std.Invert()
beforeLogo = core.std.Trim(clip,last=49)
selection = core.std.Trim(clip,first=50,last=100)
afterLogo = core.std.Trim(clip,first=101)
selection = havsfunc.Overlay(clipa=selection, clipb=logo, mask=alpha, x=20, y=40)
clip = beforeLogo + selection + afterLogo
# Output
clip.set_output()

-> Next question: How to fade the logo in and out over x frames?

Cu Selur

splinter98
12th September 2016, 20:42
-> Next question: How to fade the logo in and out over x frames?


Try my crossfade function from: http://forum.doom9.org/showthread.php?p=1755234#post1755234

Selur
12th September 2016, 20:44
Will do :) Thanks!

aculnaig
13th September 2016, 11:37
Can't build vapoursynth ( gcc (GCC) 6.2.1 20160830 )

VapourSynth ( latest git )

git describe --tags
R33.1-18-gf65402b


zimg ( latest git )

git describe --tags
release-2.2.1-13-g1855661



Errors


src/core/vsresize.cpp:33:2: error: #error zAPI v2 or greater required
#error zAPI v2 or greater required
^~~~~


src/core/vsresize.cpp:121:23: error: ‘ZIMG_TRANSFER_ST2084’ was not declared in this scope
{ "st2084", ZIMG_TRANSFER_ST2084 },
^~~~~~~~~~~~~~~~~~~~
src/core/vsresize.cpp:122:23: error: ‘ZIMG_TRANSFER_ARIB_B67’ was not declared in this scope
{ "std-b67", ZIMG_TRANSFER_ARIB_B67 },
^~~~~~~~~~~~~~~~~~~~~~
src/core/vsresize.cpp:123:5: error: no matching function for call to ‘std::unordered_map<std::__cxx11::basic_string<char>, zimg_transfer_characteristics_e>::unordered_map(<brace-enclosed initializer list>)’
};

src/core/vsresize.cpp:760:26: error: ‘struct vszimgxx::zfilter_graph_builder_params’ has no member named ‘nominal_peak_luminance’
m_params.nominal_peak_luminance = propGetScalarDef<double>(in, "nominal_luminance", NAN, vsapi);

Myrsloik
13th September 2016, 11:38
You need to use the hdr branch of zimg to build it.

aculnaig
13th September 2016, 12:26
Thanks, It worked.

Sm3n
13th September 2016, 13:15
Hello,

can you tell me if my guesses are true. Can I compile zimg on debian?
if yes why can't I compile it? Not sure I actualy can.
System: Debian wheezy x64

Here is my error code: http://paste2.org/tgXKhezc

cheers in advance