Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th September 2020, 04:41   #1  |  Link
Bob_97
Registered User
 
Join Date: Aug 2020
Posts: 4
How to debug Vapoursynth script?

I have a vapoursynth script that I am attempting to pass a variable clipname to using vspipe. When the clipname is hard-coded in the vs script it works fine. I suspect that what I am passing (a clip name string) is not being read correctly by the vs script.
How can I get debug info on this - print statements in the vs script dont work when run under vspipe (maybe output going somehwre else?)
Any help appreciated.
Bob_97 is offline   Reply With Quote
Old 6th September 2020, 07:08   #2  |  Link
fAy01
Registered User
 
Join Date: Jun 2010
Posts: 91
Try vseditor or vseditor2.
fAy01 is offline   Reply With Quote
Old 6th September 2020, 16:07   #3  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
you can pass string type object into vspipe:
vspipe.exe --arg "my_input=D:/path/my_video.avi" script.vpy - --y4m | x264.exe ......

and having script line, something like:
clip = core.avisource.AVISource(my_input)

but passing VideoNode type of object would not work , because you are not in Python enviroment using vspipe,
you technically could pass string and then use getattr() to get select that object in script but it is complicated

you use output indexes, that is why it was designed for, you can pipe many VideoNode objects in your script , many variants, like that:
clip.set_output(0)
other_clip.set_output(1)
etc.
.
and in vspipe you select those indexes:
vspipe -o 1 my_script.vpy | x264 ....
which would use your other_clip VideoNode. You can loop those indexes in batch script, whatever
_Al_ is offline   Reply With Quote
Old 6th September 2020, 18:35   #4  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
Vapoursynth (edit: actually python) puts videonode reference into globals dict so it can be pulled from there. At the end of your script you can set up output like this:
Code:
clip = core.avisource.AVISource('my_file.avi')
blurred = clip.std.BoxBlur()
.
.
dict(globals())[vspipe_passing].set_output()
and using this to preview it:
Code:
vspipe.exe --arg "vspipe_passing=blurred" script.vpy - --y4m | mpv.exe -
or
Code:
vspipe.exe --arg "vspipe_passing=clip" script.vpy - --y4m | mpv.exe -
did not tested it but it should work. Although I would rather focus working with pipe indexes, because you have no preview available etc.
Also note, there are previewers out there, that do it more easily , also comparing (debugging) videonodes. :-)

Last edited by _Al_; 6th September 2020 at 23:47.
_Al_ is offline   Reply With Quote
Old 6th September 2020, 23:52   #5  |  Link
Bob_97
Registered User
 
Join Date: Aug 2020
Posts: 4
Odd result

Thanks for all your help, it has solved my problem, but I have found an odd result.
If I use:
vspipe --arg my_clip=arthur.mov --y4m -p ...etc

and in the vapoursynth script:
clipname=my_clip.decode('utf-8')

it works perfectly (passes the binary string). But if I do:
vspipe --arg "my_clip=arthur.mov" --y4m -p ...etc

script (with no decode line) throws error: NameError: name 'my_clip' is not defined. What's that about?
Bob_97 is offline   Reply With Quote
Old 7th September 2020, 00:24   #6  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
I just tried it, using:
clipname=my_clip.decode('utf-8')
or
clipname=my_clip.decode()
or
clipname=my_clip #using simple characters and it perhaps still works

all work

vapoursynth manual says it is indeed in bytes i global dictionary, but not decoding it still works. But I use script.py not script.vpy, not sure if it matters now.

But I would not use wording clip for filename paths, it is misleading sort of. In Vapoursynth clip usually means VideoNode object, it s sort of consensus, which is Python object. You were perhaps talking about paths since the beginning which was confusing. Paths are string type of objects.

Last edited by _Al_; 7th September 2020 at 00:42.
_Al_ is offline   Reply With Quote
Old 7th September 2020, 03:24   #7  |  Link
Bob_97
Registered User
 
Join Date: Aug 2020
Posts: 4
yes clipname=my_clip.decode() works fine on my setup (script = .vpy) as does clipname=my_clip. Its just odd that the doublequote version of --args doesnt? Results in error: NameError: name 'my_clip' is not defined
Tried with the script.py and same result as script.vpy

But I'm moving forward, so thanks a heap for your help

Cheers
Bob_97 is offline   Reply With Quote
Old 7th September 2020, 04:32   #8  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
I don't remember why I started to wrapping quotes for both key and path: --arg "key=filepath". Most likely there was a space in a path, where it would fail in command line, and I put quotes like that and it worked. Similar like in windows batch does.

Maybe it is wrong and it is better to wrap quotes just around path: --arg key="C:\path\my file with space characters.avi"
whatever works. Not sure how it is parsed before it is put in that globals dictionary.
_Al_ is offline   Reply With Quote
Old 7th September 2020, 07:09   #9  |  Link
Bob_97
Registered User
 
Join Date: Aug 2020
Posts: 4
The docs say to do it the way you have --arg "key=filepath"
I tried both ways and neither works on my system.
Bob_97 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:23.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.