diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b57d22e5..840bb4587 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Classic schedules: always start new alternate schedules with the first schedule item - Classic Schedules: log offline gaps longer than 1 hour due to strict fixed start times - Fix `HLS Segmenter V2` streaming mode with AMF acceleration +- Fix `HLS Segmenter V2` streaming mode with VideoToolbox acceleration - Fix startup process for database and search index initialization - Redirect all pages to home page when initializing to prevent errors - Clear stale sqlite migration lock on startup to prevent getting stuck on database initialization diff --git a/ErsatzTV.FFmpeg/Capabilities/FourCC.cs b/ErsatzTV.FFmpeg/Capabilities/FourCC.cs index f032bdbe7..12c0bb369 100644 --- a/ErsatzTV.FFmpeg/Capabilities/FourCC.cs +++ b/ErsatzTV.FFmpeg/Capabilities/FourCC.cs @@ -2,14 +2,20 @@ namespace ErsatzTV.FFmpeg.Capabilities; public static class FourCC { + public const string Av1 = "av01"; public const string H264 = "avc1"; public const string Hevc = "hvc1"; - public const string Vp9 = "vp90"; + public const string Mpeg2Video = "mp2v"; + public const string Mpeg4 = "mp4v"; + public const string Vp9 = "vp09"; public static readonly List AllVideoToolbox = [ + Av1, H264, Hevc, + Mpeg2Video, + Mpeg4, Vp9 ]; } diff --git a/ErsatzTV.FFmpeg/Capabilities/VideoToolboxHardwareCapabilities.cs b/ErsatzTV.FFmpeg/Capabilities/VideoToolboxHardwareCapabilities.cs index cc778ddd3..b74f1017c 100644 --- a/ErsatzTV.FFmpeg/Capabilities/VideoToolboxHardwareCapabilities.cs +++ b/ErsatzTV.FFmpeg/Capabilities/VideoToolboxHardwareCapabilities.cs @@ -28,6 +28,11 @@ public class VideoToolboxHardwareCapabilities : IHardwareCapabilities { if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && Decoders.IsEmpty) { + if (VideoToolboxUtil.IsHardwareDecoderSupported(FourCC.Av1, _logger)) + { + Decoders.AddOrUpdate(VideoFormat.Av1, true, (_, _) => true); + } + if (VideoToolboxUtil.IsHardwareDecoderSupported(FourCC.H264, _logger)) { Decoders.AddOrUpdate(VideoFormat.H264, true, (_, _) => true); @@ -38,6 +43,16 @@ public class VideoToolboxHardwareCapabilities : IHardwareCapabilities Decoders.AddOrUpdate(VideoFormat.Hevc, true, (_, _) => true); } + if (VideoToolboxUtil.IsHardwareDecoderSupported(FourCC.Mpeg2Video, _logger)) + { + Decoders.AddOrUpdate(VideoFormat.Mpeg2Video, true, (_, _) => true); + } + + if (VideoToolboxUtil.IsHardwareDecoderSupported(FourCC.Mpeg4, _logger)) + { + Decoders.AddOrUpdate(VideoFormat.Mpeg4, true, (_, _) => true); + } + if (VideoToolboxUtil.IsHardwareDecoderSupported(FourCC.Vp9, _logger)) { Decoders.AddOrUpdate(VideoFormat.Vp9, true, (_, _) => true); diff --git a/ErsatzTV.FFmpeg/Pipeline/VideoToolboxPipelineBuilder.cs b/ErsatzTV.FFmpeg/Pipeline/VideoToolboxPipelineBuilder.cs index 0222af9e4..0dbd0996d 100644 --- a/ErsatzTV.FFmpeg/Pipeline/VideoToolboxPipelineBuilder.cs +++ b/ErsatzTV.FFmpeg/Pipeline/VideoToolboxPipelineBuilder.cs @@ -5,6 +5,7 @@ using ErsatzTV.FFmpeg.Encoder.VideoToolbox; using ErsatzTV.FFmpeg.Filter; using ErsatzTV.FFmpeg.Format; using ErsatzTV.FFmpeg.GlobalOption.HardwareAcceleration; +using ErsatzTV.FFmpeg.OutputFormat; using ErsatzTV.FFmpeg.OutputOption; using Microsoft.Extensions.Logging; @@ -61,6 +62,12 @@ public class VideoToolboxPipelineBuilder : SoftwarePipelineBuilder desiredState.VideoProfile, desiredState.PixelFormat); + // use software encoding (rawvideo) when piping to parent hls segmenter + if (ffmpegState.OutputFormat is OutputFormatKind.Nut) + { + encodeCapability = FFmpegCapability.Software; + } + if (decodeCapability is FFmpegCapability.Hardware) { pipelineSteps.Add(new VideoToolboxHardwareAccelerationOption());