View Full Version : Vapoursynth
Selur
12th October 2021, 17:18
@lansing:
The point was if anyone did have a function which would take:
a. a clip
b. rectangle coordinates+size
c. a filter + parameters
d. a frame range
which would:
only apply the filter on the rectangle and the frames.
So the function basically should only for the frames in the range.
1. take the source, crop out the recangle
2. filter the rectangle
3. replace the space of the rectangle with the filtered rectangle
The main point is not filter the whole clip and all the whole frame.
@_AI_: I somehow totally missed the link to the animate.py, that does help.
Thanks! I need to play around with this. :)
Cu Selur
Myrsloik
12th October 2021, 20:44
R57 (https://github.com/vapoursynth/vapoursynth/releases/tag/R57)!
r57:
added close method for frames in python (cid-chan)
arguments names will no longer have leading _ stripped in python, append _ to the end or argument names instead to avoid python keywords
fixed nodes never being marked as nfnocache/nfiscache in api3 which caused some older applications to enter an infinite cache insertion loop
fixed memory bloat in python due to circular references when dealing with frame objects
fixed vsrepo missing genstubs files
fixed vfw and avfs speed regression from r55
fixed mismatched format clips not working regression from r55
ChaosKing
12th October 2021, 22:36
Vapoursynth still has no official logo. How about something like this?
https://i.imgur.com/Kp7yTaB.png
https://i.imgur.com/VCyqIVE.png
https://i.imgur.com/UIZ4bpG.png
https://i.imgur.com/aLfzZ2L.png
LigH
13th October 2021, 09:11
Once upon a time I suggested something based on the Python snake icon and a film roll.
https://www.ligh.de/pics/VapourSynth_FilmClip.png
lansing
13th October 2021, 15:03
Last month was Vapoursynth 9th anniversary too
poisondeathray
13th October 2021, 17:57
I liked LigH's idea, because python is a central component to vapoursynth, and animated the filmstrip
https://forum.doom9.org/showthread.php?p=1847472#post1847472
Here is a revised version with text
https://i.postimg.cc/Vkv1q49J/vapoursynth-pythonfilm-v3-320x320.gif
l33tmeatwad
14th October 2021, 18:40
You can't just use the Python logo without permission as it's copyrighted.
LigH
15th October 2021, 09:00
Thank you for the reminder; still, one could ask for permission when it gets serious...
lansing
17th October 2021, 05:37
How do I load in an audio file in the script? I couldn't find it in the documentation
l33tmeatwad
17th October 2021, 05:48
Use best audio source, then you'll have to set two outputs, one for video and one for audio.
lansing
17th October 2021, 06:08
Use best audio source, then you'll have to set two outputs, one for video and one for audio.
I tried to load this in media player classic but it gives me the error "output index 0 is not video"
clip = core.dgdecodenv.DGSource(r"clip.dgi")
audio = core.bas.Source(r"audio_file.flac")
clip.set_output()
audio.set_output()
l33tmeatwad
17th October 2021, 06:10
You need to put 0 for video and 1 for audio in the parenthesis.
lansing
17th October 2021, 06:16
You need to put 0 for video and 1 for audio in the parenthesis.
Now the program crashed with "access violation"
"crashing modules: C:\Program Files\VapourSynth\core\vsvfw.dll"
Izuchi
18th October 2021, 13:18
How do I output 32-bit float video using vspipe? It seems to just give me green garbage.
Yomiko
18th October 2021, 14:42
How do I output 32-bit float video using vspipe? It seems to just give me green garbage.
That looks right if the output is interpreted as YUV in integer format
poisondeathray
18th October 2021, 15:25
How do I output 32-bit float video using vspipe? It seems to just give me green garbage.
YUV444PS or RGBS ? Not many programs will understand YUV444PS
What program are you piping into ?
For ffmpeg/libavcodec, you can vspipe rawvideo as RGBS and use -pix_fmt gbrpf32le in ffmpeg
Izuchi
18th October 2021, 20:26
Was hoping to output YUV420PS as an intermediary file after running BM3D CUDA and then inserting it back into the script. Is RGB my only option?
poisondeathray
18th October 2021, 21:50
Was hoping to output YUV420PS as an intermediary file after running BM3D CUDA and then inserting it back into the script. Is RGB my only option?
Even if you vspipe it to something , I do not know of any file format that you could read for YUV420PS. The raw reader in vapousynth does not support float, only up to 16bit int formats. All vapoursynth imwri reads are in RGB , even if source was YUV. (jpeg, YUV tiff)
For intermediate files, you could stay in vapoursynth by using imrwi to read/write a RGBS TIFF sequence, without vspipe or other programs . (The current imwri.write implementation only writes RGBH in EXR, but RGBS is ok in TIFF). If you use resize.Point it should be lossless from YUV420PS <=> RGBS . Make sure you use float_output=True for the imwri.Read step.
And how did you YUV420PS to work in vapoursynth ? I couldn't import it from core , and get "module 'vapoursynth' has no attribute 'YUV420PS'" error
Izuchi
18th October 2021, 22:57
Yeah YUV420PS didn't work for me either, it just returned garbage pixels ffms2 just reads it as YUV420P8 with only a single frame. Thanks for tip, I might try piping it to ffmpeg.
Izuchi
18th October 2021, 23:37
Would this be the correct command? vspipe script.vpy - | ffmpeg -f rawvideo -pix_fmt gbrpf32le -s 1920x1080 -r 24000/1001 -i - denoise.rgb
_Al_
19th October 2021, 00:51
no attribute 'YUV420PS'
former register_format(), now it is query_video_format(), I guess because of audio formats addition:
my_float_format = core.query_video_format(color_family=vs.YUV, sample_type=vs.FLOAT, bits_per_sample=32, subsampling_w=1, subsampling_h=1)
clip2 = clip.resize.Point(format=my_float_format)
print(clip2)
>>>
VideoNode
Format: YUV420PS32
poisondeathray
19th October 2021, 01:59
Would this be the correct command? vspipe script.vpy - | ffmpeg -f rawvideo -pix_fmt gbrpf32le -s 1920x1080 -r 24000/1001 -i - denoise.rgb
For raw RGB... but you can't read raw rgb float with vsrawsource. You would use denoise_%05d.exr for ffmpeg output, and imwri.Read with float_output=True for import back into vapoursynth. But there are issues with that workflow for some reason, it's not lossless if you check MakeDiff, I'm looking into it.
But if you use imwri.Write in vapoursynth it's lossless
output
clip = core.imwri.Write(clip, "TIFF", "imwri_Write_%05d.tiff",firstnum=0)
reimport
clipc = core.imwri.Read(r'imwri_Write_%05d.tiff', float_output=True)
poisondeathray
19th October 2021, 02:04
former register_format(), now it is query_video_format(), I guess because of audio formats addition:
my_float_format = core.query_video_format(color_family=vs.YUV, sample_type=vs.FLOAT, bits_per_sample=32, subsampling_w=1, subsampling_h=1)
clip2 = clip.resize.Point(format=my_float_format)
print(clip2)
>>>
VideoNode
Format: YUV420PS32
Thanks it works.
I remember asking about not included pixel formats and Holy Wu told me about register_format - I should have remembered
https://forum.doom9.org/showthread.php?p=1904930#post1904930
Myrsloik
19th October 2021, 10:44
Thanks it works.
I remember asking about not included pixel formats and Holy Wu told me about register_format - I should have remembered
https://forum.doom9.org/showthread.php?p=1904930#post1904930
How did you end up with YUV420PS in the first place? Subsampled float is a quite weird thing to have
poisondeathray
19th October 2021, 15:21
How did you end up with YUV420PS in the first place? Subsampled float is a quite weird thing to have
It was not for me, scroll up a few posts
Quadratic
20th October 2021, 12:21
How did you end up with YUV420PS in the first place? Subsampled float is a quite weird thing to have
Why is YUV420PS "weird"? It can be achieved with vsutil and fmtc. It is not uncommon.
Myrsloik
20th October 2021, 12:31
Why is YUV420PS "weird"? It can be achieved with vsutil and fmtc. It is not uncommon.
It's a very inefficient use of bits. You'd have an image that definitely looks better with full resolution chroma in YUV444P16 format and smaller size.
Julek
22nd October 2021, 15:17
Now I need some input on which frame statistics to implement. If you generalize all of the functions in avisynth you get these 6 left. I've seen that difference is used a lot but are there any of these I could skip? I can't remember seeing the min/max/median used ever.
You can also suggest new ones if they're not too complicated.
Average(clip)
Difference(clip1, clip2)
PlaneMax(clip, float threshold)
PlaneMin(clip, float threshold)
PlaneMedian(clip)
PlaneMinMaxDifference(clip, float threshold)
The full list here:
http://avisynth.org/mediawiki/ScriptClip
Any chance to implement threshold for Min/Max now?
Dogway's retinex uses this, I know there is a plugin for it, but the output is not the same and I wanted to do some tests, if possible.
Dogway
22nd October 2021, 15:53
Vapoursynth still has no official logo. How about something like this?
https://i.imgur.com/Kp7yTaB.png
https://i.imgur.com/VCyqIVE.png
https://i.imgur.com/UIZ4bpG.png
https://i.imgur.com/aLfzZ2L.png
Beautiful logos! I like 3rd and 4th the best. 4th looks more like consumer oriented, it's third or fourth in neutral tones.
groucho86
22nd October 2021, 16:46
Hi everyone,
I opened an issue on github (https://github.com/vapoursynth/vapoursynth/issues/823) but thought it may be worth posting here. I installed Vapoursynth R57 and imwri via homebrew and am trying to load a half-float EXR (https://github.com/vapoursynth/vapoursynth/files/7398013/halffloat.001.exr.zip).
clip = core.imwri.Read(filename='halffloat.%03d.exr', firstnum=1,
float_output=True)
print(clip.get_frame(0))
Returns:
Filter Read returned a frame that's not of the declared format
VapourSynth encountered a fatal error: Filter Read returned a frame that's not of the declared format
libc++abi.dylib: terminating
float_output set to False works.
Yomiko
23rd October 2021, 09:34
What's the reason for not allowing a GRAY plane extracted from an RGB clip resized to RGB because of its tagged matrix? It seems the matrix itself (if supported by VS) doesn't affect the output result.
vxzms
23rd October 2021, 14:00
Would you plan to let the vspipe’s filter-time also show namespace? I think it would be more intuitive.
Myrsloik
23rd October 2021, 14:12
Would you plan to let the vspipe’s filter-time also show namespace? I think it would be more intuitive.
Filter don't have a namespace but the functions that create them may or may not. So it's actually very hard to add what you'd expect as the namespace to your list.
If anything extending the graph output with time spent in various filters is probably the best way since then you can see which function is responsible.
GB452
24th October 2021, 22:11
Having a very strange issue: vsrepo can't detect VapourSynth. I had updated to VS 57, but had some issues (including this one) and uninstalled it and went back to what I was using previously, version 54, but I keep getting this error and I cannot find any suggestions on how to fix it online.
https://i.imgur.com/yFFP3lE.png
ChaosKing
24th October 2021, 22:14
Same happend to me after updating to R57.
Yomiko
25th October 2021, 00:37
What's the reason for not allowing a GRAY plane extracted from an RGB clip resized to RGB because of its tagged matrix? It seems the matrix itself (if supported by VS) doesn't affect the output result.
Meanwhile GRAY clip with unspec matrix can be resampled. A bug?
Myrsloik
25th October 2021, 10:41
Meanwhile GRAY clip with unspec matrix can be resampled. A bug?
No, gray clips are the Y in YUV so the same rules apply. You can resize unknown matrix YUV but you can't convert it to RGB.
Selur
25th October 2021, 14:11
I'm on Ubuntu 20.04, I compiled and installed Vapoursynth R57.
I also compiled a bunch of filters to "/home/selur/opt/vapoursynth/lib/python3.8/site-packages"
paths seem to be correct:
echo $LD_LIBRARY_PATH
/home/selur/opt/vapoursynth/lib
echo $PYTHONPATH
/home/selur/opt/vapoursynth/lib/python3.8/site-packages
echo $PATH
/home/selur/.local/bin:/home/selur/opt/vapoursynth/bin:/home/selur/.local/bin:/home/selur/opt/vapoursynth/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
import vapoursynth as vs
core = vs.core
clip = core.std.BlankClip(format=vs.RGB24, color=[255, 255, 255])
clip = core.text.Text(clip, core.version())
clip.set_output()
works fine
explicit loading a library (libvslsmashsource.so):
import vapoursynth as vs
core = vs.core
core.std.LoadPlugin('/home/selur/opt/vapoursynth/lib/vapoursynth/libvslsmashsource.so')
clip = core.lsmas.LWLibavSource(source="test.mov", format="YUV422P10", cache=0, fpsnum=30000, fpsden=1001, prefer_hw=0)
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
clip.set_output()
works fine too,
but using:
import sys
import vapoursynth as vs
core = vs.core
sys.path.append('/home/selur/opt/vapoursynth/lib/vapoursynth')
clip = core.lsmas.LWLibavSource(source="test.mov", format="YUV422P10", cache=0, fpsnum=30000, fpsden=1001, prefer_hw=0)
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
clip.set_output()
doesn't.
It returns "Python exception: No attribute with the name lsmas exists. Did you mistype a plugin namespace?"
-> How can I tell Vapoursynth where to look for the libraries?
I though:
sys.path.append('/home/selur/opt/vapoursynth/lib/vapoursynth')
would do the trick, which it doesn't.
Cu Selur
Myrsloik
25th October 2021, 14:13
You're specifying the python search path, it's only used for import and similar python commands. You also shouldn't install filters in site-packages.
Selur
25th October 2021, 14:18
Sorry, my mistake. Didn't put the iflters in the site-packages. :)
site-packages only contains vapoursynth.la and vapoursynth.so
all compiled filters are in "/home/selur/opt/vapoursynth/lib/vapoursynth/"
Okay, so is there a way to somehow to use my folder as "/home/selur/opt/vapoursynth/lib/vapoursynth/" source for autoloading?
Selur
25th October 2021, 14:25
okay, forget it found it.
"$HOME/.config/vapoursynth/vapoursynth.conf "
with:
"SystemPluginDir=/home/selur/opt/vapoursynth/lib/vapoursynth"
works
Yomiko
25th October 2021, 14:39
Also this -> http://www.vapoursynth.com/doc/functions/general/loadallplugins.html
Selur
25th October 2021, 14:56
Uhhh,.. didn't know "LoadAllPlugins" :)
_Al_
25th October 2021, 16:21
oh, was LoadAllPlugins introduced with new API release or does it work with older releases too?
lansing
26th October 2021, 06:03
When creating filter, where do we put the xyvInit() initial function in API4 now? It was gone in the example filter. And in the createVideoFilter(), there are this two lines in the example script:
VSFilterDependency deps[] = {{d.node, rpStrictSpatial}};
vsapi->createVideoFilter(out, "Invert", vi, invertGetFrame, invertFree, fmParallel, deps, 1, data, core);
What is the VSFilterDependency and numDeps do? The documentation is lacking.
Myrsloik
26th October 2021, 10:27
When creating filter, where do we put the xyvInit() initial function in API4 now? It was gone in the example filter. And in the createVideoFilter(), there are this two lines in the example script:
VSFilterDependency deps[] = {{d.node, rpStrictSpatial}};
vsapi->createVideoFilter(out, "Invert", vi, invertGetFrame, invertFree, fmParallel, deps, 1, data, core);
What is the VSFilterDependency and numDeps do? The documentation is lacking.
1. You have a function that calls createVideoFilter(), put it there instead. Most filters are already written that way.
2. It's an array where you list all the nodes and in which order you will request frames from them to generate the output. StrictSpatial is obviously for spatial only filters, NoFrameReuse is for reordering filters of certain types (basically if you request all output frames once none of the input frames will be requested twice, trim, splice and similar fit into this category). General is for everything else.
NumDeps is simply how items are in the deps array.
lansing
26th October 2021, 23:46
Okay got it. Also can you add some example filter written in c++? Because when I got stuck with the c syntax, I couldn't find any other example because everybody was writing in c++. For example, I want to use the isConstantVideoFormat() from the VSHelper4.h, I included the header file in my c file #include "VSHelper4.h", but visual studio still couldn't recognize the function.
DJATOM
27th October 2021, 00:08
Use vsh::yourCalledFunction.
lansing
27th October 2021, 01:33
Use vsh::yourCalledFunction.
using namespace is a c++ thing
WolframRhodium
27th October 2021, 04:26
vsh_yourCalledFunction
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.