one behind duplicated, and the correct
This commit is contained in:
@@ -98,7 +98,15 @@ def receive_record_relay_and_detect(stream_url, output_path, relay_url,
|
||||
|
||||
# Scene detection: CUDA decode (GPU) → select filter (CPU, lightweight)
|
||||
# → showinfo → MJPEG piped to stdout
|
||||
select_expr = f"gt(scene,{scene_threshold})"
|
||||
#
|
||||
# Flush trick: select the scene-change frame AND the next 2 frames.
|
||||
# The pipeline has 2 levels of buffering (encoder + muxer), so we
|
||||
# need 2 flush frames to push the real scene-change frame out.
|
||||
# mod(selected_n,3) prevents chaining: after 2 flushes, selected_n
|
||||
# hits a multiple of 3 and the chain stops.
|
||||
scene_expr = f"gt(scene,{scene_threshold})"
|
||||
flush_expr = "eq(n,prev_selected_n+1)*mod(selected_n,3)"
|
||||
select_expr = f"{scene_expr}+{flush_expr}"
|
||||
scene_stream = stream.filter("select", select_expr).filter("showinfo")
|
||||
scene_out = ffmpeg.output(
|
||||
scene_stream, "pipe:1",
|
||||
|
||||
Reference in New Issue
Block a user