View Full Version : Vapoursynth
Keiyakusha
7th September 2012, 12:56
Not working...
http://i.imgur.com/SVPa1.png
Myrsloik
7th September 2012, 13:05
Not working...
\ is the escape character for python strings, just like in C.
Either write path=r'c:\blah.dll', path='c:/blah.dll' or path='c:\\blah.dll' to make it work as expected.
Keiyakusha
7th September 2012, 13:11
Oh yes, this way it works... Sorry.
-Vit-
7th September 2012, 13:27
I get problems encoding through y4m to x264 with core threads at anything other than 1. Affects any source. Can post scripts if you wish, but it's just a pass-through python script (FFVideoSource) & generic x264 settings. Get errors like this and encode terminates early (usually after a few frames, but a non-deterministic #):
y4m [error]: bad header magic (82848485 <=> àääéé)
y4m [error]: bad header magic (41524682 <=> éFRAM)
Thread count on FFVideoSource works fine. No problems so far experimenting with 1 core thread.
JEEB
7th September 2012, 13:40
I get problems encoding through y4m to x264 with core threads at anything other than 1. Affects any source. Can post scripts if you wish, but it's just a pass-through python script (FFVideoSource) & generic x264 settings. Get errors like this and encode terminates early (usually after a few frames, but a non-deterministic #):
y4m [error]: bad header magic (82848485 <=> àääéé)
y4m [error]: bad header magic (41524682 <=> éFRAM)
Seems to be related to how x264 reads the stuff, if output it to a y4m file or switch x264 to avconv/ffmpeg, it will work :s
(Chikuzen had this problem last night)
-Vit-
7th September 2012, 17:30
Same problem with ffmpeg. Fine with core threads = 1. If core threads is anything else then it encodes only a few frames (final frames become offset to the right), no error message shown in ffmpeg. Seems like a threading issue to me.
JEEB
7th September 2012, 21:02
Same problem with ffmpeg. Fine with core threads = 1. If core threads is anything else then it encodes only a few frames (final frames become offset to the right), no error message shown in ffmpeg. Seems like a threading issue to me.
Yeah, in that case it's a threading/output-related issue. At least Myrs is already debugging it.
wOxxOm
8th September 2012, 04:58
What is the easiest way of making vapoursynth case-insensitive for filter and parameter names (I mostly write everything in lowercase) ?
TheFluff
8th September 2012, 05:23
What is the easiest way of making vapoursynth case-insensitive for filter and parameter names (I mostly write everything in lowercase)?
Python function and variable names are always case sensitive; that's a language thing and not something VS gets to decide. Probably the simplest way of making it possible to write everything in lowercase would be write some metaprogramming magic that generates all-lowercase wrappers for all the methods on the VS core object.
wOxxOm
8th September 2012, 06:01
What are 'format' and 'yuvrange' and is it possible to mimick spline16/36/64resize with Spline(clip:clip;width:int:opt;height:int:opt;format:int:opt;yuvrange:int:opt;) ? Is it possible to specify float numbers for the area to be resized like in avisynth's resize filters which have cropXXXX parameters? What is the syntax of 'Lut' and 'Lut2' functions? Is it possible to implement positional parameters so that instead of Spline(c1=myvideonode,width=1280,height=720) it'd be spline(myvideonode,1280,720) ? It would be nice to have a callback in 'output' function with current frame number and coded frame size so that it could be used in a custom gui for progress reporting
active1
8th September 2012, 06:32
will be there any script editor like AvsP(mod) to view source, editing, etc ?
wOxxOm
8th September 2012, 08:59
There are examples of implementing a case-insensitive dictionary which might work for method names as well if I am not mistaken (here (http://stackoverflow.com/questions/2082152/case-insensitive-dictionary) and there (http://code.activestate.com/recipes/66315)):class CaseInsensitiveDict(dict):
def __setitem__(self, key, value):
super(CaseInsensitiveDict, self).__setitem__(key.lower(), value)
def __getitem__(self, key):
return super(CaseInsensitiveDict, self).__getitem__(key.lower())Other methods should also be redefined in this fashion if being used, like 'contains', 'has_key', etc.
It looks quite easy to incorporate into vapoursynth's avs class, probably even as an optional parameter 'casesens' in vapoursynth.Core() method which would instantiate avs class or avsCaseInsensitive, yet I don't know if and how I can override the avs class from inside my code...
Myrsloik
8th September 2012, 10:11
There are examples of implementing a case-insensitive dictionary which might work for method names as well if I am not mistaken (here (http://stackoverflow.com/questions/2082152/case-insensitive-dictionary) and there (http://code.activestate.com/recipes/66315)):class CaseInsensitiveDict(dict):
def __setitem__(self, key, value):
super(CaseInsensitiveDict, self).__setitem__(key.lower(), value)
def __getitem__(self, key):
return super(CaseInsensitiveDict, self).__getitem__(key.lower())Other methods should also be redefined in this fashion if being used, like 'contains', 'has_key', etc.
It looks quite easy to incorporate into vapoursynth's avs class, probably even as an optional parameter 'casesens' in vapoursynth.Core() method which would instantiate avs class or avsCaseInsensitive, yet I don't know if and how I can override the avs class from inside my code...
I suppose I could allow lower case versions too since it's at least in the spirit of python. The uppercasing has bothered me too since python prefers_this_style. Maybe I'll just change the bindings to do everything as lower case.
Myrsloik
8th September 2012, 11:14
What are 'format' and 'yuvrange' and is it possible to mimick spline16/36/64resize with Spline(clip:clip;width:int:opt;height:int:opt;format:int:opt;yuvrange:int:opt;) ? Is it possible to specify float numbers for the area to be resized like in avisynth's resize filters which have cropXXXX parameters? What is the syntax of 'Lut' and 'Lut2' functions? Is it possible to implement positional parameters so that instead of Spline(c1=myvideonode,width=1280,height=720) it'd be spline(myvideonode,1280,720) ? It would be nice to have a callback in 'output' function with current frame number and coded frame size so that it could be used in a custom gui for progress reporting
1. yuvrange isn't implemented yet in the filter, I'll add it so it works as good/bad as swscale in libav does. I'll go and ask how much is implemented now, last time I looked it was only half done. I have no idea about replicating the avisynth spline functions. Tell me if it looks similar to any of them.
2. Not sure if swscale implements it, will go ask the developers because I'm curious too.
3. For Lut the lut argument is a list of 2^(video bits per sample) ints. So for normal video it simply is the 256 values in the lut you've calculated by yourself. Lut2 is similar except that it's Lut2(clips=[clip1, clip2], lut=[2^(usually 16) ints])
You can also add planes=[1, 2] (or similar) if you only want it to work on uv in yuv.
4. I like it verbose, maybe some day I'll relax the requirement but I see it as a good way of keeping scripts readable.
5. It shall be added
Guest
8th September 2012, 14:39
There are two threads going on Vapoursynth in Avisynth Develoment now. Is there any reason not to merge them?
JEEB
8th September 2012, 15:02
There are two threads going on Vapoursynth in Avisynth Develoment now. Is there any reason not to merge them?
I'm not Myrs, but the "Vapoursynth" thread might as well be merged here, that way there'd be only one thread + Myrs can update the top post.
TheProfileth
8th September 2012, 19:58
Yes, I agree they should be merged also.
Myrsloik
8th September 2012, 20:19
The users have spoken. Make it so.
Guest
8th September 2012, 23:18
I have waved my magic wand and made it so.
Now you try to figure out how I gave you a first thread post like I did, which you can fill in as needed. :eek:
Myrsloik
9th September 2012, 01:03
R4 posted at the website. It should fix the corrupt frame output and some other stuff too.
TheRyuu
9th September 2012, 02:53
ffms2-r712.7z (https://ffmpegsource.googlecode.com/files/ffms2-r712.7z)
As seen in the ffmpegsource thread, contains vapoursynth support.
CarlPig
9th September 2012, 05:26
I can't get it to work.
http://cloudho.st/i/P1XneLpC.jpg
06_taro
9th September 2012, 06:51
python is case sensitive, the function is "Core()", not "core()"
Yoshiyuki Blade
9th September 2012, 07:27
That's further than what I got. I can't even get past the first line (says specified module no found) :eek:! This is kind of frustrating because the instructions really are straightforward and easy to follow. Everything is (presumably) at default settings too.
TurboPascal7
9th September 2012, 07:32
Awesome project. Finally, something that can completely replace avisynth one day.
I played around with it and wrote a simple (buggy, ugly etc.) wrapper to provide more avisynth-like syntax (chaining support, positional arguments, case insensitivity): http://privatepaste.com/0b53562cdb
While it definitely shouldn't be used for anything real in its current state, I hope it shows that vapoursynth could benefit from better API.
Thoughts:
1. list_functions() should return a string and not output it to stdout by itself. IMHO, this is just wrong (see _rebuild_functions_cache function).
2. There should be a list_functions() analog, that would return the same data in dictionary/list/whatever form. I'm pretty sure you have one internally. Possible use case: editors, wrappers.
3. Chaining support, or you can call it 'fluent interface'. Just because it makes things so much easier.
4. Positional argument. I'm not sure why you like it verbose while most programming languages use this kind of args without any problems. Some don't even support named arguments.
5. Case-insensitivity should be added. Or at least lowercase bindings for all functions. Good editor could help, sure, but right now it takes me ages to type FFVideoSource correctly.
6. Some list_functions() analog for core functions. Because your (cython?) objects don't support __dict__, inspect.getargspec and other reflection methods. This can be solved with good documentation too. :)
I'm not very good with python and I'm pretty sure that some of these questions can be solved by a simple correct wrapper without your help. Having all this in core API would be nice though.
Also, optional parameters don't seem to work right now. And CropAbs accepts negative width/height but then outputs garbage. IMHO it should behave like avisynth's crop function.
ajp_anton
9th September 2012, 10:34
So what are the long-term plans for this? To be able to do everything Avisynth can do, but better*?
*Working multi-threading, arbitrary bit-depths and color spaces.
Myrsloik
9th September 2012, 10:35
So what are the long-term plans for this? To be able to do everything Avisynth can do, but better*?
*Working multi-threading, arbitrary bit-depths and color spaces.
To crush all who stand against me! *muahaha*
active1
9th September 2012, 11:35
hi, i can't make CPU Usage = 99% when i use one filter
the CPU Usage is 25% all the time, but when i use the filter x4, the CPU Usage become 99%
but in avisynth MT the CPU Usage is 99% all the time
what is the problem ?? (or is it a problem ??)
Myrsloik
9th September 2012, 11:40
Awesome project. Finally, something that can completely replace avisynth one day.
I played around with it and wrote a simple (buggy, ugly etc.) wrapper to provide more avisynth-like syntax (chaining support, positional arguments, case insensitivity): http://privatepaste.com/0b53562cdb
While it definitely shouldn't be used for anything real in its current state, I hope it shows that vapoursynth could benefit from better API.
Thoughts:
1. list_functions() should return a string and not output it to stdout by itself. IMHO, this is just wrong (see _rebuild_functions_cache function).
2. There should be a list_functions() analog, that would return the same data in dictionary/list/whatever form. I'm pretty sure you have one internally. Possible use case: editors, wrappers.
3. Chaining support, or you can call it 'fluent interface'. Just because it makes things so much easier.
4. Positional argument. I'm not sure why you like it verbose while most programming languages use this kind of args without any problems. Some don't even support named arguments.
5. Case-insensitivity should be added. Or at least lowercase bindings for all functions. Good editor could help, sure, but right now it takes me ages to type FFVideoSource correctly.
6. Some list_functions() analog for core functions. Because your (cython?) objects don't support __dict__, inspect.getargspec and other reflection methods. This can be solved with good documentation too. :)
I'm not very good with python and I'm pretty sure that some of these questions can be solved by a simple correct wrapper without your help. Having all this in core API would be nice though.
Also, optional parameters don't seem to work right now. And CropAbs accepts negative width/height but then outputs garbage. IMHO it should behave like avisynth's crop function.
1. will be changed for the next version
2. will probably happen some day
3. suggest a way to implement it that's not completely unpythonian and I'll consider it
4. some day
5. I will not add case insensitive stuff to a case sensitive language. Maybe some day I'll make lowercase versions acceptable too.
6. It's already included in list_functions(), why do you need one more?
I think I've fixed the crop argument checks. Can you give an example of the optional arguments maybe not working?
Myrsloik
9th September 2012, 11:51
hi, i can't make CPU Usage = 99% when i use one filter
the CPU Usage is 25% all the time, but when i use the filter x4, the CPU Usage become 99%
but in avisynth MT the CPU Usage is 99% all the time
what is the problem ?? (or is it a problem ??)
It is how my threading model works. Avisynth filters are for compatibility reasons limited so one instance may run on one core at one time. Avisynth-mt gets around this by creating multiple instances (one per thread), OR by making very unsafe assumptions.
Newly written and ported filters for the vs api can if done correctly handle multiple frames at once. See the included Lut/Lut2 function.
active1
9th September 2012, 12:03
It is how my threading model works. Avisynth filters are for compatibility reasons limited so one instance may run on one core at one time. Avisynth-mt gets around this by creating multiple instances (one per thread), OR by making very unsafe assumptions.
Newly written and ported filters for the vs api can if done correctly handle multiple frames at once. See the included Lut/Lut2 function.
so there is a chance to make it even better than Avisynth MT in speed wise? (with only one filter)
TurboPascal7
9th September 2012, 12:10
I think I've fixed the crop argument checks. Can you give an example of the optional arguments maybe not working?
Traceback (most recent call last):
File "D:/test.py", line 21, in <module>
source = w.std.CropAbs(clip=source, x=16, y=16)
File "vapoursynth.pyx", line 434, in vapoursynth.Function.__call__ (cython\vapoursynth.c:7371)
vapoursynth.Error: 'CropAbs: argument width is required'
source = w.std.CropAbs(clip=source, x=16, y=16, width=-16, height=-16)
Works but outputs garbage. Should throw error or work like avisynth's crop (subtracting provided negative width/height values from clip's parameters).
6. It's already included in list_functions(), why do you need one more?
I don't really need another list_functions() method. I do want to know Core class constructor parameters, VideoNode.output() method parameters (wanted to test callback, added in r4) etc. Without documentation and any public API I don't see any ways to do it since reflection doesn't work well with cython. I'm asking for this too early, I guess.
Myrsloik
9th September 2012, 12:13
so there is a chance to make it even better than Avisynth MT in speed wise? (with only one filter)
Not without porting filters, no. I'm not going to make another avisynth-mt mess. I intend to win people over in the end by being faster and more stable for most users.
Myrsloik
9th September 2012, 12:20
Traceback (most recent call last):
File "D:/test.py", line 21, in <module>
source = w.std.CropAbs(clip=source, x=16, y=16)
File "vapoursynth.pyx", line 434, in vapoursynth.Function.__call__ (cython\vapoursynth.c:7371)
vapoursynth.Error: 'CropAbs: argument width is required'
Of course width is required, this only moves the upper left point.
source = w.std.CropAbs(clip=source, x=16, y=16, width=-16, height=-16)
Works but outputs garbage. Should throw error or work like avisynth's crop (subtracting provided negative width/height values from clip's parameters).
fixed
I don't really need another list_functions() method. I do want to know Core class constructor parameters, VideoNode.output() method parameters (wanted to test callback, added in r4) etc. Without documentation and any public API I don't see any ways to do it since reflection doesn't work well with cython. I'm asking for this too early, I guess.
Core constructor: def __cinit__(self, flatten = True, addcache = True, int threads = 0)
Not much of interest, really. Flatten is whether or not single return value functions get the returned dict flattened to a single value automatically. addcache controls automatic cache insertion.
Output declaration:
def output(self, object fileobj not None, bint y4m = False, int lookahead = 10, object progress_update = None):
Where lookahead is the number of frame requests it has going at once to keep throughput up and progress_update is a functions that could looks like this:
def print_frame(n, total):
print('Frame: %d/%d' % (n, total))
active1
9th September 2012, 14:02
Not without porting filters, no. I'm not going to make another avisynth-mt mess. I intend to win people over in the end by being faster and more stable for most users.
that's good too, i hope that we will not need to load any filter from avisynth someday.
i have a problem with ColorMatrix:
http://data.imagup.com/10/1161861426.jpg
every filter above work very well, except ColorMatrix
is it not supported yet?
Myrsloik
9th September 2012, 21:20
I released R5. Changes in the first post. If this one turns out well I'll start experimenting with other platforms.
TheProfileth
9th September 2012, 21:22
r5:
more python output fixes
added accept_lowercase as a setting for the core constructor
python module refinement, now all objects have a string representation with more information
other minor fixes
Does this mean you can do things with all lowercase now?
Myrsloik
9th September 2012, 21:23
Does this mean you can do things with all lowercase now?
Yes, I added it as an experiment and it's off by default. It may disappear again if I don't like it.
wOxxOm
9th September 2012, 21:24
this is great, let it be :-)
also, is there a way yet to create arbitrary clips like in avisynth's ScriptClip? The only way I see now is to loop through all frames and then core.std.splice individual frames after some processing which seems to defy the idea of lazy calculation in a ScriptClip.
Reel.Deel
9th September 2012, 21:32
I have managed to finally output y4m but I do not know how to successfully pipe Vapoursynth to X264. Can someone please post a sample of how to achieve this?
@ Myrsloik
So I noticed that the vsvfw.dll is no longer included in r5. Is it still needed?
Myrsloik
9th September 2012, 21:34
I have managed to finally output y4m but I do not know how to successfully pipe Vapoursynth to X264. Can someone please post a sample of how to achieve this?
@ Myrsloik
So I noticed that the vsvfw.dll is no longer included in r5. Is it still needed?
It was never used. The vfw part still isn't anywhere near ready.
TheFluff
10th September 2012, 00:00
that's good too, i hope that we will not need to load any filter from avisynth someday.
i have a problem with ColorMatrix:
every filter above work very well, except ColorMatrix
is it not supported yet?
It's not supported yet. Vapoursynth doesn't have equivalents for all of the internal Avisynth functions yet, so filters like ColorMatrix that invoke internal Avisynth filters will break if the invoked function doesn't exist in Vapoursynth.
Myrsloik
10th September 2012, 00:07
It's not supported yet. Vapoursynth doesn't have equivalents for all of the internal Avisynth functions yet, so filters like ColorMatrix that invoke internal Avisynth filters will break if the invoked function doesn't exist in Vapoursynth.
I'd like to add that I may never add any extensive invoke support on the avisynth side. I estimate that the time to port the few useful filters that use invoke and adding good enough support for it in vs is about the same. I know which one I'm going to pick.
Yoshiyuki Blade
10th September 2012, 07:55
Ok so I finally got past the "test" phase of the installation instructions LOL. It turns out that I needed the Microsoft Visual C++ 2010 Redistributable Package (http://www.microsoft.com/en-us/download/details.aspx?id=5555) (instead of the 2008 one) to get it working. The list.functions() is messed up in r5 compared to r3 (I don't have r4 around for some reason). Can't wait to dabble with a new interface and learn new things.
smok3
10th September 2012, 08:11
vapour is win only?
TurboPascal7
10th September 2012, 08:51
The list.functions() is messed up in r5 compared to r3 (I don't have r4 around for some reason).
It isn't messed up. It just returns a string instead of printing it. Should be used like print(core.list_functions()).
Yoshiyuki Blade
10th September 2012, 08:55
It isn't messed up. It just returns a string instead of printing it. Should be used like print(core.list_functions()).
I see. Yeah, it looks fine when used that way.
Myrsloik
10th September 2012, 09:46
vapour is win only?
Only until it's kinda stable.
Reel.Deel
10th September 2012, 11:10
When I try loading the "official" MVtools (v2.5.11.3) it works fine, but when I try it on Dithers MVTools (v2.6.0.5) it just silently crashes the python command line.
Also, I'm happy to see DGIndexNV work on Vapoursynth. :)
Chikuzen
10th September 2012, 13:15
Also, I'm happy to see DGIndexNV work on Vapoursynth. :)
However, DGMPEGDec can't be used because it requires avs internal crop function.
I used TS2AVI/MPEG2Dec3k after a long time...
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.