From 2d9556f5f3a1998fd9218bffc443bee6d53d6932 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Fri, 17 Mar 2023 17:14:57 -0500 Subject: [PATCH] set threads to 2 (#5747) --- docs/docs/configuration/index.md | 4 ++-- frigate/config.py | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/docs/configuration/index.md b/docs/docs/configuration/index.md index 4859c7e75..62c3a5dee 100644 --- a/docs/docs/configuration/index.md +++ b/docs/docs/configuration/index.md @@ -167,7 +167,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 2 # Optional: global hwaccel args (default: shown below) # NOTE: See hardware acceleration docs for your specific device hwaccel_args: [] @@ -176,7 +176,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 2 -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 f318c8346..d19dfbfd0 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -395,9 +395,18 @@ class BirdseyeCameraConfig(BaseModel): ) -FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning"] +# Note: Setting threads to less than 2 caused several issues with recording segments +# https://github.com/blakeblackshear/frigate/issues/5659 +FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning", "-threads", "2"] FFMPEG_INPUT_ARGS_DEFAULT = "preset-rtsp-generic" -DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT = ["-f", "rawvideo", "-pix_fmt", "yuv420p"] +DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT = [ + "-threads", + "2", + "-f", + "rawvideo", + "-pix_fmt", + "yuv420p", +] RTMP_FFMPEG_OUTPUT_ARGS_DEFAULT = "preset-rtmp-generic" RECORD_FFMPEG_OUTPUT_ARGS_DEFAULT = "preset-record-generic"