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. |
|
|
Thread Tools | Search this Thread | Display Modes |
27th November 2017, 02:25 | #1 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
How do I append video from another script using subprocess?
I want to append a video loaded from a script with video data piped from another script using subprocess.
child.vpy Code:
import vapoursynth as vs core = vs.get_core() clip = core.ffms2.Source(r"a.mp4") clip.set_output() Code:
import vapoursynth as vs import subprocess core = vs.get_core() clip = core.ffms2.Source(r"b.mp4") command = "vspipe child.vpy -" child = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) final = clip + child final.set_output() |
27th November 2017, 02:57 | #2 | Link |
Registered User
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
|
OK, this looks really ugly to me, but if you really want to do that maybe you need to do something like this:
slave_script.py: Code:
def my_output(core): clip = core.ffms2.Source('something) # And do something here, maybe return clip Code:
import sys import os import vapoursynth as vs sys.path.append(os.getcwd()) import slave_script core = vs.get_core() clip = core.ffms2.Source(somethin_else) clipb = slave_script.my_output(core) clip = clip + clipb clip.set_output() |
27th November 2017, 03:18 | #3 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
The reason for this is that my denoiser can only have one instance per script, it will crash if there're more than one. And I need to call it multiple times on multiple clips in one script and then joined the results. So I have to find a workaround. I'm hoping that by piping in a video stream from another script would count as another instance.
I doubt that simply importing a slave script will work. Last edited by lansing; 27th November 2017 at 03:35. |
27th November 2017, 21:24 | #4 | Link | |
Beyond Kawaii
Join Date: Feb 2008
Location: Russia
Posts: 724
|
Quote:
If both answers are yes - you just need to create buffers and plans for each instance and remember them in the instance data. Plan creation functions are not thread-safe, so you need to put a global mutex around them. That should work.
__________________
...desu! |
|
27th November 2017, 22:01 | #5 | Link | |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Quote:
|
|
28th November 2017, 01:31 | #6 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Okay I figured out a workaround. I loaded the same filter into vapoursynth as a different function name and it works, no crash. Test encoding the script for 10000 frames without problem.
Code:
core.avs.LoadPlugin(r"C:\Program Files (x86)\AviSynth+\plugins64+\VDubFilter.dll") core.avs.LoadVirtualdubPlugin(r'nv.vdf', 'nv', 1) core.avs.LoadVirtualdubPlugin(r'nv.vdf', 'nv2', 1) clipa = core.avs.nv(clip) clipb = core.avs.nv2(clip) clip = clipa + clipb clip.set_output() |
Thread Tools | Search this Thread |
Display Modes | |
|
|