Add Linux/Windows support
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user