From fecce92e97523ab092f3019354bcc5797081dfe9 Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Sat, 16 May 2026 16:34:14 -0500 Subject: [PATCH] fix: use configured ffmpeg with all graphics elements (#2892) --- CHANGELOG.md | 2 ++ .../Streaming/Graphics/GraphicsEngine.cs | 6 ++++++ .../Streaming/Graphics/Motion/MotionElement.cs | 3 ++- .../Streaming/Graphics/Subtitle/SubtitleElement.cs | 3 ++- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index acd9b69d4..e70e06c0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed - Fix HLS Direct playback when JWT auth is also used +- Use configured ffmpeg path for motion and subtitle graphics elements + - Previously, these elements required ffmpeg to be on PATH ## [26.5.1] - 2026-05-08 ### Fixed diff --git a/ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsEngine.cs b/ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsEngine.cs index 47af8670e..3c4198b8d 100644 --- a/ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsEngine.cs +++ b/ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsEngine.cs @@ -27,6 +27,10 @@ public class GraphicsEngine( ConfigElementKey.FFprobePath, cancellationToken); + Option ffmpegPath = await configElementRepository.GetValue( + ConfigElementKey.FFmpegPath, + cancellationToken); + var elements = new List(); foreach (GraphicsElementContext element in context.Elements) { @@ -54,6 +58,7 @@ public class GraphicsEngine( new MotionElement( motionElementDataContext.MotionElement, ffprobePath, + ffmpegPath, localStatisticsProvider, logger)); break; @@ -74,6 +79,7 @@ public class GraphicsEngine( templateFunctions, tempFilePool, subtitleElementContext.SubtitleElement, + ffmpegPath, variables, logger); diff --git a/ErsatzTV.Infrastructure/Streaming/Graphics/Motion/MotionElement.cs b/ErsatzTV.Infrastructure/Streaming/Graphics/Motion/MotionElement.cs index dd33f3e08..ce587bd5b 100644 --- a/ErsatzTV.Infrastructure/Streaming/Graphics/Motion/MotionElement.cs +++ b/ErsatzTV.Infrastructure/Streaming/Graphics/Motion/MotionElement.cs @@ -15,6 +15,7 @@ namespace ErsatzTV.Infrastructure.Streaming.Graphics; public class MotionElement( MotionGraphicsElement motionElement, Option ffprobePath, + Option ffmpegPath, ILocalStatisticsProvider localStatisticsProvider, ILogger logger) : GraphicsElement, IDisposable @@ -193,7 +194,7 @@ public class MotionElement( _state = MotionElementState.PlayingIn; - Command command = Cli.Wrap("ffmpeg") + Command command = Cli.Wrap(await ffmpegPath.IfNoneAsync("ffmpeg")) .WithArguments(arguments) .WithWorkingDirectory(FileSystemLayout.TempFilePoolFolder) .WithStandardOutputPipe(PipeTarget.ToStream(pipe.Writer.AsStream())); diff --git a/ErsatzTV.Infrastructure/Streaming/Graphics/Subtitle/SubtitleElement.cs b/ErsatzTV.Infrastructure/Streaming/Graphics/Subtitle/SubtitleElement.cs index eea8face9..55400116c 100644 --- a/ErsatzTV.Infrastructure/Streaming/Graphics/Subtitle/SubtitleElement.cs +++ b/ErsatzTV.Infrastructure/Streaming/Graphics/Subtitle/SubtitleElement.cs @@ -18,6 +18,7 @@ public class SubtitleElement( TemplateFunctions templateFunctions, ITempFilePool tempFilePool, SubtitleGraphicsElement subtitleElement, + Option ffmpegPath, Dictionary variables, ILogger logger) : GraphicsElement, IDisposable @@ -114,7 +115,7 @@ public class SubtitleElement( "-" ]; - Command command = Cli.Wrap("ffmpeg") + Command command = Cli.Wrap(await ffmpegPath.IfNoneAsync("ffmpeg")) .WithArguments(arguments) .WithWorkingDirectory(FileSystemLayout.TempFilePoolFolder) .WithStandardOutputPipe(PipeTarget.ToStream(pipe.Writer.AsStream()));