From 044c8b7ad31183f30d07e2cd6f57d3bfc8a469ef Mon Sep 17 00:00:00 2001 From: Jason Dove <1695733+jasongdove@users.noreply.github.com> Date: Mon, 8 Sep 2025 08:36:13 -0500 Subject: [PATCH] fix graphics engine with scaling behavior crop (#2398) --- CHANGELOG.md | 1 + ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs | 4 +++- ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85073ce55..ad916f0b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix scaling anamorphic content in locales that don't use period as a decimal separator (e.g. `,`) - Block schedules: fix playout build crash when empty collection uses random playback order - Fix watermarks and graphics elements on primary content split by mid-roll filler +- Fix watermarks and graphics elements when `Scaling Behavior` is `Crop` ### Changed - **BREAKING CHANGE**: change how `Scripted Schedule` system works diff --git a/ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs b/ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs index 76219500b..3cacf6102 100644 --- a/ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs +++ b/ErsatzTV.Core/FFmpeg/FFmpegLibraryProcessService.cs @@ -490,11 +490,13 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService { graphicsEngineInput = new GraphicsEngineInput(); + FrameSize targetSize = await desiredState.CroppedSize.IfNoneAsync(desiredState.ScaledSize); + graphicsEngineContext = new GraphicsEngineContext( channel.Number, audioVersion.MediaItem, graphicsElementContexts, - new Resolution { Width = desiredState.ScaledSize.Width, Height = desiredState.ScaledSize.Height }, + new Resolution { Width = targetSize.Width, Height = targetSize.Height }, channel.FFmpegProfile.Resolution, await playbackSettings.FrameRate.IfNoneAsync(24), channelStartTime, diff --git a/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs b/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs index 1a8edd561..df0d86afc 100644 --- a/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs +++ b/ErsatzTV.FFmpeg/Pipeline/PipelineBuilderBase.cs @@ -214,8 +214,10 @@ public abstract class PipelineBuilderBase : IPipelineBuilder foreach (GraphicsEngineInput graphicsEngineInput in _graphicsEngineInput) { + var targetSize = desiredState.CroppedSize.IfNone(desiredState.PaddedSize); + graphicsEngineInput.AddOption( - new RawVideoInputOption(PixelFormat.BGRA, desiredState.PaddedSize, desiredState.FrameRate.IfNone(24))); + new RawVideoInputOption(PixelFormat.BGRA, targetSize, desiredState.FrameRate.IfNone(24))); } Debug.Assert(_videoInputFile.IsSome, "Pipeline builder requires exactly one video input file");