From 3886064f3313704e1a83a58c83b786a182c8f9f3 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 30 May 2024 10:15:33 -0600 Subject: [PATCH] Limit ffmpeg thread counts for secondary ffmpeg processes --- frigate/events/audio.py | 4 +++- frigate/output/birdseye.py | 4 ++++ frigate/output/camera.py | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/frigate/events/audio.py b/frigate/events/audio.py index fc8f38dad..074b44735 100644 --- a/frigate/events/audio.py +++ b/frigate/events/audio.py @@ -50,11 +50,13 @@ def get_ffmpeg_command(ffmpeg: FfmpegConfig) -> list[str]: or get_ffmpeg_arg_list(ffmpeg.input_args) ) return ( - ["ffmpeg", "-vn"] + ["ffmpeg", "-vn", "-threads", "1"] + input_args + ["-i"] + [ffmpeg_input.path] + [ + "-threads", + "1", "-f", f"{AUDIO_FORMAT}", "-ar", diff --git a/frigate/output/birdseye.py b/frigate/output/birdseye.py index 809ded174..2b17a4cf1 100644 --- a/frigate/output/birdseye.py +++ b/frigate/output/birdseye.py @@ -134,6 +134,8 @@ class FFMpegConverter(threading.Thread): ffmpeg_cmd = [ "ffmpeg", + "-threads", + "1", "-f", "rawvideo", "-pix_fmt", @@ -142,6 +144,8 @@ class FFMpegConverter(threading.Thread): f"{in_width}x{in_height}", "-i", "pipe:", + "-threads", + "1", "-f", "mpegts", "-s", diff --git a/frigate/output/camera.py b/frigate/output/camera.py index b63e0983a..b9c607375 100644 --- a/frigate/output/camera.py +++ b/frigate/output/camera.py @@ -31,6 +31,8 @@ class FFMpegConverter(threading.Thread): ffmpeg_cmd = [ "ffmpeg", + "-threads", + "1", "-f", "rawvideo", "-pix_fmt", @@ -39,6 +41,8 @@ class FFMpegConverter(threading.Thread): f"{in_width}x{in_height}", "-i", "pipe:", + "-threads", + "1", "-f", "mpegts", "-s",