From 27cd57bf9b951b1b571fcfbbb7d0bc684d42ce29 Mon Sep 17 00:00:00 2001 From: MarcA711 <40744649+MarcA711@users.noreply.github.com> Date: Mon, 20 Nov 2023 15:50:21 +0000 Subject: [PATCH] add go2rtc presets for rk hw accel --- .../main/rootfs/usr/local/go2rtc/create_config.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docker/main/rootfs/usr/local/go2rtc/create_config.py b/docker/main/rootfs/usr/local/go2rtc/create_config.py index 7c6b7b56e..16286669a 100644 --- a/docker/main/rootfs/usr/local/go2rtc/create_config.py +++ b/docker/main/rootfs/usr/local/go2rtc/create_config.py @@ -113,6 +113,20 @@ if int(os.environ["LIBAVFORMAT_VERSION_MAJOR"]) < 59: "rtsp" ] = "-fflags nobuffer -flags low_delay -stimeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}" +# add hardware acceleration presets for rockchip devices +# will be removed, when frigate uses a go2rtc version that includes these presets +if go2rtc_config.get("ffmpeg") is None: + go2rtc_config["ffmpeg"] = { + "h264/rk": "-c:v h264_rkmpp_encoder -g 50 -bf 0", + "h265/rk": "-c:v hevc_rkmpp_encoder -g 50 -bf 0" + } +else: + if go2rtc_config["ffmpeg"].get("h264/rk") is None: + go2rtc_config["ffmpeg"]["h264/rk"] = "-c:v h264_rkmpp_encoder -g 50 -bf 0" + + if go2rtc_config["ffmpeg"].get("h265/rk") is None: + go2rtc_config["ffmpeg"]["h265/rk"] = "-c:v hevc_rkmpp_encoder -g 50 -bf 0" + for name in go2rtc_config.get("streams", {}): stream = go2rtc_config["streams"][name]