View Full Version : VapourSynth architecture questions
markfilipak
26th April 2021, 09:20
Hello,
I'm a novice. I have some VapourSynth architecture questions. Guidance would really help me.
Documented here: https://www.svp-team.com/wiki/Manual:SVPflow, are SVSuper() & SVAnalyse() (function entries in svpflow1.dll) and SVSmoothFps() (function entry in svpflow2.dll) -- I think that's correct.
But I have seen VapourSynth '.vpy' scripts referencing Super(), Analyse(), and SmoothFps(). They appear to be VS core functions. Are they documented?
(Note: With Alexkral's & poisondeathray's help, I know there are errors in the SVP documentation regarding the implementation of SVSmoothFps.scene.mode -- I assume that 'scene' is a property of the function and not some other object -- and there may be others, so I wonder about SmoothFps, also.)
The following is a skeletal script -- don't let my modified Hungarian notation throw you, I'm just anal compulsive. :)
pathSOURCE = ...
pathSVPFLOW1 = ...path to svpflow1.dll
pathSVPFLOW2 = ...path to svpflow2.dll
jsonSUPER = """{ ... }"""
jsonANALYSE = """{ ... }"""
jsonSMOOTHFPS = """{ ... }"""
import vapoursynth as objVS
objCORE = objVS.get_core(threads=11)
objCORE.std.loadplugin(r"pathSVPFLOW1")
objCORE.std.loadplugin(r"pathSVPFLOW2")
objSOURCE = objCORE.ffms2.Source(r"pathSOURCE")
objSOURCE = objSOURCE.resize.Bicubic(format=objVS.YUV420P8)
objSUPER = objCORE.svp1.Super(objSOURCE, jsonSUPER)
objVECTORS = objCORE.svp1.Analyse(objSUPER["clip"], objSUPER["data"], objSOURCE, jsonANALYSE)
objSMOOTH = objCORE.svp2.SmoothFps(objSOURCE, objSUPER["clip"], objSUPER["data"], objVECTORS["clip"], objVECTORS["data"], jsonSMOOTHFPS)
objTARGET = objCORE.std.AssumeFPS(objSMOOTH, fpsnum=objSMOOTH.fps_num, fpsden=objSMOOTH.fps_den)
objTARGET.set_output()
["clip"] & ["data"] appear to be members of an associative array property of the object returned by objCORE.svp1.Super(). Are they documented?
["clip"] & ["data"] appear to be members of an associative array property of the object returned by objCORE.svp1.Analyse(). Are they documented?
Thanks,
Mark.
Myrsloik
26th April 2021, 15:24
But I have seen VapourSynth '.vpy' scripts referencing Super(), Analyse(), and SmoothFps(). They appear to be VS core functions. Are they documented?
They're not core functions as the VS documentation will clearly tell you. Most likely you've seen someone reference an autoloaded copy of mvtool or a wrapper script.
["clip"] & ["data"] appear to be members of an associative array property of the object returned by objCORE.svp1.Super(). Are they documented?
["clip"] & ["data"] appear to be members of an associative array property of the object returned by objCORE.svp1.Analyse(). Are they documented?
Thanks,
Mark.
I don't think they're documented anywhere but the original open source version of mvtools is well understood. It's most likely a variation on the same information. Did try to actually look at the clips and print the data?
markfilipak
26th April 2021, 20:40
Howdy,
Hello,
But I have seen VapourSynth '.vpy' scripts referencing Super(), Analyse(), and SmoothFps(). They appear to be VS core functions. Are they documented?
They're not core functions ...
Of course not. They're functions of 'svp1' & 'svp2'. What's wrong with me? Sorry... brain fart.
Do you know if they're documented anywhere? I ask because, though they're undoubtedly similar to the SVP versions (for which I have documentation), the SVP documentation appears to be stale, it doesn't match what the SVP versions demonstrably do.
Related:
I'm trying to explore via vsedit (which I newly discovered). Is there a user's guide? The reason I ask is that this:
import vapoursynth as vs
core = vs.get_core()
_____________________________________
Log__________________________________
Failed to get the script output node.
wants a means to output. I've tried all the clues in the VS documentation HTML, but have not found Joy. Can you give me a 3rd line for vsedit so that I can see what it's doing?
I need a push.
Thanks!
Mark.
_Al_
27th April 2021, 03:53
Example o script, manual to output VideoNode is here: https://www.vapoursynth.com/doc/gettingstarted.html#example-script
vsedit needs VideoNode type of object (clip) to set as output .
vsedit was created to get any vapoursynth clip, then converting it to 8bit RGB and previewing it on screen, so output video can be evaluated first before actual encoding.
Because vapoursynth script is a Python script, you can also run it using any Python Editor (IDLE, PyCharm,...) where your script would show no error, but actually did nothing if you ran that, it would just loaded vapoursynth module. To preview your created clip you'd need to some other python modules imported and preview it with them (numpy & opencv as an example). So vsedit is a package to make it easier for you. It is a tool to run Python script but setting at least one output for clip/VideoNode is a must.
markfilipak
27th April 2021, 04:34
Example o script, manual to output VideoNode is here: https://www.vapoursynth.com/doc/gettingstarted.html#example-script
vsedit needs VideoNode type of object (clip) to set as output .
Hi Al, thanks.
For some reason, I thought I could use vsedit to get info on the internals of the run-time system, the objects and their properties -- sort of like a javascript DOM browser I once wrote when Netscape all but owned the Internet -- and vsedit was telling me that it needed a print module loaded.
Quote Myrsloik: "Did [you] try to actually look at the clips and print the data?"
Can't do it, eh?
Oh, well.
PS: I do understand that vsedit is an IDE and that I can browse a clip's properties (i.e. objSUPER["clip"] & objSUPER["data"]) within a script. I'd just hoped I could do more.
markfilipak
27th April 2021, 04:50
Regarding the ["clip"] & ["data"] associative arrays.
I don't think they're documented anywhere but the original open source version of mvtools is well understood.
Not by me. I've never run mvtools.
It's most likely a variation on the same information.
Well, I've never seen anything 'mvtools'-wise, and even if I did, SVP, for example, outdates mvtools by a mile and its documentation is stale, so I don't think mvtools documentation would be anything more than 'sketchy'.
I'll persevere and perhaps soon be able to ask 'better' questions.
poisondeathray
27th April 2021, 15:38
Well, I've never seen anything 'mvtools'-wise, and even if I did, SVP, for example, outdates mvtools by a mile and its documentation is stale, so I don't think mvtools documentation would be anything more than 'sketchy'.
I'll persevere and perhaps soon be able to ask 'better' questions.
svpflow is a fork of mvtools2
Latest mvtools2 release for avisynth is 20211214, it's hardly outdated by a "mile". It's not as if these things get new releases everyday. The vapoursynth version is a direct port and almost everything is applicable from the avs version
The mvtools2 documentation is not great but it goes into slightly more detail and is is a bit less sketchy than the svpflow documentation. There is even a diagram explaining how overlap and blocksizes work. It's worth looking at if you're new to block based optical methods. Check the documentation folder
https://github.com/pinterf/mvtools/releases
_Al_
27th April 2021, 23:21
Hi Al, thanks.
For some reason, I thought I could use vsedit to get info on the internals of the run-time system, the objects and their properties -- sort of like a javascript DOM browser I once wrote when Netscape all but owned the Internet -- and vsedit was telling me that it needed a print module loaded.
Quote Myrsloik: "Did [you] try to actually look at the clips and print the data?"
Can't do it, eh?
Oh, well.
PS: I do understand that vsedit is an IDE and that I can browse a clip's properties (i.e. objSUPER["clip"] & objSUPER["data"]) within a script. I'd just hoped I could do more.
I'd use a conventional syntax, for example everything in Python is an object so to give it a name objXXX to all variables gets messy. Or if everyone is importing vapoursynth as vs, why not to use it as well.
objSUBER is a dictionary as it seams to be and "clip" and "data" are keys of that dictionary, so objSUPER["clip"] gives a value for that key.
If you want to print those values, use python editor, vsedit would not print. Or you can use a trick and deliberately throw an error to print that value if using vsedit, you can try:
raise objVS.Error(objSUPER["data"])
But to use all python shenanigans use a python editor. vsedit is an app to conveniently view clips, but it might give you troubles along the way trying to use python fully to its depth.
If using python editor, just use:
print(objSUPER["data"])
I do not know what kind of data is in there if it is printable at all, if it is, you can do it that way.
markfilipak
29th April 2021, 00:47
I really appreciate the help I get here in Doom9. Thanks, Al.
I'd use a conventional syntax, for example everything in Python is an object ...
Is that true? You mean if a VapourSynth module imports this json: "{A:{B:'Hello World!'}}", then A.B is an object property of A, not a variable property? Are all python instances "heavyweight"?
... so to give it a name objXXX to all variables gets messy. Or if everyone is importing vapoursynth as vs, why not to use it as well.
I prefer to be "messy", at least until I feel comfortable, but probably forever. After all, how many scripts will I write? Hopefully, just a few. So why not be "messy"?
objSUBER is a dictionary as it seams to be and "clip" and "data" are keys of that dictionary, so objSUPER["clip"] gives a value for that key.
Thanks... Dictionary, eh? What's the difference between a dictionary and an associative array?
If you want to print those values, use python editor, vsedit would not print. Or you can use a trick and deliberately throw an error to print that value if using vsedit, you can try:
raise objVS.Error(objSUPER["data"])
But to use all python shenanigans use a python editor.
That's undoubtedly good advice. Do I have a python editor? Heck, I don't know. I looked at all the '.exe' files. I see 'python.exe' but I don't see anything that's obviously an editor.
vsedit is an app to conveniently view clips, but it might give you troubles along the way trying to use python fully to its depth.
If using python editor, just use:
print(objSUPER["data"])
I do not know what kind of data is in there if it is printable at all, if it is, you can do it that way.
Well, I don't know what clipSUPER["clip"] & clipSUPER["data"] are (other than things that need to be passed to functions). Exploration is what I'm trying to do, but I'm not getting very far.
Related:
If this json: "{gpu:0}" is fed to Super(), does 'gpu' become a property of Super() or does it become a property of the instance that Super() constructs? I'm assuming it's a property of the instance, but I don't know python. I do know enough about python to know that it doesn't have a switch-case construct, so I didn't pursue python further because I figured it was not a serious language. Without a switch-case expression, you can't assure code coverage and you can't write proveably correct code.
_Al_
29th April 2021, 02:34
You mean if a VapourSynth module imports this json: "{A:{B:'Hello World!'}}", then A.B is an object property of A, not a variable property?
A.B syntax would mean that B is an attribute of A.
class A:
B='Hello World!'
print(A.B)
>>>Hello World!
Dictionary is something else, it holds a keys and values, pairs, so yes, so I guess it is associative array. Keys could be int, float, bool, string or tuple (not list). Values could be any object: d = {'B':'Hello World!'} or d = dict(B='Hello World!'). But it could be assigned any object as a value (whatever, that itself could have thousand of attributes etc.). Values could be changed at any point simply:
d['B']='Bye bye'
and value could be another dictionary, like new_d = {'A': d} which is the same as new_d = {'A':{'B':'Hello World!'}}.
Accessing key "B" value would be:
print(new_d['A']['B']) #just chaining keys
>>>Hello World!
Super thing about dictionaries is that you can use them for keyword arguments in python functions, that is what SVPflow does and it is really cool to shove some database dictionary right into function.
d = {'A':5, 'B':3}
#different syntax but same thing defining dictionary d:
d = dict(A=5, B=3)
#then calling some_func function with arguments:
result = some_func(**d)
#which is the same like:
result = some_func(A=5, B=3)
d.update({'C':True, 'D':'slow'})
result = some_func(**d)
#is the same as:
result = some_func(A=5, B=3, C=True, D='slow')
Well, I don't know what clipSUPER["clip"] & clipSUPER["data"]
clipSUPER is a dictionary and "clip" is a key so clipSUPER["clip"] gives you a value for that key
Do I have a python editor?
On windows by installing Python you should have IDLE installed as well
If this json: "{gpu:0}" is fed to Super(), does 'gpu' become a property of Super() or does it become a property of the instance that Super() constructs?
it is a simple way to pass a value for gpu argument to a function as described
markfilipak
29th April 2021, 09:31
A.B syntax would mean that B is an attribute of A.
Sure, "attribute". Most other OOLs call them "properties" and reserve the word "attibute" for function arguments, but no matter. I've seen it both ways (for example, javascript properties and HTML attributes).
Dictionary is something else, it holds a keys and values, pairs, so yes, so I guess it is associative array.
In college, 45 years ago, I learned (and have read since then) that there are 2 kinds of arrays: indexed v. associative (integers v. textual). If the python folks chose to call associative arrays dictionaries, well, I guess that's okay, but I wonder why they would take a perfectly fine technical name and replace it with a generic name?
Keys could be int, float, bool, string or tuple (not list). Values could be any object: d = {'B':'Hello World!'} or d = dict(B='Hello World!').
Ah! So, an implied assignment (which would probably be d = ['B':'Hello World!']) or using a dict() constructor.
But it could be assigned any object as a value (whatever, that itself could have thousand of attributes etc.). Values could be changed at any point simply:
d['B']='Bye bye'
and value could be another dictionary, like new_d = {'A': d} which is the same as new_d = {'A':{'B':'Hello World!'}}.
Are you sure that wouldn't be new_d = ['A':d]?
Accessing key "B" value would be:
print(new_d['A']['B']) #just chaining keys
>>>Hello World!
You lost me there. ...:)
Super thing about dictionaries is that you can use them for keyword arguments in python functions, that is what SVPflow does and it is really cool to shove some database dictionary right into function.
d = {'A':5, 'B':3}
#different syntax but same thing defining dictionary d:
d = dict(A=5, B=3)
#then calling some_func function with arguments:
result = some_func(**d)
#which is the same like:
result = some_func(A=5, B=3)
That's handy.
d.update({'C':True, 'D':'slow'})
result = some_func(**d)
#is the same as:
result = some_func(A=5, B=3, C=True, D='slow')
[/CODE]
So, dictionaries can have methods (in this case, 'update').
clipSUPER is a dictionary and "clip" is a key so clipSUPER["clip"] gives you a value for that key
On windows by installing Python you should have IDLE installed as well.
I'll check. In addition to the portable python 3.8.5 packaged with ChaosKing's InterFrame FAT bundle, I think I have 2 other python versions: 3.7 (which is in my Start menu, and so is probably installed and in %PATH%), and 3.9.1 (which appears to be another portable). 3.7 does have IDLE.
Thanks for your help and insights. ...very helpful.
Mark.
_Al_
29th April 2021, 16:20
About using wording dictionary. :-) That's a question for python author, Guido van Rossum. It is just words. Indexed array is called list. If starting to be serious with arrays in Python you import numpy and work with those arrays. 2D, 3D etc...
Ah! So, an implied assignment (which would probably be d = ['B':'Hello World!']) or using a dict() constructor.
d = {'B':'Hello World!'}
dictonary has curly brackets in python, it is its "signature" in syntax, it cannot be overlooked. Or it can be created using dict() function.
Square brackets are used in list. Thats a simple indexed array.
_list = [1,'apple', 42, d]
Are you sure that wouldn't be new_d = ['A':d]?
new_d = {'A':d}
you want to read key 'A', youd use:
print(new_d['A'])
which is d dictionary in our case
also note,
You might get more confusion using SVPflow while learning python,
json format as a data is not true dictionary, notice using true, false instead of python correct syntax True or False. And so he passes a text form of that json to svpflow's functions. Not dictionaries but json string.
json is heavily used to store data (dictionary) , I use it often, json module is used to store python dictionary object to disk. SVPflow author uses json directly as a string passed to its SVPflow functions. And his dll's is parsing those data to arguments.
markfilipak
1st May 2021, 22:37
d = {'B':'Hello World!'}
dictonary has curly brackets in python, it is its "signature" in syntax, it cannot be overlooked. Or it can be created using dict() function.
Square brackets are used in list. Thats a simple indexed array.
_list = [1,'apple', 42, d]
new_d = {'A':d}
you want to read key 'A', youd use:
print(new_d['A'])
which is d dictionary in our case
So in this:
clipVECTORS = objCORE.svp1.SVAnalyse(clipSUPER["clip"], clipSUPER["data"], clipSOURCE, jsonSVANALYSE)
"clip" & "data" are arrays or array elements? clipSUPER[] is an object or an array? I haven't looked at python for about 20 years, but I remember there was something tricky about exactly this subject.
also note,
You might get more confusion using SVPflow while learning python,
json format as a data is not true dictionary, notice using true, false instead of python correct syntax True or False.
Thanks. I wondered about 'true' v. 'True'.
You probably already know this (or maybe not): Json is javascript. It utilizes compact, implied object constructors & propery assignments: {thisObj:{property:value, property:value, ..}} and {thisArray:[element1, element2, ..]} (in lieu of constructors, 'thisObj = new Object(); thisObj.property=value;' and 'thisArray = new Array(element1, element2, ..) ) to build what are essentially javascript databases.
And so he passes a text form of that json to svpflow's functions. Not dictionaries but json string.
json is heavily used to store data (dictionary) , I use it often, json module is used to store python dictionary object to disk. SVPflow author uses json directly as a string passed to its SVPflow functions. And his dll's is parsing those data to arguments.
Indeed. That's becoming popular everywhere.
print(clipSUPER)
>>>{'clip': <vapoursynth.VideoNode object at 0x0000000003289EE8>, 'data': 9904320414776}
so clipSUPER is a dictionary where first pair is 'clip' key and value is vapoursynth' clip (bunch of clips stacked up for further use) and key 'data' with value 9904320414776 in my case. Note, clipSUPER[] as a syntax does not exist, dictionary is clipSUPER and values for keys are:
for key, value in clipSUPER.items():
print('value for key', key, 'is:', value)
>>>value for key clip is: VideoNode
Format: YUV420P8
Width: 1920
Height: 5390
Num Frames: 298
FPS: 60000/1001
Flags: NoCache IsCache
value for key data is: 9904320414776
print(clipSUPER['clip'])
>>>VideoNode
Format: YUV420P8
Width: 1920
Height: 5390
Num Frames: 298
FPS: 60000/1001
Flags: NoCache IsCache
print(clipSUPER['data'])
>>>9904320414776
to see that clipSUPER["clip"] you can:
clipSUPER["clip"].set_output()
markfilipak
2nd May 2021, 14:13
for key, value in clipSUPER.items():
print('value for key', key, 'is:', value)
How did you do that?
PS: Never mind. I see. You simply ran python.exe.
You did my work for me. ::thanks::
Using python editor having script with extension *.py, not *.vpy
Then just developing script as any python project. If using IDLE just pressing F5 to run it. So you can sqeeze print() lines in any part of that script, and it prints into python console.
vspipe takes both extensions py or vpy.
For viewing clip right in that script using this: https://github.com/UniversalAl/view which is pretty crude and needs to be updated and improved but ok for now.
markfilipak
5th September 2021, 04:45
I have a question about 'vspipe --requests N': "Set number of concurrent frame requests".
Is 'N' what I'm calling 'Virtual Memory Frames': the number of raw frames that fit in virtual memory, in the 4 examples below?.
Thanks in Advance,
Mark.
Why I ask: I'm piping VS to ffmpeg and have had some problems with pipe coordination and virtual memory overflow (which Windows does not handle well).
I'm hoping that I can employ the script to set the pipe size in advance to a value that maximizes speed but doesn' risk virtual memory overflow.
>test "h:\VIDEO_TS\VTS_04_1.VOB"
Pixels Per Line = 720
Lines Per Frame = 480
Virtual Memory Bytes = 34359738368
Virtual Memory KiloBytes = 34359738
KiloBytes Per Frame = 518 <<== 720*480*(12 bits/pixel(ave))/(8 bits/byte)/1000
Virtual Memory Frames = 66331 <<== 34359738/518
>test "m:\Test Videos\16x9-1080, 24fps[24pps], BT709 'SINTEL'.mkv"
Pixels Per Line = 1920
Lines Per Frame = 818
Virtual Memory Bytes = 34359738368
Virtual Memory KiloBytes = 34359738
KiloBytes Per Frame = 2356
Virtual Memory Frames = 14583
>test "m:\Test Videos\16x9-1080, 30fps[30pps], BT709, 'Big Buck BUNNY, Sunflower'.mp4"
Pixels Per Line = 1920
Lines Per Frame = 1080
Virtual Memory Bytes = 34359738368
Virtual Memory KiloBytes = 34359738
KiloBytes Per Frame = 3110
Virtual Memory Frames = 11048
>test "m:\Test Videos\16x9-2160, 60fps[60pps], BT709HDR, 'Flower Market'.y4m"
Pixels Per Line = 4096
Lines Per Frame = 2160
Virtual Memory Bytes = 34359738368
Virtual Memory KiloBytes = 34359738
KiloBytes Per Frame = 16589
Virtual Memory Frames = 2071
Curious about the 'test.cmd' script?
@ECHO OFF
ENDLOCAL
SETLOCAL ENABLEDELAYEDEXPANSION ENABLEEXTENSIONS
SET iBitsPerByte=8
SET iBitsPerPixel=
SET iKiloBytesPerFrame=
SET iVirtualMemoryBytes=
SET iVirtualMemoryFrames=
SET iVirtualMemoryKiloBytes=
SET MATCH=
SET qSourceFile=%1
REM About AverageBytesPerPixel: For yuv420p, AverageBitsPerPixel = 12; for yuv420p10, AverageBitsPerPixel = 15.
REM FFPROBE parse examples:
REM " Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m, progressive), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, 29.58 fps, 59.94 tbr, 90k tbn"
REM " Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn"
REM " Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv), 3840x1746 [SAR 1:1 DAR 640:291], 23.98 fps, 23.98 tbr, 1k tbn (default)"
REM " Stream #0:0: Video: rawvideo (Y3[11][10] / 0xA0B3359), yuv420p10le(progressive), 4096x2160, SAR 1:1 DAR 256:135, 60 fps, 60 tbr, 60 tbn"
REM \ \ \ \ \
REM %%a (space) %%b %%c %%g %%h
FOR /F "tokens=1,2,3,* usebackq" %%a IN (`FFPROBE "!qSourceFile:~1,-1!"2^>^&1^|FINDSTR /B /C:" Stream #0"`) DO (
IF "%%c"=="Video:" (
FOR /F "usebackq" %%e IN (`ECHO %%d^|FINDSTR /C:"yuv420p10"`) DO (SET iBitsPerPixel=15)
IF NOT DEFINED iBitsPerPixel SET iBitsPerPixel=12
CALL :__m_a_t_c_h__ "[0123456789][0123456789][0123456789][0123456789]*x[0123456789][0123456789][0123456789][0123456789]*" %%d
)
IF DEFINED MATCH GOTO continue
)
:continue
FOR /F "tokens=1,2 delims=x" %%g IN ("!MATCH!") DO (
SET /A iKiloBytesPerFrame=%%g*%%h/1000*!iBitsPerPixel!/!iBitsPerByte!+1
echo Pixels Per Line = %%g
echo Lines Per Frame = %%h
)
REM DIR parse example: "21-09-03 08:48 AM 34359738368 pagefile.sys"
FOR /F "tokens=1,2,3,4,5 usebackq" %%a IN (`DIR /AH /-C C:\pagefile.sys^|FINDSTR /L /C:"pagefile.sys"`) DO (SET iVirtualMemoryBytes=%%d)
SET iVirtualMemoryKiloBytes=!iVirtualMemoryBytes:~0,-3!
SET /A iVirtualMemoryFrames=!iVirtualMemoryKiloBytes!/!iKiloBytesPerFrame!
echo Virtual Memory Bytes = !iVirtualMemoryBytes!
echo Virtual Memory KiloBytes = !iVirtualMemoryKiloBytes!
echo KiloBytes Per Frame = !iKiloBytesPerFrame!
echo Virtual Memory Frames = !iVirtualMemoryFrames!
GOTO :EOF
:__m_a_t_c_h__
SET REGEXP=%1
SET MATCH=
:loop
SHIFT /1
SET s=%1
SET s=!s:^-=!
IF NOT DEFINED s GOTO :EOF
FOR /F "usebackq" %%a IN (`ECHO !s!^|FINDSTR /R !REGEXP!`) DO (SET MATCH=%%a)
IF NOT DEFINED MATCH GOTO loop
GOTO :EOF
Myrsloik
5th September 2021, 09:16
No. If you ever set it to more than the number of threads you're wasting memory and slowing things down.
markfilipak
5th September 2021, 14:26
No. If you ever set it to more than the number of threads you're wasting memory and slowing things down.
Thanks for the quick response.
Hardware threads? Or software threads?
I have 4 cores with 2 CPUs per core, so 8 hardware threads. So, would I specify '--requests 8'?
And, do you know of any way to coordinate the pipe between vspipe and ffmpeg? I'm currently using an environmental variable via '-thread_queue_size %nFFTQSIZE%' in ffmpeg but it appears to be decoder and filter specific and therefore requires tinkering and therefore doesn't lend itself to scripting.
If %nFFTQSIZE% is too large, vspipe dominates percent-CPU, fills virtual memory too fast, VM commit rises linearly to the top and Windows has difficulty.
If %nFFTQSIZE% is too small, ffmpeg dominates percent-CPU, VM commit rises but then levels out, and ffmpeg complains.
At the margin between those values, vspipe's and ffmpeg's percent-CPU are balanced, VM commit levels out near the top, and ffmpeg still complains though it has less to complain about. It appears that the closer to the margin, the faster the pipe and the quicker the processing (by about 50%). Using a GPU seems to make this less of an issue, but that might be true because of CPU utilization, not pipe utilization.
Myrsloik
5th September 2021, 14:42
Thanks for the quick response.
Hardware threads? Or software threads?
I have 4 cores with 2 CPUs per core, so 8 hardware threads. So, would I specify '--requests 8'?
And, do you know of any way to coordinate the pipe between vspipe and ffmpeg? I'm currently using an environmental variable via '-thread_queue_size %nFFTQSIZE%' in ffmpeg but it appears to be decoder and filter specific and therefore requires tinkering and therefore doesn't lend itself to scripting.
If %nFFTQSIZE% is too large, vspipe dominates percent-CPU, fills virtual memory too fast, VM commit rises linearly to the top and Windows has difficulty.
If %nFFTQSIZE% is too small, ffmpeg dominates percent-CPU, VM commit rises but then levels out, and ffmpeg complains.
At the margin between those values, vspipe's and ffmpeg's percent-CPU are balanced, VM commit levels out near the top, and ffmpeg still complains though it has less to complain about. It appears that the closer to the margin, the faster the pipe and the quicker the processing (by about 50%). Using a GPU seems to make this less of an issue, but that might be true because of CPU utilization, not pipe utilization.
This isn't the value you want to change. It defaults to the number of hardware threads already. If there's a problem it's somewhere in how FFmpeg or vspipe handles pipe reads and writes in general.
It more or less exists only for debug purposes where requests=1.
Have you tried using the FFmpeg support for opening vpy scripts directly? Does it act differently?
markfilipak
5th September 2021, 18:11
... It more or less exists only for debug purposes where requests=1.
Okay, thanks. I did see that vspipe used all 8 CPUs by default.
Have you tried using the FFmpeg support for opening vpy scripts directly? Does it act differently?
FFmpeg can run vpy scripts?
The only FFmpeg support that I'm aware of is the ffmpeg-user list. I think I'm persona non grata there because all my questions "make no sense" and I asked why they didn't make sense.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.