Add Linux/Windows support

This commit is contained in:
2026-03-19 18:16:12 +01:00
parent 479ac49796
commit 14bb4ac95f
4 changed files with 95 additions and 52 deletions

View File

@@ -40,20 +40,43 @@ def _interpolate(
vapoursynth_file: str,
interpolate_output: str,
):
cmd = [
"vspipe",
"-c", "y4m",
vapoursynth_file,
"-", "|",
"ffmpeg", "-v", "quiet", "-stats",
"-i", "-",
"-c:v", "hevc_nvenc",
"-qp", "5",
interpolate_output
]
print('Started Interpolation')
try:
subprocess.run(cmd, shell=True, check=True)
# First process (vspipe)
vspipe = subprocess.Popen(
[
"vspipe",
"-c", "y4m",
vapoursynth_file,
"-"
],
stdout=subprocess.PIPE
)
# Second process (ffmpeg), reading from vspipe
ffmpeg = subprocess.Popen(
[
"ffmpeg",
"-v", "quiet", "-stats",
"-f", "yuv4mpegpipe",
"-i", "-",
"-c:v", "hevc_nvenc",
"-qp", "5",
interpolate_output
],
stdin=vspipe.stdout
)
# Important: allow vspipe to receive SIGPIPE if ffmpeg exits
vspipe.stdout.close()
ffmpeg.wait()
vspipe.wait()
if ffmpeg.returncode != 0:
raise subprocess.CalledProcessError(ffmpeg.returncode, "ffmpeg")
except subprocess.CalledProcessError as e:
print(f"\nffmpeg failed with error code {e.returncode}", file=sys.stderr)
sys.exit(e.returncode)