From eddbf07b11504f8cf51bbf441d8f4309a84691aa Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Mon, 27 Feb 2023 05:57:13 -0600 Subject: [PATCH] vaapi: decode vp9 and av1 (#1181) --- CHANGELOG.md | 3 +++ .../Capabilities/Vaapi/VaapiProfile.cs | 5 +++++ .../Capabilities/VaapiHardwareCapabilities.cs | 20 +++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fda5403f8..8fb2b3d6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Added +- Use VP9 and AV1 hardware-accelerated decoders with VAAPI when available + ### Fixed - Align default docker image (no acceleration) with new images from [ErsatzTV-ffmpeg](https://github.com/jasongdove/ErsatzTV-ffmpeg) - Fix some transcoding pipelines that use software decoders diff --git a/ErsatzTV.FFmpeg/Capabilities/Vaapi/VaapiProfile.cs b/ErsatzTV.FFmpeg/Capabilities/Vaapi/VaapiProfile.cs index 17fb85a25..411dc0136 100644 --- a/ErsatzTV.FFmpeg/Capabilities/Vaapi/VaapiProfile.cs +++ b/ErsatzTV.FFmpeg/Capabilities/Vaapi/VaapiProfile.cs @@ -14,4 +14,9 @@ public class VaapiProfile public const string Vc1Advanced = "VAProfileVC1Advanced"; public const string HevcMain = "VAProfileHEVCMain"; public const string HevcMain10 = "VAProfileHEVCMain10"; + public const string Vp9Profile0 = "VAProfileVP9Profile0"; + public const string Vp9Profile1 = "VAProfileVP9Profile1"; + public const string Vp9Profile2 = "VAProfileVP9Profile2"; + public const string Vp9Profile3 = "VAProfileVP9Profile3"; + public const string Av1Profile0 = "VAProfileAV1Profile0"; } diff --git a/ErsatzTV.FFmpeg/Capabilities/VaapiHardwareCapabilities.cs b/ErsatzTV.FFmpeg/Capabilities/VaapiHardwareCapabilities.cs index 146d2a0a6..796b3fd14 100644 --- a/ErsatzTV.FFmpeg/Capabilities/VaapiHardwareCapabilities.cs +++ b/ErsatzTV.FFmpeg/Capabilities/VaapiHardwareCapabilities.cs @@ -70,6 +70,26 @@ public class VaapiHardwareCapabilities : IHardwareCapabilities (VideoFormat.Hevc, "main 10" or "2") => _profileEntrypoints.Contains( new VaapiProfileEntrypoint(VaapiProfile.HevcMain10, VaapiEntrypoint.Decode)), + + (VideoFormat.Vp9, "profile 0" or "0") => + _profileEntrypoints.Contains( + new VaapiProfileEntrypoint(VaapiProfile.Vp9Profile0, VaapiEntrypoint.Decode)), + + (VideoFormat.Vp9, "profile 1" or "1") => + _profileEntrypoints.Contains( + new VaapiProfileEntrypoint(VaapiProfile.Vp9Profile1, VaapiEntrypoint.Decode)), + + (VideoFormat.Vp9, "profile 2" or "2") => + _profileEntrypoints.Contains( + new VaapiProfileEntrypoint(VaapiProfile.Vp9Profile2, VaapiEntrypoint.Decode)), + + (VideoFormat.Vp9, "profile 3" or "3") => + _profileEntrypoints.Contains( + new VaapiProfileEntrypoint(VaapiProfile.Vp9Profile3, VaapiEntrypoint.Decode)), + + (VideoFormat.Av1, "main" or "0") => + _profileEntrypoints.Contains( + new VaapiProfileEntrypoint(VaapiProfile.Av1Profile0, VaapiEntrypoint.Decode)), // fall back to software decoder _ => false