diff --git a/docs/docs/configuration/advanced.md b/docs/docs/configuration/advanced.md index 730b0f6b4..1c99ec1c5 100644 --- a/docs/docs/configuration/advanced.md +++ b/docs/docs/configuration/advanced.md @@ -162,15 +162,15 @@ listen [::]:5000 ipv6only=off; ### Custom ffmpeg build -Included with Frigate is a build of ffmpeg that works for the vast majority of users. However, there exists some hardware setups which have incompatibilities with the included build. In this case, a docker volume mapping can be used to overwrite the included ffmpeg build with an ffmpeg build that works for your specific hardware setup. +Included with Frigate is a build of ffmpeg that works for the vast majority of users. However, there exists some hardware setups which have incompatibilities with the included build. In this case, statically built ffmpeg binary can be downloaded to /config and used. To do this: -1. Download your ffmpeg build and uncompress to a folder on the host (let's use `/home/appdata/frigate/custom-ffmpeg` for this example). +1. Download your ffmpeg build and uncompress to the Frigate config folder. 2. Update your docker-compose or docker CLI to include `'/home/appdata/frigate/custom-ffmpeg':'/usr/lib/btbn-ffmpeg':'ro'` in the volume mappings. 3. Restart Frigate and the custom version will be used if the mapping was done correctly. -NOTE: The folder that is mapped from the host needs to be the folder that contains `/bin`. So if the full structure is `/home/appdata/frigate/custom-ffmpeg/bin/ffmpeg` then `/home/appdata/frigate/custom-ffmpeg` needs to be mapped to `/usr/lib/btbn-ffmpeg`. +NOTE: The folder that is set for the config needs to be the folder that contains `/bin`. So if the full structure is `/home/appdata/frigate/custom-ffmpeg/bin/ffmpeg` then the `ffmpeg -> path` field should be `/config/custom-ffmpeg/bin`. ### Custom go2rtc version diff --git a/frigate/api/media.py b/frigate/api/media.py index db9ef5ab2..e146fa195 100644 --- a/frigate/api/media.py +++ b/frigate/api/media.py @@ -278,7 +278,9 @@ def submit_recording_snapshot_to_plus(camera_name: str, frame_time: str): config: FrigateConfig = current_app.frigate_config recording: Recordings = recording_query.get() time_in_segment = frame_time - recording.start_time - image_data = get_image_from_recording(config.ffmpeg, recording.path, time_in_segment, "png") + image_data = get_image_from_recording( + config.ffmpeg, recording.path, time_in_segment, "png" + ) if not image_data: return make_response( @@ -481,7 +483,7 @@ def recording_clip(camera_name, start_ts, end_ts): if not os.path.exists(path): ffmpeg_cmd = [ - config.ffmpeg.executable_path, + config.ffmpeg.ffmpeg_path, "-hide_banner", "-y", "-protocol_whitelist", @@ -1148,7 +1150,7 @@ def preview_gif(camera_name: str, start_ts, end_ts, max_cache_age=2592000): seconds = int(diff % 60) config: FrigateConfig = current_app.frigate_config ffmpeg_cmd = [ - config.ffmpeg.executable_path, + config.ffmpeg.ffmpeg_path, "-hide_banner", "-loglevel", "warning", @@ -1215,7 +1217,7 @@ def preview_gif(camera_name: str, start_ts, end_ts, max_cache_age=2592000): config: FrigateConfig = current_app.frigate_config ffmpeg_cmd = [ - config.ffmpeg.executable_path, + config.ffmpeg.ffmpeg_path, "-hide_banner", "-loglevel", "warning", @@ -1310,7 +1312,7 @@ def preview_mp4(camera_name: str, start_ts, end_ts, max_cache_age=604800): seconds = int(diff % 60) config: FrigateConfig = current_app.frigate_config ffmpeg_cmd = [ - config.ffmpeg.executable_path, + config.ffmpeg.ffmpeg_path, "-hide_banner", "-loglevel", "warning", @@ -1375,7 +1377,7 @@ def preview_mp4(camera_name: str, start_ts, end_ts, max_cache_age=604800): config: FrigateConfig = current_app.frigate_config ffmpeg_cmd = [ - config.ffmpeg.executable_path, + config.ffmpeg.ffmpeg_path, "-hide_banner", "-loglevel", "warning", diff --git a/frigate/config.py b/frigate/config.py index fd619077f..3963d06d3 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -886,7 +886,7 @@ class FfmpegConfig(FrigateBaseModel): ) @property - def executable_path(self) -> str: + def ffmpeg_path(self) -> str: if self.path == "default": if int(os.getenv("LIBAVFORMAT_VERSION_MAJOR", "59")) >= 59: return "/usr/lib/ffmpeg/7.0/bin/ffmpeg" @@ -897,8 +897,7 @@ class FfmpegConfig(FrigateBaseModel): elif self.path == "5.0": return "/usr/lib/ffmpeg/5.0/bin/ffmpeg" else: - return self.path - + return f"{self.path}/bin/ffmpeg" class CameraRoleEnum(str, Enum): diff --git a/frigate/events/audio.py b/frigate/events/audio.py index d9b7f6d3f..662eb5189 100644 --- a/frigate/events/audio.py +++ b/frigate/events/audio.py @@ -50,7 +50,7 @@ def get_ffmpeg_command(ffmpeg: FfmpegConfig) -> list[str]: or get_ffmpeg_arg_list(ffmpeg.input_args) ) return ( - [ffmpeg.executable_path, "-vn", "-threads", "1"] + [ffmpeg.ffmpeg_path, "-vn", "-threads", "1"] + input_args + ["-i"] + [ffmpeg_input.path] diff --git a/frigate/output/birdseye.py b/frigate/output/birdseye.py index 022ddda96..00e7c7ad1 100644 --- a/frigate/output/birdseye.py +++ b/frigate/output/birdseye.py @@ -133,7 +133,7 @@ class FFMpegConverter(threading.Thread): self.recreate_birdseye_pipe() ffmpeg_cmd = [ - ffmpeg.executable_path, + ffmpeg.ffmpeg_path, "-threads", "1", "-f", diff --git a/frigate/output/camera.py b/frigate/output/camera.py index 96a630fcf..317d7902e 100644 --- a/frigate/output/camera.py +++ b/frigate/output/camera.py @@ -31,7 +31,7 @@ class FFMpegConverter(threading.Thread): self.stop_event = stop_event ffmpeg_cmd = [ - ffmpeg.executable_path, + ffmpeg.ffmpeg_path, "-threads", "1", "-f", diff --git a/frigate/record/export.py b/frigate/record/export.py index 8000bf6cb..2cb1706b6 100644 --- a/frigate/record/export.py +++ b/frigate/record/export.py @@ -116,7 +116,7 @@ class RecordingExporter(threading.Thread): minutes = int(diff / 60) seconds = int(diff % 60) ffmpeg_cmd = [ - self.config.ffmpeg.executable_path, + self.config.ffmpeg.ffmpeg_path, "-hide_banner", "-loglevel", "warning", @@ -286,7 +286,7 @@ def migrate_exports(ffmpeg: FfmpegConfig, camera_names: list[str]): ) # use jpg because webp encoder can't get quality low enough ffmpeg_cmd = [ - ffmpeg.executable_path, + ffmpeg.ffmpeg_path, "-hide_banner", "-loglevel", "warning", diff --git a/frigate/record/maintainer.py b/frigate/record/maintainer.py index e8f2c8593..6db08ee81 100644 --- a/frigate/record/maintainer.py +++ b/frigate/record/maintainer.py @@ -387,7 +387,7 @@ class RecordingMaintainer(threading.Thread): # add faststart to kept segments to improve metadata reading p = await asyncio.create_subprocess_exec( - self.config.ffmpeg.executable_path, + self.config.ffmpeg.ffmpeg_path, "-hide_banner", "-y", "-i",