From 4fef6d732b0e1b7a081a2faf8d75d6f072580c24 Mon Sep 17 00:00:00 2001 From: buenosairesam Date: Fri, 3 Apr 2026 11:01:08 -0300 Subject: [PATCH] not use vulkan --- cht/stream/ffmpeg.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/cht/stream/ffmpeg.py b/cht/stream/ffmpeg.py index 4a951cc..566ecb4 100644 --- a/cht/stream/ffmpeg.py +++ b/cht/stream/ffmpeg.py @@ -70,9 +70,8 @@ def receive_record_relay_and_detect(stream_url, output_path, relay_url, One ffmpeg process, three output branches from the same TCP input: 1. File output — c=copy to fMP4 (raw packets, no decode) 2. UDP relay — c=copy to mpegts for live display (raw packets) - 3. Scene frames — Vulkan decode + scdet_vulkan (GPU scene comparison, - sc_pass=1 drops non-scene frames on GPU) → hwdownload (only scene - frames hit CPU) → showinfo → MJPEG piped to stdout + 3. Scene frames — CUDA decode (GPU) → select(scene) + showinfo (CPU) + → MJPEG piped to stdout Scene frames are piped to stdout as image2pipe/mjpeg to avoid the image2 muxer's one-frame buffering delay. The caller reads JPEG data from stdout @@ -81,7 +80,7 @@ def receive_record_relay_and_detect(stream_url, output_path, relay_url, """ stream = ffmpeg.input( stream_url, fflags="nobuffer", flags="low_delay", - hwaccel="vulkan", hwaccel_output_format="vulkan", + hwaccel="cuda", ) # Copy outputs (raw packet remux, no decode) @@ -97,15 +96,10 @@ def receive_record_relay_and_detect(stream_url, output_path, relay_url, c="copy", f="mpegts", ) - # Scene detection on Vulkan GPU — only scene-change frames leave the GPU - scdet_threshold = scene_threshold * 100 # config 0-1 → scdet 0-100 - scene_stream = ( - stream - .filter("scdet_vulkan", threshold=scdet_threshold, sc_pass=1) - .filter("hwdownload") - .filter("format", "yuv420p") - .filter("showinfo") - ) + # Scene detection: CUDA decode (GPU) → select filter (CPU, lightweight) + # → showinfo → MJPEG piped to stdout (avoids image2 muxer one-frame buffer) + select_expr = f"gt(scene,{scene_threshold})" + scene_stream = stream.filter("select", select_expr).filter("showinfo") scene_out = ffmpeg.output( scene_stream, "pipe:1", f="image2pipe", vcodec="mjpeg",