not use vulkan
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user