diff --git a/frigate/test/http_api/test_http_camera_access.py b/frigate/test/http_api/test_http_camera_access.py index ba3f79d3e9..9d1b57b1cc 100644 --- a/frigate/test/http_api/test_http_camera_access.py +++ b/frigate/test/http_api/test_http_camera_access.py @@ -418,6 +418,9 @@ class TestGo2rtcStreamAccess(BaseTestHttp): "ffmpeg:front_door#video=out.mp4", "ffmpeg:front_door#drawtext=x", "ffmpeg:front_door#width=1x", + "ffmpeg:front_door#audio=/16000", + "ffmpeg:front_door#audio=opus/", + "ffmpeg:front_door#audio=opus/16000/1", "ffmpeg:'front_door'", " ffmpeg:#input=-re", ): @@ -444,6 +447,8 @@ class TestGo2rtcStreamAccess(BaseTestHttp): "ffmpeg:front_door#audio=opus", "ffmpeg:front_door#video=h264#hardware=vaapi", "ffmpeg:front_door#video=h264#width=1280#rotate=-90", + # documented HomeKit source + "ffmpeg:front_door#video=h264#width=1280#height=720#audio=opus/16000", "ffmpeg:http://10.0.0.1/flv?port=1935&app=bcs#video=copy", ): resp = client.put("/go2rtc/streams/legit", params={"src": src}) diff --git a/frigate/util/services.py b/frigate/util/services.py index c460a71f99..d46c6257d9 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -994,7 +994,8 @@ _GO2RTC_FFMPEG_NUMERIC_PARAMS = frozenset( {"width", "height", "rotate", "bitrate", "timeout"} ) _GO2RTC_FFMPEG_FLAG_PARAMS = frozenset({"async"}) -_GO2RTC_FFMPEG_NAME_VALUE = re.compile(r"^[A-Za-z0-9_]*$") +# a preset or codec name, optionally with a sample rate (e.g. opus/16000) +_GO2RTC_FFMPEG_NAME_VALUE = re.compile(r"^([A-Za-z0-9_]*|[A-Za-z0-9_]+/[0-9]{1,6})$") _GO2RTC_FFMPEG_NUMERIC_VALUE = re.compile(r"^-?[0-9]+[kKmM]?$")