not use vulkan

This commit is contained in:
2026-04-03 11:01:08 -03:00
parent b0bd02049a
commit 4fef6d732b

View File

@@ -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: One ffmpeg process, three output branches from the same TCP input:
1. File output — c=copy to fMP4 (raw packets, no decode) 1. File output — c=copy to fMP4 (raw packets, no decode)
2. UDP relay — c=copy to mpegts for live display (raw packets) 2. UDP relay — c=copy to mpegts for live display (raw packets)
3. Scene frames — Vulkan decode + scdet_vulkan (GPU scene comparison, 3. Scene frames — CUDA decode (GPU) → select(scene) + showinfo (CPU)
sc_pass=1 drops non-scene frames on GPU) → hwdownload (only scene → MJPEG piped to stdout
frames hit CPU) → showinfo → MJPEG piped to stdout
Scene frames are piped to stdout as image2pipe/mjpeg to avoid the image2 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 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 = ffmpeg.input(
stream_url, fflags="nobuffer", flags="low_delay", stream_url, fflags="nobuffer", flags="low_delay",
hwaccel="vulkan", hwaccel_output_format="vulkan", hwaccel="cuda",
) )
# Copy outputs (raw packet remux, no decode) # 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", c="copy", f="mpegts",
) )
# Scene detection on Vulkan GPU — only scene-change frames leave the GPU # Scene detection: CUDA decode (GPU) → select filter (CPU, lightweight)
scdet_threshold = scene_threshold * 100 # config 0-1 → scdet 0-100 # → showinfo → MJPEG piped to stdout (avoids image2 muxer one-frame buffer)
scene_stream = ( select_expr = f"gt(scene,{scene_threshold})"
stream scene_stream = stream.filter("select", select_expr).filter("showinfo")
.filter("scdet_vulkan", threshold=scdet_threshold, sc_pass=1)
.filter("hwdownload")
.filter("format", "yuv420p")
.filter("showinfo")
)
scene_out = ffmpeg.output( scene_out = ffmpeg.output(
scene_stream, "pipe:1", scene_stream, "pipe:1",
f="image2pipe", vcodec="mjpeg", f="image2pipe", vcodec="mjpeg",