From b7333557a15053df3372f0a6793a95b4753f8aa9 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Wed, 12 Mar 2025 15:54:28 -0600 Subject: [PATCH] Enable audio by default (#17125) * Remove mp4 query, allowing go2rtc to send any audio * Add audio transcoding by default --- .../rootfs/usr/local/go2rtc/create_config.py | 25 ++++++------------- frigate/config/camera/ffmpeg.py | 2 +- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/docker/main/rootfs/usr/local/go2rtc/create_config.py b/docker/main/rootfs/usr/local/go2rtc/create_config.py index 30b78e1e1..5d8e80f9d 100644 --- a/docker/main/rootfs/usr/local/go2rtc/create_config.py +++ b/docker/main/rootfs/usr/local/go2rtc/create_config.py @@ -80,24 +80,15 @@ if go2rtc_config["webrtc"].get("candidates") is None: go2rtc_config["webrtc"]["candidates"] = default_candidates -# sets default RTSP response to be equivalent to ?video=h264,h265&audio=aac -# this means user does not need to specify audio codec when using restream -# as source for frigate and the integration supports HLS playback -if go2rtc_config.get("rtsp") is None: - go2rtc_config["rtsp"] = {"default_query": "mp4"} -else: - if go2rtc_config["rtsp"].get("default_query") is None: - go2rtc_config["rtsp"]["default_query"] = "mp4" +if go2rtc_config["rtsp"].get("username") is not None: + go2rtc_config["rtsp"]["username"] = go2rtc_config["rtsp"]["username"].format( + **FRIGATE_ENV_VARS + ) - if go2rtc_config["rtsp"].get("username") is not None: - go2rtc_config["rtsp"]["username"] = go2rtc_config["rtsp"]["username"].format( - **FRIGATE_ENV_VARS - ) - - if go2rtc_config["rtsp"].get("password") is not None: - go2rtc_config["rtsp"]["password"] = go2rtc_config["rtsp"]["password"].format( - **FRIGATE_ENV_VARS - ) +if go2rtc_config["rtsp"].get("password") is not None: + go2rtc_config["rtsp"]["password"] = go2rtc_config["rtsp"]["password"].format( + **FRIGATE_ENV_VARS + ) # ensure ffmpeg path is set correctly path = config.get("ffmpeg", {}).get("path", "default") diff --git a/frigate/config/camera/ffmpeg.py b/frigate/config/camera/ffmpeg.py index 0b1ec2331..04bbfac7b 100644 --- a/frigate/config/camera/ffmpeg.py +++ b/frigate/config/camera/ffmpeg.py @@ -21,7 +21,7 @@ __all__ = [ FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning", "-threads", "2"] FFMPEG_INPUT_ARGS_DEFAULT = "preset-rtsp-generic" -RECORD_FFMPEG_OUTPUT_ARGS_DEFAULT = "preset-record-generic" +RECORD_FFMPEG_OUTPUT_ARGS_DEFAULT = "preset-record-generic-audio-aac" DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT = [ "-threads", "2",