This commit is contained in:
2026-08-29 20:08:27 +02:00
parent fb969de830
commit c08b55a424
2 changed files with 30 additions and 1 deletions
+2 -1
View File
@@ -80,7 +80,8 @@ build: $(BUILD_DIR)/$(TARGET)
.PHONY: run .PHONY: run
run: $(BUILD_DIR)/$(TARGET) run: $(BUILD_DIR)/$(TARGET)
$(BUILD_DIR)/$(TARGET) $(RUN_ARGS) # $(BUILD_DIR)/$(TARGET) $(RUN_ARGS)
$(PROJECT_DIR)/delay.sh /dev/video0 25 640x480 30
.PHONY: submodule-init .PHONY: submodule-init
submodule-init: submodule-init:
Executable
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
set -e
DEVICE=${1:-/dev/video0}
DELAY=${2:-30}
SIZE=${3:-1280x720}
FPS=${4:-20}
rm -rf /tmp/delay_stream*
ffmpeg -f v4l2 -framerate $FPS -video_size $SIZE -i $DEVICE \
-vcodec libx264 -preset ultrafast -tune zerolatency \
-f hls -hls_time 1 -hls_list_size $((DELAY + 5)) -hls_flags delete_segments \
/tmp/delay_stream.m3u8 &
FFMPEG_PID=$!
start=`date +%s`
until [ -f /tmp/delay_stream.m3u8 ]; do sleep 0.1; done
end=`date +%s`
sleep $((DELAY - end + start))
ffplay /tmp/delay_stream.m3u8
kill $FFMPEG_PID $HTTP_PID