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 |
![]() |
#1 | Link |
Registered User
Join Date: May 2011
Posts: 372
|
python piping subprocesses failes if print() is in vpy script
I have simple command line, which works ok, as it suppose to:
Code:
vspipe.exe test.vpy -c y4m - | ffmpeg.exe -y -i - out.mp4 Code:
from vapoursynth import core clip = core.ffms2.Source('source.avi') clip.set_output() print("Hi") Code:
import subprocess import shlex cmd = 'vspipe.exe test.vpy -c y4m - | ffmpeg.exe -y -i - out.mp4' new_args = cmd.split('|') cmd_lists = [shlex.split(arg) for arg in new_args] process1 = subprocess.Popen(cmd_lists[0], stdout=subprocess.PIPE) output, _ = process1.communicate() process2 = subprocess.Popen(cmd_lists[1], stdin=subprocess.PIPE, stdout=subprocess.PIPE) output2, _ = process2.communicate(input=output) Does anyone know what is going on? I tried to redirect stdout to nul, like below , it did not help. Code:
import subprocess import shlex import contextlib import os cmd = 'vspipe.exe test.vpy -c y4m - | ffmpeg.exe -y -i - out.mp4' new_args = cmd.split('|') cmd_lists = [shlex.split(arg) for arg in new_args] with contextlib.redirect_stdout(open(os.devnull, 'w')): process1 = subprocess.Popen(cmd_lists[0], stdout=subprocess.PIPE) output, _ = process1.communicate() process2 = subprocess.Popen(cmd_lists[1], stdin=subprocess.PIPE, stdout=subprocess.PIPE) output2, _ = process2.communicate(input=output) Last edited by _Al_; 23rd March 2025 at 05:30. |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|