diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c3a0646f..7e1035417 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - This should improve performance of library scans - Add toggle to hide/show disabled channels in channel list - Add disabled text color and `(D)` and `(H)` labels for disabled and hidden channels in channel list +- Graphics engine: fix subtitle path escaping and font loading ### Changed - Classic schedules: `Refresh` classic playouts from playout list; do not `Reset` them diff --git a/ErsatzTV.Infrastructure/Streaming/Graphics/Subtitle/SubtitleElement.cs b/ErsatzTV.Infrastructure/Streaming/Graphics/Subtitle/SubtitleElement.cs index 1c167b77c..de7911112 100644 --- a/ErsatzTV.Infrastructure/Streaming/Graphics/Subtitle/SubtitleElement.cs +++ b/ErsatzTV.Infrastructure/Streaming/Graphics/Subtitle/SubtitleElement.cs @@ -1,5 +1,6 @@ using System.Buffers; using System.IO.Pipelines; +using System.Runtime.InteropServices; using CliWrap; using ErsatzTV.Core; using ErsatzTV.Core.FFmpeg; @@ -84,12 +85,25 @@ public class SubtitleElement( await File.WriteAllTextAsync(subtitleTemplateFile, textToRender, cancellationToken); string subtitleFile = Path.GetFileName(subtitleTemplateFile); + string fontsDir = FileSystemLayout.ResourcesCacheFolder; + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + fontsDir = fontsDir + .Replace(@"\", @"/\") + .Replace(@":/", @"\\:/"); + + subtitleFile = subtitleFile + .Replace(@"\", @"/\") + .Replace(@":/", @"\\:/"); + } + List arguments = [ "-nostdin", "-hide_banner", "-nostats", "-loglevel", "error", "-f", "lavfi", "-i", - $"color=c=black@0.0:s={context.FrameSize.Width}x{context.FrameSize.Height}:r={context.FrameRate},format=bgra,subtitles='{subtitleFile}':alpha=1", + $"color=c=black@0.0:s={context.FrameSize.Width}x{context.FrameSize.Height}:r={context.FrameRate},format=bgra,subtitles={subtitleFile}:fontsdir={fontsDir}:alpha=1", "-f", "image2pipe", "-pix_fmt", "bgra", "-vcodec", "rawvideo",