From 52459bf34865ecba2fc278cec201ca15b5208799 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 16 Feb 2023 15:44:10 -0700 Subject: [PATCH] Update ffmpeg args with low risk improvements (#5519) * Add threads 1 to input / output args * Remove cuvid from hwaccel * Update docs for new args * Formatting --- docs/docs/configuration/index.md | 4 ++-- frigate/config.py | 11 +++++++++-- frigate/ffmpeg_presets.py | 12 ------------ 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index dde11d2ad..0fcc2d614 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -148,7 +148,7 @@ birdseye: # More information about presets at https://docs.frigate.video/configuration/ffmpeg_presets ffmpeg: # Optional: global ffmpeg args (default: shown below) - global_args: -hide_banner -loglevel warning + global_args: -hide_banner -loglevel warning -threads 1 # Optional: global hwaccel args (default: shown below) # NOTE: See hardware acceleration docs for your specific device hwaccel_args: [] @@ -157,7 +157,7 @@ ffmpeg: # Optional: global output args output_args: # Optional: output args for detect streams (default: shown below) - detect: -f rawvideo -pix_fmt yuv420p + detect: -threads 1 -f rawvideo -pix_fmt yuv420p # Optional: output args for record streams (default: shown below) record: preset-record-generic # Optional: output args for rtmp streams (default: shown below) diff --git a/frigate/config.py b/frigate/config.py index 8744ef3d5..70d85ff66 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -370,9 +370,16 @@ class BirdseyeCameraConfig(BaseModel): ) -FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning"] +FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning", "-threads", "1"] FFMPEG_INPUT_ARGS_DEFAULT = "preset-rtsp-generic" -DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT = ["-f", "rawvideo", "-pix_fmt", "yuv420p"] +DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT = [ + "-threads", + "1", + "-f", + "rawvideo", + "-pix_fmt", + "yuv420p", +] RTMP_FFMPEG_OUTPUT_ARGS_DEFAULT = "preset-rtmp-generic" RECORD_FFMPEG_OUTPUT_ARGS_DEFAULT = "preset-record-generic" diff --git a/frigate/ffmpeg_presets.py b/frigate/ffmpeg_presets.py index cae1bd451..db9a1c688 100644 --- a/frigate/ffmpeg_presets.py +++ b/frigate/ffmpeg_presets.py @@ -92,30 +92,18 @@ PRESETS_HW_ACCEL_DECODE = { "cuda", "-hwaccel_output_format", "cuda", - "-extra_hw_frames", - "2", - "-c:v", - "h264_cuvid", ], "preset-nvidia-h265": [ "-hwaccel", "cuda", "-hwaccel_output_format", "cuda", - "-extra_hw_frames", - "2", - "-c:v", - "hevc_cuvid", ], "preset-nvidia-mjpeg": [ "-hwaccel", "cuda", "-hwaccel_output_format", "cuda", - "-extra_hw_frames", - "2", - "-c:v", - "mjpeg_cuvid", ], }