diff --git a/CHANGELOG.md b/CHANGELOG.md index 327a2d9a1..1a46ef4fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Rework startup process to show UI as early as possible - A minimal UI will indicate when the database and search index are initializing - The UI will automatically refresh when the initialization processes have completed +- Force ffmpeg to use one thread when hardware acceleration is used since hardware acceleration does not support multiple threads ## [0.8.0-beta] - 2023-06-23 ### Added diff --git a/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs b/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs index 0e6ecb267..199b54f32 100644 --- a/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs +++ b/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs @@ -616,7 +616,16 @@ public abstract class PipelineBuilderBase : IPipelineBuilder private void SetThreadCount(FFmpegState ffmpegState, FrameState desiredState, IList pipelineSteps) { - if (ffmpegState.Start.Exists(s => s > TimeSpan.Zero) && desiredState.Realtime) + if (ffmpegState.DecoderHardwareAccelerationMode != HardwareAccelerationMode.None || + ffmpegState.EncoderHardwareAccelerationMode != HardwareAccelerationMode.None) + { + _logger.LogInformation( + "Forcing {Threads} ffmpeg thread when hardware acceleration is used", + 1); + + pipelineSteps.Insert(0, new ThreadCountOption(1)); + } + else if (ffmpegState.Start.Exists(s => s > TimeSpan.Zero) && desiredState.Realtime) { _logger.LogInformation( "Forcing {Threads} ffmpeg thread due to buggy combination of stream seek and realtime output",