Compare commits

...

5 Commits

Author SHA1 Message Date
knackebrot 9d59a650f8
Merge 1b65c01928 into 5612cb8178 2024-04-25 09:15:44 -04:00
renovate[bot] 5612cb8178
chore(deps): update ci dependencies (#11427)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-25 07:15:31 -06:00
renovate[bot] ccd06bc547
chore(deps): update dependency diacritics to v3.3.29 (#11429)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-25 07:02:45 -06:00
Bond-009 d29b85a134
Fix multiple intro providers and remove unneeded ToLists (#11431) 2024-04-25 07:02:01 -06:00
knackebrot 1b65c01928 Add advanced options for Intel QSV encoders 2023-04-04 19:30:18 +02:00
12 changed files with 178 additions and 25 deletions

View File

@ -20,7 +20,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Setup .NET
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
with:

View File

@ -14,7 +14,7 @@ jobs:
permissions: read-all
steps:
- name: Checkout repository
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
@ -39,7 +39,7 @@ jobs:
permissions: read-all
steps:
- name: Checkout repository
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
@ -78,12 +78,12 @@ jobs:
- openapi-base
steps:
- name: Download openapi-head
uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: openapi-head
path: openapi-head
- name: Download openapi-base
uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: openapi-base
path: openapi-base
@ -152,7 +152,7 @@ jobs:
run: |-
echo "JELLYFIN_VERSION=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Download openapi-head
uses: actions/download-artifact@9c19ed7fe5d278cd354c7dfd5d3b88589c7e2395 # v4.1.6
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: openapi-head
path: openapi-head

View File

@ -19,7 +19,7 @@ jobs:
runs-on: "${{ matrix.os }}"
steps:
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
with:

View File

@ -24,7 +24,7 @@ jobs:
reactions: '+1'
- name: Checkout the latest code
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
token: ${{ secrets.JF_BOT_TOKEN }}
fetch-depth: 0
@ -51,7 +51,7 @@ jobs:
reactions: eyes
- name: Checkout the latest code
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
token: ${{ secrets.JF_BOT_TOKEN }}
fetch-depth: 0
@ -128,7 +128,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: pull in script
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
repository: jellyfin/jellyfin-triage-script
- name: install python

View File

@ -10,7 +10,7 @@ jobs:
issues: write
steps:
- name: pull in script
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
repository: jellyfin/jellyfin-triage-script
- name: install python

View File

@ -33,7 +33,7 @@ jobs:
yq-version: v4.9.8
- name: Checkout Repository
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
ref: ${{ env.TAG_BRANCH }}
@ -66,7 +66,7 @@ jobs:
NEXT_VERSION: ${{ github.event.inputs.NEXT_VERSION }}
steps:
- name: Checkout Repository
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
ref: ${{ env.TAG_BRANCH }}

View File

@ -13,7 +13,7 @@
<PackageVersion Include="BlurHashSharp" Version="1.3.2" />
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="Diacritics" Version="3.3.27" />
<PackageVersion Include="Diacritics" Version="3.3.29" />
<PackageVersion Include="DiscUtils.Udf" Version="0.16.13" />
<PackageVersion Include="DotNet.Glob" Version="3.1.3" />
<PackageVersion Include="EFCoreSecondLevelCacheInterceptor" Version="4.4.3" />

View File

@ -44,7 +44,6 @@ using MediaBrowser.Model.Library;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Logging;
using TMDbLib.Objects.Authentication;
using Episode = MediaBrowser.Controller.Entities.TV.Episode;
using EpisodeInfo = Emby.Naming.TV.EpisodeInfo;
using Genre = MediaBrowser.Controller.Entities.Genre;
@ -1612,14 +1611,18 @@ namespace Emby.Server.Implementations.Library
/// <returns>IEnumerable{System.String}.</returns>
public async Task<IEnumerable<Video>> GetIntros(BaseItem item, User user)
{
if (IntroProviders.Length == 0)
{
return [];
}
var tasks = IntroProviders
.Take(1)
.Select(i => GetIntros(i, item, user));
var items = await Task.WhenAll(tasks).ConfigureAwait(false);
return items
.SelectMany(i => i.ToArray())
.SelectMany(i => i)
.Select(ResolveIntro)
.Where(i => i is not null)!; // null values got filtered out
}

View File

@ -274,7 +274,7 @@ namespace Emby.Server.Implementations.Library
var tasks = _providers.Select(i => GetDynamicMediaSources(item, i, cancellationToken));
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
return results.SelectMany(i => i.ToList());
return results.SelectMany(i => i);
}
private async Task<IEnumerable<MediaSourceInfo>> GetDynamicMediaSources(BaseItem item, IMediaSourceProvider provider, CancellationToken cancellationToken)

View File

@ -1053,6 +1053,16 @@ namespace MediaBrowser.Controller.MediaEncoding
}
args.Append(GetQsvDeviceArgs(QsvAlias));
if (string.Equals(vidEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) && options.EnableIntelLookAheadH264)
{
args.Append(" -extra_hw_frames=" + options.IntelLookAheadDepthH264);
}
else if (string.Equals(vidEncoder, "hevc_qsv", StringComparison.OrdinalIgnoreCase) && options.EnableIntelLookAheadHevc)
{
args.Append(" -extra_hw_frames=" + options.IntelLookAheadDepthHevc);
}
var filterDevArgs = GetFilterHwDeviceArgs(QsvAlias);
// child device used by qsv.
if (_mediaEncoder.SupportsHwaccel("vaapi") || _mediaEncoder.SupportsHwaccel("d3d11va"))
@ -1799,7 +1809,61 @@ namespace MediaBrowser.Controller.MediaEncoding
// Only h264_qsv has look_ahead option
if (string.Equals(videoEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase))
{
param += " -look_ahead 0";
if (encodingOptions.EnableIntelLookAheadH264)
{
param += $" -look_ahead 1 -look_ahead_depth {encodingOptions.IntelLookAheadDepthH264}";
}
else
{
param += " -look_ahead 0";
}
if (encodingOptions.EnableIntelExtBrcH264)
{
param += " -extbrc 1";
}
if (encodingOptions.EnableIntelBPyramidH264)
{
param += " -b_strategy 1";
}
if (encodingOptions.EnableIntelAdaptiveIBFramesH264)
{
param += " -adaptive_i 1 -adaptive_b 1";
}
if (encodingOptions.EnableIntelTrellisH264)
{
param += " -trellis 1";
}
}
else if (string.Equals(videoEncoder, "hevc_qsv", StringComparison.OrdinalIgnoreCase))
{
if (encodingOptions.EnableIntelLookAheadHevc)
{
param += $" -look_ahead_depth {encodingOptions.IntelLookAheadDepthHevc}";
}
if (encodingOptions.EnableIntelExtBrcHevc)
{
param += " -extbrc 1";
}
if (encodingOptions.EnableIntelBPyramidHevc)
{
param += " -b_strategy 1";
}
if (encodingOptions.EnableIntelAdaptiveIBFramesHevc)
{
param += " -adaptive_i 1 -adaptive_b 1";
}
if (encodingOptions.EnableIntelTrellisHevc)
{
param += " -trellis 1";
}
}
}
else if (string.Equals(videoEncoder, "h264_nvenc", StringComparison.OrdinalIgnoreCase) // h264 (h264_nvenc)
@ -4164,7 +4228,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// qsv requires a fixed pool size.
// default to 64 otherwise it will fail on certain iGPU.
subFilters.Add("hwupload=derive_device=qsv:extra_hw_frames=64");
subFilters.Add($"hwupload=derive_device=qsv:extra_hw_frames={GetIntelExtraHwFrames(vidEncoder, options, 64)}");
var (overlayW, overlayH) = GetFixedOutputSize(inW, inH, reqW, reqH, reqMaxW, reqMaxH);
var overlaySize = (overlayW.HasValue && overlayH.HasValue)
@ -4271,7 +4335,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// allocate extra pool sizes for vaapi vpp
if (!string.IsNullOrEmpty(hwScaleFilter) && isVaapiDecoder)
{
hwScaleFilter += ":extra_hw_frames=24";
hwScaleFilter += $":extra_hw_frames={GetIntelExtraHwFrames(vidEncoder, options, 24)}";
}
// hw scale
@ -4347,7 +4411,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// OUTPUT qsv(nv12) surface(vram)
// reverse-mapping via qsv(vaapi)-opencl interop.
// add extra pool size to avoid the 'cannot allocate memory' error on hevc_qsv.
mainFilters.Add("hwmap=derive_device=qsv:reverse=1:extra_hw_frames=16");
mainFilters.Add($"hwmap=derive_device=qsv:reverse=1:extra_hw_frames={GetIntelExtraHwFrames(vidEncoder, options, 16)}");
mainFilters.Add("format=qsv");
}
else if (isVaapiDecoder)
@ -4385,7 +4449,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// qsv requires a fixed pool size.
// default to 64 otherwise it will fail on certain iGPU.
subFilters.Add("hwupload=derive_device=qsv:extra_hw_frames=64");
subFilters.Add($"hwupload=derive_device=qsv:extra_hw_frames={GetIntelExtraHwFrames(vidEncoder, options, 64)}");
var (overlayW, overlayH) = GetFixedOutputSize(inW, inH, reqW, reqH, reqMaxW, reqMaxH);
var overlaySize = (overlayW.HasValue && overlayH.HasValue)
@ -4557,7 +4621,7 @@ namespace MediaBrowser.Controller.MediaEncoding
// allocate extra pool sizes for vaapi vpp
if (!string.IsNullOrEmpty(hwScaleFilter))
{
hwScaleFilter += ":extra_hw_frames=24";
hwScaleFilter += $":extra_hw_frames={GetIntelExtraHwFrames(vidEncoder, options, 24)}";
}
// hw scale
@ -7052,5 +7116,19 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase);
}
public int GetIntelExtraHwFrames(string vidEncoder, EncodingOptions options, int initialExtraHwFrames)
{
if (string.Equals(vidEncoder, "h264_qsv", StringComparison.OrdinalIgnoreCase) && options.EnableIntelLookAheadH264)
{
initialExtraHwFrames += options.IntelLookAheadDepthH264;
}
else if (string.Equals(vidEncoder, "hevc_qsv", StringComparison.OrdinalIgnoreCase) && options.EnableIntelLookAheadHevc)
{
initialExtraHwFrames += options.IntelLookAheadDepthHevc;
}
return initialExtraHwFrames;
}
}
}

