fix: use -timeout (RTSP socket I/O) instead of invalid -rw_timeout

This commit is contained in:
Claus Lohmar 2026-09-12 20:30:32 +01:00
parent fcc760363f
commit 53e12abbfc

View file

@ -80,7 +80,7 @@ func (rm *RecorderManager) StopAll() {
//
// Each segment is exactly 5 minutes. Gaps between segments are ~1-2s
// (FFmpeg restart overhead). The -t 300 flag bounds the segment by input
// duration, while -rw_timeout makes ffmpeg exit (rather than hang) when the
// duration, while -timeout makes ffmpeg exit (rather than hang) when the
// RTSP stream stalls, so the retry loop below can reconnect.
func (rm *RecorderManager) startRecorder(cam CameraConfig) {
rtspURL := cam.RTSPMain
@ -131,7 +131,7 @@ func (rm *RecorderManager) startRecorder(cam CameraConfig) {
cmd := exec.Command("ffmpeg",
"-hide_banner", "-loglevel", "error",
"-rtsp_transport", "tcp",
"-rw_timeout", "10000000", // 10s socket I/O timeout — exit on stalled stream
"-timeout", "10000000", // 10s socket I/O timeout — exit on stalled stream
"-i", rtspURL,
"-an", // drop audio (pcm_mulaw not supported in MP4)
"-c:v", "copy", // stream-copy video: zero transcoding, near-zero CPU