From d012de392753778963dc540689a09fa13c81cc14 Mon Sep 17 00:00:00 2001 From: Paulius Date: Thu, 9 Jul 2026 22:04:53 +0100 Subject: [PATCH] fix(transcode): wire GPU H264/H265 encoders into the live path too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _handle_batch (fixed in #25) passes h264_encoder/h265_encoder through to profiles.normalize(), but _handle_live never did — live sessions always fall back to the CPU defaults (libx264/libx265) regardless of --h264-encoder/--h265-encoder, even on a GPU-configured runner. Found running in production: with TRANSCODE_H264_ENCODER=h264_nvenc set, 19 concurrent live sessions were silently encoding on CPU. nvidia-smi showed a single ffmpeg process (an unrelated batch job) using the GPU, while all the live sessions' encode work was invisible to it. --- transcode/runner.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transcode/runner.py b/transcode/runner.py index 4025f20..d3e1f4e 100644 --- a/transcode/runner.py +++ b/transcode/runner.py @@ -173,7 +173,9 @@ async def _handle_live(request: web.Request) -> web.Response: payload = json.loads(await request.read() or "{}") raw = payload.get("profiles") or [{"height": 360}] - profs = [prof.normalize(p, av1_encoder=request.app["av1_encoder"]) for p in raw] + profs = [prof.normalize(p, av1_encoder=request.app["av1_encoder"], + h264_encoder=request.app["h264_encoder"], + h265_encoder=request.app["h265_encoder"]) for p in raw] reqs = [{"name": "in", "mime_type": "video/mp2t"}] reqs += [{"name": p["name"], "mime_type": "video/mp2t"} for p in profs]