View Full Version : Vapoursynth
Selur
27th September 2021, 04:26
On Windows 10 64bit with https://www.videohelp.com/software/HuffYUV 64bit installed.
Opening a "Authors.avi" (https://drive.google.com/file/d/1-25kJLVqpVsPjTigDQLD3eppGSSLUyQR/view?usp=sharing) using R54-API3 portable with AviSource I get "AVISource: couldn't locate a decompressor for fourcc ffds".
MediaInfo reports:
Video
Count : 377
Count of stream of this kind : 1
Kind of stream : Video
Kind of stream : Video
Stream identifier : 0
StreamOrder : 0
ID : 0
ID : 0
Format : HuffYUV
Format : HuffYUV
Commercial name : HuffYUV
Format version : Version 2
Codec ID : HFYU
Duration : 20000
Duration : 20 s 0 ms
Duration : 20 s 0 ms
Duration : 20 s 0 ms
Duration : 00:00:20.000
Duration : 00:00:20:00
Duration : 00:00:20.000 (00:00:20:00)
Bit rate : 27747450
Bit rate : 27.7 Mb/s
Width : 448
Width : 448 pixels
Height : 448
Height : 448 pixels
Pixel aspect ratio : 1.000
Display aspect ratio : 1.000
Display aspect ratio : 1.000
Frame rate : 25.000
Frame rate : 25.000 FPS
Frame count : 500
Color space : YUV
Chroma subsampling : 4:2:0
Chroma subsampling : 4:2:0
Bit depth : 8
Bit depth : 8 bits
Scan type : Progressive
Scan type : Progressive
Bits/(Pixel*Frame) : 5.530
Stream size : 69368624
Stream size : 66.2 MiB (100%)
Stream size : 66 MiB
Stream size : 66 MiB
Stream size : 66.2 MiB
Stream size : 66.16 MiB
Stream size : 66.2 MiB (100%)
Proportion of this stream : 0.99971
Opening the file in 64bit VirtualDub2 works fine.
Registry "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Drivers32" also lists "VIDC.HFYU".
Opening another file (https://drive.google.com/file/d/1GXGgyfiboPBrQrPWh9-ZlYArIgOcRoxQ/view?usp=sharing):
Video
Count : 377
Count of stream of this kind : 1
Kind of stream : Video
Kind of stream : Video
Stream identifier : 0
StreamOrder : 0
ID : 0
ID : 0
Format : HuffYUV
Format : HuffYUV
Commercial name : HuffYUV
Format version : Version 2
Codec ID : HFYU
Duration : 2503
Duration : 2 s 503 ms
Duration : 2 s 503 ms
Duration : 2 s 503 ms
Duration : 00:00:02.503
Duration : 00:00:02;15
Duration : 00:00:02.503 (00:00:02;15)
Bit rate : 56155667
Bit rate : 56.2 Mb/s
Width : 720
Width : 720 pixels
Height : 480
Height : 480 pixels
Pixel aspect ratio : 1.000
Display aspect ratio : 1.500
Display aspect ratio : 3:2
Frame rate : 29.970
Frame rate : 29.970 (30000/1001) FPS
FrameRate_Num : 30000
FrameRate_Den : 1001
Frame count : 75
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:2
Chroma subsampling : 4:2:2
Bit depth : 8
Bit depth : 8 bits
Scan type : Interlaced
Scan type : Interlaced
Bits/(Pixel*Frame) : 5.422
Delay : 0
Delay : 00:00:00.000
Stream size : 17566212
Stream size : 16.8 MiB (97%)
Stream size : 17 MiB
Stream size : 17 MiB
Stream size : 16.8 MiB
Stream size : 16.75 MiB
Stream size : 16.8 MiB (97%)
Proportion of this stream : 0.97199
works fine.
-> Can someone explain this?
Cu Selur
qyot27
27th September 2021, 10:34
HuffYUV only supports YUY2 and RGB(24|32). YV12 - and any of the other pix_fmts - is only a part of ffvhuff.
The FourCC 'ffds' == ffdshow. That first file was probably encoded by (or to be compatible with) ffdshow's VFW codec.
Yomiko
27th September 2021, 10:37
vs-removegrain has SIMD codes the meson script didn't consider. Maybe I will send a PR in a week.
Selur
27th September 2021, 17:16
HuffYUV only supports YUY2 and RGB(24|32). YV12 - and any of the other pix_fmts - is only a part of ffvhuff.
The FourCC 'ffds' == ffdshow. That first file was probably encoded by (or to be compatible with) ffdshow's VFW codec.
I thought the "Codec ID" of MediaInfo would show the fourcc.
richardpl
27th September 2021, 17:42
Both files decodes just fine with recent mpv/ffmpeg.
Selur
27th September 2021, 18:35
yeah, but that does not help with AviSource at all,...
Myrsloik
29th September 2021, 12:31
R56 released. A pile of fixes. Should be safe for general use now.
Selur
29th September 2021, 14:13
Thanks?
Will there be a R56-API3 portable release?
Cu Selur
Myrsloik
29th September 2021, 14:33
Thanks?
Will there be a R56-API3 portable release?
Cu Selur
No, there are no relevant changes for API3. Maybe next time. Go find bugs.
poisondeathray
29th September 2021, 16:26
Does core.avisource.AVISource work in API4?
I get "AttributeError: No attribute with the name avisource exists. Did you mistype a plugin namespace?"
ChaosKing
29th September 2021, 16:41
Does core.avisource.AVISource work in API4?
I get "AttributeError: No attribute with the name avisource exists. Did you mistype a plugin namespace?"
vsrepo install avisource
It's an external plugin now.
_Al_
29th September 2021, 17:23
Is there a list what plugins were taken out using API4?
I guess what is missing from core directory,.
What plugins hide under MiscFilters.dll?
Myrsloik
29th September 2021, 17:26
Is there a list what plugins were taken out using API4?
All of them. If you can't name them all here's the api3 source:
https://github.com/vapoursynth/vapoursynth/tree/api3/src/filters
_Al_
29th September 2021, 17:27
ok, thanks
lansing
29th September 2021, 17:27
R56 fixed the slow format conversion issue in R55, now the speed is back to the same as R54. Benchmarked with vspipe on 8000 frames of a 4K video.
vspipe 4k-video.vpy .
R54 R55 R56
4K original 191 147 198
4K => RGB24 183 141 185
4K => RGB30 165 130 173
4K => RGB48 174 127 175
4K => RGBS 155 87 157
l33tmeatwad
29th September 2021, 19:56
I've been a bit too busy to really keep up and I haven't been able to find an answer through my searching. For the filters listed as obsolete (vinverse, morpho, etc), did something replace those?
NullNix
29th September 2021, 20:29
R56 released. A pile of fixes. Should be safe for general use now.
Hm. I'm sorry to report that for my 1080p usage we are still a bit slower than R54 :( down from 6.9fps to 6.4, though better than R55's 6.2. I'll do some profile comparisons and try to figure out why. (A bit irritating to do, what with all the plugins needing downgrading too, but them's the breaks etc. I don't expect anyone to be able to diagnose it from *this* pathetic excuse for a problem report. That's on me.)
DJATOM
29th September 2021, 20:51
I'd suggest to create portable r54 and r56 and compare them without re-installation. You know, windows likes to cache dlls so you have to reboot across re-installs or might measure the wrong results.
l33tmeatwad
29th September 2021, 21:14
Having a weird issue with imwri, it appears to not autoload, but if I manually load it it works fine.
Myrsloik
29th September 2021, 21:27
I've been a bit too busy to really keep up and I haven't been able to find an answer through my searching. For the filters listed as obsolete (vinverse, morpho, etc), did something replace those?
avisource: ffms2 more or less, it works perfectly for avi
vinverse: only supports 8 bit and is very rarely used, I think havsfun (or some other big script) has a version that supports higher bitdepths in script form
morpho: maximum/minimum unless you want a weird shape, if you want a weird shape you're probably better of writing a faster plugin for that
miscfilters: averageframes was moved to the core, scdetect can be written as ~5 lines of script so it's pointless and Hysteresis is in a weird limbo where I just don't know what to do with it. A few things use it but it's too specific. So now it's a zombie filter.
eedi3: eedi3m which is much faster
NullNix
29th September 2021, 23:28
I'd suggest to create portable r54 and r56 and compare them without re-installation. You know, windows likes to cache dlls so you have to reboot across re-installs or might measure the wrong results.
Oh god that sounds awful: presumably clearing the cache requires involuntary blood donations or something like that, too (yeah, looking around the net, it seems to: there are at least three different sorts of cache and everyone seems to be arguing over whether most of them need flushing or even exist at all).
But no, this is a Linux-from-scratch box with most software installed via the Nix package manager[1] :) not very Windows-like at all, nor honestly very much like a normal Linux system, and thankfully quite amenable to this sort of "oh dammit I wanted to go back to $oldthing" approach. Indeed the old vapoursynth is still there and so are all its plugins: it doesn't get deleted until a month or so after I replace it, and I can go back at any time.
So I'm really whining for no reason at all and I should stop.
(Only downside: I work on tracing and debugging and profiling tools, so profiling vapoursynth is entirely too much like work! upside: I might be able to use it as a testcase for the tools I work on, and then it actually is work! :) )
[1] no relation
Myrsloik
30th September 2021, 15:09
With R56 released things are now stable enough I think the long conversion to API4 for most plugins can start. But not all types of plugins really benefit at all so here's a short summary of where you'll see actual differences. The main advantage of API4 is the reduced cache bloat in some instances and somewhat cleaner plugin API in general.
Plugins that definitely benefit:
Pure spatial filters - memory usage reduction
Frame reordering plugins where frames aren't reused (trim, splice, deleteframes style) - memory usage reduction
Source filters - alpha handling was changed (should now simply be attached as _Alpha instead of multi clip output) and nfMakeLinear deprecated (but still respected)
Filters (sources excluded) that use nfMakeLinear - need to use the new API to make things more linear again
Plugins nobody will know notice if you change:
Source filters that don't return alpha
Temporal filters
Frame reordering filter that reuses frames (freezeframe, separatefields)
MythCreator
1st October 2021, 14:22
mvsfunc raised an exception"module vapoursynth has no attribute 'YCgCo'", is it deleted or replaced by something else?
Julek
1st October 2021, 16:17
mvsfunc raised an exception"module vapoursynth has no attribute 'YCgCo'", is it deleted or replaced by something else?
https://github.com/AmusementClub/mvsfunc
MythCreator
1st October 2021, 17:31
https://github.com/AmusementClub/mvsfunc
Thx:D
Selur
2nd October 2021, 22:40
What am I missing:
# Loading J:\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="J:/test.avi", format="YUV420P8", cache=0, prefer_hw=0)
# making sure input color matrix is set as 2020cl
clip = core.resize.Bicubic(clip, matrix_in_s="2020cl",range_s="limited")
# making sure frame rate is set to 29.970
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# adjusting color space from YUV420P8 to RGBS
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="2020cl", range_s="limited")
clip.set_output()
fails with:
Resize error: Resize error 3074: invalid colorspace definition (10/2/2 => 0/2/2). May need to specify additional colorspace parameters.
if I use replace:
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="2020cl", range_s="limited")
with
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="2020ncl", range_s="limited")
decoding works. (Using R55 API3.6)
Cu Selur
Julek
3rd October 2021, 03:32
Try add a transfer_in_s
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, matrix_in_s="2020cl", transfer_in_s='2020_10', range_s="limited")
Selur
3rd October 2021, 10:04
@Julek: That worked. Thanks.
@devs: it would be reall helpfull if Vapoursynth could give a more specific error message.
Cu Selur
_Al_
4th October 2021, 03:04
Is there a way to run avisynth+ using vapoursynth portable, without installing avisynth? I have only 64bit AviSynth.dll and DevIL.dll they are both in same directory as Vapoursynth is.
I get:
Import: failed to get avisynth.dll
using still API3 not latest API4:
source_path = "avisynth_script.avs"
core.std.LoadPlugin('vsavsreader.dll')
clip = core.avsr.Import(source_path)
if isinstance(clip, tuple):
clip=clip[0]
Is there a way to use avisynth.dll, make avisynth+ work without putting it somewhere in windows directory or install it? To have it in a portable setup?
Myrsloik
6th October 2021, 19:07
R57-RC1 is out (https://github.com/vapoursynth/vapoursynth/releases/tag/R57-RC1)
r57:
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
DJATOM
6th October 2021, 20:00
Is there a way to run avisynth+ using vapoursynth portable, without installing avisynth? I have only 64bit AviSynth.dll and DevIL.dll they are both in same directory as Vapoursynth is.
I get:
Import: failed to get avisynth.dll
using still API3 not latest API4:
source_path = "avisynth_script.avs"
core.std.LoadPlugin('vsavsreader.dll')
clip = core.avsr.Import(source_path)
if isinstance(clip, tuple):
clip=clip[0]
Is there a way to use avisynth.dll, make avisynth+ work without putting it somewhere in windows directory or install it? To have it in a portable setup?
You can try that
import ctypes
ctypes.CDLL('path/to/avs_plus/dll')
Myrsloik
6th October 2021, 20:31
Is there a way to run avisynth+ using vapoursynth portable, without installing avisynth? I have only 64bit AviSynth.dll and DevIL.dll they are both in same directory as Vapoursynth is.
I get:
Import: failed to get avisynth.dll
using still API3 not latest API4:
source_path = "avisynth_script.avs"
core.std.LoadPlugin('vsavsreader.dll')
clip = core.avsr.Import(source_path)
if isinstance(clip, tuple):
clip=clip[0]
Is there a way to use avisynth.dll, make avisynth+ work without putting it somewhere in windows directory or install it? To have it in a portable setup?
I suspect it'll work if you put avisynth.dll in the same dir as the script. Or just modify the PATH before running commands and add whatever location there.
_Al_
7th October 2021, 16:04
That really works, thank you!
import ctypes
ctypes.CDLL('./AviSynth.dll')
core.std.LoadPlugin('vsavsreader.dll')
clip = core.avsr.Import('source.avs')
if isinstance(clip, (tuple,list)):
clip = clip[0]
Avisynth plugins need to be loaded in Avisynth script
Can be avs script loaded to vapoursynth now, is it built in, I could not figure it out if it is, or still that Chikuzen vsavsreader.dll needs to be used?
Selur
9th October 2021, 15:13
downloaded "Windows embeddable package (64-bit)" from https://www.python.org/downloads/release/python-3100/
extracted it into a folder named 'Vapoursynth'
downloaded "VapourSynth64-Portable-R57-RC1" from https://github.com/vapoursynth/vapoursynth/releases
extracted it into the same folder, overwrote everything it wanted
called VSPipe and got "Failed to initialize VSScript" (same worked fine when using Python 3.9.6 from https://www.python.org/downloads/release/python-396/)
My guess is that this is just a limitation of the portable Vapoursynth (is it?) and a new 'vapoursynth.cp310-win_amd64.pyd' instead of the current 'vapoursynth.cp39-win_amd64.pyd' would be needed.
-> Any plans to switch to Pyhton 3.10 in the near future?
Cu Selur
Myrsloik
9th October 2021, 17:56
downloaded "Windows embeddable package (64-bit)" from https://www.python.org/downloads/release/python-3100/
extracted it into a folder named 'Vapoursynth'
downloaded "VapourSynth64-Portable-R57-RC1" from https://github.com/vapoursynth/vapoursynth/releases
extracted it into the same folder, overwrote everything it wanted
called VSPipe and got "Failed to initialize VSScript" (same worked fine when using Python 3.9.6 from https://www.python.org/downloads/release/python-396/)
My guess is that this is just a limitation of the portable Vapoursynth (is it?) and a new 'vapoursynth.cp310-win_amd64.pyd' instead of the current 'vapoursynth.cp39-win_amd64.pyd' would be needed.
-> Any plans to switch to Pyhton 3.10 in the near future?
Cu Selur
You need to recompile vsscript.dll as well to accomplish that, not just the python module.
Maybe I'll switch for R58. Or later.
Selur
9th October 2021, 18:46
Ah, okay good to know.
Thanks for the info.
Cu Selur
Selur
9th October 2021, 20:36
with API4:
"clip = FFDNet(clip=clip)" -> "'vapoursynth.VideoFrame' object has no attribute 'get_read_array'"
"clip = core.ttmpsm.TTempSmooth(clip=clip)" -> crashes without error
also can't find Win64 binaries for vinverse and morpho
Cu Selur
Myrsloik
9th October 2021, 22:06
with API4:
"clip = FFDNet(clip=clip)" -> "'vapoursynth.VideoFrame' object has no attribute 'get_read_array'"
"clip = core.ttmpsm.TTempSmooth(clip=clip)" -> crashes without error
also can't find Win64 binaries for vinverse and morpho
Cu Selur
get_read_array <= was deprecated, either use the new memory view or get_read_ptr
core.ttmpsm.TTempSmooth(clip=clip) <= Assumes miscfilters always is installed, crashes if not
Selur
9th October 2021, 22:43
core.ttmpsm.TTempSmooth(clip=clip) <= Assumes miscfilters always is installed, crashes if not
Thanks that helped.
get_read_array <= was deprecated, either use the new memory view or get_read_ptr
Not sure what to make of that, it it a bug in the viewer I use (https://github.com/YomikoR/VapourSynth-Editor) or in the filter?
Cu Selur
DJATOM
9th October 2021, 23:16
In the filter.
_Al_
9th October 2021, 23:36
that filter needs to change f.get_read_array(plane_number) to f[plane_number]
in API4, in python, there is an access to a plane view using slicing now
Selur
10th October 2021, 08:05
Ah okay, thanks for clearing that up. :)
Jukus
10th October 2021, 23:21
After the last updates VS is consuming 3-4 times less RAM than before!? That's awesome.
Selur
11th October 2021, 18:39
I had a few times where Only wanted to apply a specific filter to only a portion of a frame for only a few frames and I was wondering whether someone already worte a general function for this.
Something along the lines of:
function applyToRectangle(clip, functionPointer, funcitonarguments[], x, y, width, height)
or even better
function applyTotRectangleAndRange(clip, functionPointer, funcitonarguments[], x, y, width, height, start, end)
.
Cu Selur
ChaosKing
11th October 2021, 19:10
See https://github.com/Irrational-Encoding-Wizardry/Vapoursynth-RemapFrames
or
vsrepo install remap
lansing
11th October 2021, 19:12
I had a few times where Only wanted to apply a specific filter to only a portion of a frame for only a few frames and I was wondering whether someone already worte a general function for this.
Something along the lines of:
function applyToRectangle(clip, functionPointer, funcitonarguments[], x, y, width, height)
or even better
function applyTotRectangleAndRange(clip, functionPointer, funcitonarguments[], x, y, width, height, start, end)
.
Cu Selur
RemapFrames (https://github.com/Irrational-Encoding-Wizardry/Vapoursynth-RemapFrames)
Run your function on the filtered clip and then remap the frames you want to the original.
_Al_
11th October 2021, 23:20
I know, I know :-), here is solution in python, I added a selection for that filter remapping:
https://github.com/UniversalAl/animate
example:
import vapoursynth as vs
from vapoursynth import core
import animate
def blur(clip,*args):
return clip.std.BoxBlur()
MAP = [ #ranges can overlap
(60, 100), [animate.Crossfade(None, blur)], #fade in filter
(101,200), [blur],
(201,250), [animate.Crossfade(blur, None)], #fade out filter
]
clip = core.lsmas.LibavSMASHSource('source.mp4')
#if selection argument is passed: (width, height, left,top)
clip = animate.run(clip, MAP, selection=(300,200,50,90))
clip.set_output()
Selur
12th October 2021, 04:32
@lansing: I'm only want to apply the filtering on a part of the image, one of the poing of it is that filtering a part requires less processing power.
@_Al_: I don't get
a. why the blur function as args as argument that arent used.
b. what animate does and where it comes from :)
Cu Selur
_Al_
12th October 2021, 05:07
That's a standard feature in python, if a function needs to "eat up" arguments or if you do not know how many arguments that function is going to have. Actually better would be: def blur(*args,**kwargs): , but I did not use keyword arguments in animate.py, just positional arguments, so just *args is ok
We know that other functions will have arguments as a filters. And this function "blur" is processed with the same algorithm as other filters. Code would error saying that there are no arguments for that function or something.
That animate feature uses arguments in those functions when filters are chained, actually it is functools.reduce() which chain's filters.
I put together that code, actually it started here on the forum. I realized this could be used for other things, like quick fades in and out etc..
lansing
12th October 2021, 06:39
@lansing: I'm only want to apply the filtering on a part of the image, one of the poing of it is that filtering a part requires less processing power.
Something like this:
def applyToRectangle(n, f, clip):
# do stuff to the frame here
filtered_clip = core.std.FrameEval(base_clip, functools.partial(applyToRectangle, clip=base_clip))
final_clip = core.remap.Rfs(base_clip, filtered_clip , mappings="30 40 50")
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.