Skip to content

NVR with realtime local object detection for IP cameras

Stream probe fallback (#22971)

Josh Hawkins8fc1e97df5c8
diff --git a/frigate/util/services.py b/frigate/util/services.py
index 15c439d484..4f89db0927 100644
--- a/frigate/util/services.py
+++ b/frigate/util/services.py
@@ -711,23 +711,31 @@ def ffprobe_stream(ffmpeg, path: str, detailed: bool = False) -> sp.CompletedPro
else:
format_entries = None
- ffprobe_cmd = [
- ffmpeg.ffprobe_path,
- "-timeout",
- "1000000",
- "-print_format",
- "json",
- "-show_entries",
- f"stream={stream_entries}",
- ]
+ def run(rtsp_transport: Optional[str] = None) -> sp.CompletedProcess:
+ cmd = [ffmpeg.ffprobe_path]
+ if rtsp_transport:
+ cmd += ["-rtsp_transport", rtsp_transport]
+ cmd += [
+ "-timeout",
+ "1000000",
+ "-print_format",
+ "json",
+ "-show_entries",
+ f"stream={stream_entries}",
+ ]
+ if detailed and format_entries:
+ cmd.extend(["-show_entries", f"format={format_entries}"])
+ cmd.extend(["-loglevel", "error", clean_path])
+ return sp.run(cmd, capture_output=True)
- # Add format entries for detailed mode
- if detailed and format_entries:
- ffprobe_cmd.extend(["-show_entries", f"format={format_entries}"])
+ result = run()
- ffprobe_cmd.extend(["-loglevel", "error", clean_path])
+ # For RTSP: retry with explicit TCP transport if the first attempt failed
+ # (default UDP may be blocked)
+ if result.returncode != 0 and clean_path.startswith("rtsp://"):
+ result = run(rtsp_transport="tcp")
- return sp.run(ffprobe_cmd, capture_output=True)
+ return result
def vainfo_hwaccel(device_name: Optional[str] = None) -> sp.CompletedProcess:
diff --git a/web/public/locales/en/views/settings.json b/web/public/locales/en/views/settings.json
index 012023b374..5a50e4daf1 100644
--- a/web/public/locales/en/views/settings.json
+++ b/web/public/locales/en/views/settings.json
@@ -415,7 +415,7 @@
"audioCodecGood": "Audio codec is {{codec}}.",
"resolutionHigh": "A resolution of {{resolution}} may cause increased resource usage.",
"resolutionLow": "A resolution of {{resolution}} may be too low for reliable detection of small objects.",
- "resolutionUnknown": "The resolution of this stream could not be probed. This will cause issues on startup. You should manually set the detect resolution in Settings or your config.",
+ "resolutionUnknown": "The resolution of this stream could not be probed. You should manually set the detect resolution in Settings or your config.",
"noAudioWarning": "No audio detected for this stream, recordings will not have audio.",
"audioCodecRecordError": "The AAC audio codec is required to support audio in recordings.",
"audioCodecRequired": "An audio stream is required to support audio detection.",