From 8fa1291e0ff3209d7cf3c23c7cf56c3524362ea1 Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Mon, 27 Jul 2026 17:47:25 -0500 Subject: [PATCH] Fix progress flags being inserted before nice's own -n flag, breaking every job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -progress pipe:1 -nostats belong to ffmpeg, not nice — they were landing right after cmd[0] (nice) instead of after the ffmpeg token, which made nice choke on an unrecognized option and fail before ffmpeg ever started. --- backend/transcode.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/transcode.py b/backend/transcode.py index efb2e71..6ecf201 100644 --- a/backend/transcode.py +++ b/backend/transcode.py @@ -195,7 +195,10 @@ async def _run(cmd: List[str], on_status, out_dir: Path, entry_filename: str, so duration = await probe_duration(source) if source else 0.0 await on_status("running", progress=0.0) # Machine-readable progress on stdout, separate from ffmpeg's normal stderr logging. - cmd = [cmd[0], "-progress", "pipe:1", "-nostats"] + cmd[1:] + # Insert right after the "ffmpeg" token, not cmd[0] — cmd is prefixed with `nice -n N`, + # and these flags belong to ffmpeg, not to nice. + ffmpeg_idx = cmd.index("ffmpeg") + cmd = cmd[:ffmpeg_idx + 1] + ["-progress", "pipe:1", "-nostats"] + cmd[ffmpeg_idx + 1:] try: proc = await asyncio.create_subprocess_exec( *cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE,