From 878560935c6f724928a1202dd09e7b5db9306db0 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 19 Sep 2024 12:37:20 -0600 Subject: [PATCH] Add hwaccel arg for disabling gamma --- frigate/ffmpeg_presets.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frigate/ffmpeg_presets.py b/frigate/ffmpeg_presets.py index 19103cdf8..1cbb8af41 100644 --- a/frigate/ffmpeg_presets.py +++ b/frigate/ffmpeg_presets.py @@ -94,7 +94,7 @@ PRESETS_HW_ACCEL_SCALE = { FFMPEG_HWACCEL_VAAPI: "-r {0} -vf fps={0},scale_vaapi=w={1}:h={2},hwdownload,eq=gamma=1.05", "preset-intel-qsv-h264": "-r {0} -vf vpp_qsv=framerate={0}:w={1}:h={2}:format=nv12,hwdownload,format=nv12,format=yuv420p", "preset-intel-qsv-h265": "-r {0} -vf vpp_qsv=framerate={0}:w={1}:h={2}:format=nv12,hwdownload,format=nv12,format=yuv420p", - FFMPEG_HWACCEL_NVIDIA: "-r {0} -vf fps={0},scale_cuda=w={1}:h={2}:format=nv12,hwdownload,format=nv12,format=yuv420p", + FFMPEG_HWACCEL_NVIDIA: "-r {0} -vf fps={0},scale_cuda=w={1}:h={2},hwdownload,eq=gamma=1.05", "preset-jetson-h264": "-r {0}", # scaled in decoder "preset-jetson-h265": "-r {0}", # scaled in decoder "preset-rk-h264": "-r {0} -vf scale_rkrga=w={1}:h={2}:format=yuv420p:force_original_aspect_ratio=0,hwmap=mode=read,format=yuv420p", @@ -185,6 +185,9 @@ def parse_preset_hardware_acceleration_scale( else: scale = PRESETS_HW_ACCEL_SCALE.get(arg, PRESETS_HW_ACCEL_SCALE["default"]) + if ",hwdownload,eq=gamma=1.05" in scale and os.environ.get("FFMPEG_DISABLE_GAMMA_EQUALIZER") is not None: + scale.replace(",hwdownload,eq=gamma=1.05", ":format=nv12,hwdownload,format=nv12,format=yuv420p") + scale = scale.format(fps, width, height).split(" ") scale.extend(detect_args) return scale