Browse Source

fix segmenter v2 with videotoolbox accel (#2361)

* fix segmenter v2 with videotoolbox

* more capabilities checks
pull/2362/head
Jason Dove 11 months ago committed by GitHub
parent
commit
272f528f7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 8
      ErsatzTV.FFmpeg/Capabilities/FourCC.cs
  3. 15
      ErsatzTV.FFmpeg/Capabilities/VideoToolboxHardwareCapabilities.cs
  4. 7
      ErsatzTV.FFmpeg/Pipeline/VideoToolboxPipelineBuilder.cs

1
CHANGELOG.md

@ -90,6 +90,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -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

8
ErsatzTV.FFmpeg/Capabilities/FourCC.cs

@ -2,14 +2,20 @@ namespace ErsatzTV.FFmpeg.Capabilities; @@ -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<string> AllVideoToolbox =
[
Av1,
H264,
Hevc,
Mpeg2Video,
Mpeg4,
Vp9
];
}

15
ErsatzTV.FFmpeg/Capabilities/VideoToolboxHardwareCapabilities.cs

@ -28,6 +28,11 @@ public class VideoToolboxHardwareCapabilities : IHardwareCapabilities @@ -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 @@ -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);

7
ErsatzTV.FFmpeg/Pipeline/VideoToolboxPipelineBuilder.cs

@ -5,6 +5,7 @@ using ErsatzTV.FFmpeg.Encoder.VideoToolbox; @@ -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 @@ -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());

Loading…
Cancel
Save