View File

@ -47,7 +47,19 @@ public class EncodingOptions
EnableEnhancedNvdecDecoder = true;
PreferSystemNativeHwDecoder = true;
EnableIntelLowPowerH264HwEncoder = false;
EnableIntelLookAheadH264 = false;
IntelLookAheadDepthH264 = 60;
EnableIntelExtBrcH264 = false;
EnableIntelBPyramidH264 = false;
EnableIntelAdaptiveIBFramesH264 = false;
EnableIntelTrellisH264 = false;
EnableIntelLowPowerHevcHwEncoder = false;
EnableIntelLookAheadHevc = false;
IntelLookAheadDepthHevc = 60;
EnableIntelExtBrcHevc = false;
EnableIntelBPyramidHevc = false;
EnableIntelAdaptiveIBFramesHevc = false;
EnableIntelTrellisHevc = false;
EnableHardwareEncoding = true;
AllowHevcEncoding = false;
AllowAv1Encoding = false;
@ -241,11 +253,71 @@ public class EncodingOptions
/// </summary>
public bool EnableIntelLowPowerH264HwEncoder { get; set; }
/// <summary>
/// Gets or sets a value indicating whether LookAhead should be used for Intel H264 encoder.
/// </summary>
public bool EnableIntelLookAheadH264 { get; set; }
/// <summary>
/// Gets or sets a value indicating the number of frames that should be used for LookAhead with Intel H264 encoder.
/// </summary>
public int IntelLookAheadDepthH264 { get; set; }
/// <summary>
/// Gets or sets a value indicating whether ExtBrc should be used for Intel H264 encoder.
/// </summary>
public bool EnableIntelExtBrcH264 { get; set; }
/// <summary>
/// Gets or sets a value indicating whether B-Pyramid should be used for Intel H264 encoder.
/// </summary>
public bool EnableIntelBPyramidH264 { get; set; }
/// <summary>
/// Gets or sets a value indicating whether Adaptive I/B frames should be used for Intel H264 encoder.
/// </summary>
public bool EnableIntelAdaptiveIBFramesH264 { get; set; }
/// <summary>
/// Gets or sets a value indicating whether Trellis quantization should be used for Intel H264 encoder.
/// </summary>
public bool EnableIntelTrellisH264 { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the Intel HEVC low-power hardware encoder should be used.
/// </summary>
public bool EnableIntelLowPowerHevcHwEncoder { get; set; }
/// <summary>
/// Gets or sets a value indicating whether LookAhead should be used for Intel HEVC encoder.
/// </summary>
public bool EnableIntelLookAheadHevc { get; set; }
/// <summary>
/// Gets or sets a value indicating the number of frames that should be used for LookAhead with Intel HEVC encoder.
/// </summary>
public int IntelLookAheadDepthHevc { get; set; }
/// <summary>
/// Gets or sets a value indicating whether ExtBrc should be used for Intel HEVC encoder.
/// </summary>
public bool EnableIntelExtBrcHevc { get; set; }
/// <summary>
/// Gets or sets a value indicating whether B-Pyramid should be used for Intel HEVC encoder.
/// </summary>
public bool EnableIntelBPyramidHevc { get; set; }
/// <summary>
/// Gets or sets a value indicating whether Adaptive I/B frames should be used for Intel HEVC encoder.
/// </summary>
public bool EnableIntelAdaptiveIBFramesHevc { get; set; }
/// <summary>
/// Gets or sets a value indicating whether Trellis quantization should be used for Intel HEVC encoder.
/// </summary>
public bool EnableIntelTrellisHevc { get; set; }
/// <summary>
/// Gets or sets a value indicating whether hardware encoding is enabled.
/// </summary>

View File

@ -286,7 +286,7 @@ namespace MediaBrowser.Providers.Manager
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
return results.SelectMany(i => i.ToList());
return results.SelectMany(i => i);
}
/// <summary>