CMD list handled differently when shell=True

This commit is contained in:
2026-03-05 23:03:59 +01:00
parent 1dc3be801b
commit 15e19fa056
4 changed files with 121 additions and 107 deletions

View File

@@ -52,8 +52,8 @@ def _encode_720p_fallback(
cmd = [
"ffmpeg", "-v", "quiet", "-stats",
"-i", upscale_output,
"-i", video_source,
"-i", f'"{upscale_output}"',
"-i", f'"{video_source}"',
"-map", "0:v:0",
"-map", "1:a:0",
"-c:v", "libx264",
@@ -65,9 +65,12 @@ def _encode_720p_fallback(
"-sn",
"-map_metadata", "-1",
"-movflags", "+faststart",
output
f'"{output}"'
]
if sys.platform == 'linux':
cmd = ' '.join(cmd)
try:
subprocess.run(cmd, shell=True, check=True)
except subprocess.CalledProcessError as e:
@@ -135,8 +138,8 @@ def _encode(
cmd = [
"ffmpeg", "-v", "quiet", "-stats",
"-i", preset['input_video'],
"-i", source_video,
"-i", f'"{preset['input_video']}"',
"-i", f'"{source_video}"',
"-map", "0:v:0", # Video from Upscale
"-map", "1:a:0", # Audio from Source
"-c:v", preset['encoder'],
@@ -164,10 +167,11 @@ def _encode(
"-media_seg_name", "chunks/chunk-stream$RepresentationID$-$Number%05d$.webm", # Media segments
"-seg_duration", str(segment_duration), # DASH segment duration
"-f", "dash",
os.path.join(cdn_folder, preset['out_folder'], 'manifest.mpd')
f'"{os.path.join(cdn_folder, preset['out_folder'], 'manifest.mpd')}"'
]
print(cmd)
if sys.platform == 'linux':
cmd = ' '.join(cmd)
try:
subprocess.run(cmd, shell=True, check=True)