mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-06 02:06:21 +00:00
Merge branch 'master' into images
This commit is contained in:
@@ -475,7 +475,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
.Append(' ');
|
||||
}
|
||||
|
||||
if (state.IsVideoRequest
|
||||
if (state.IsVideoRequest
|
||||
&& string.Equals(encodingOptions.HardwareAccelerationType, "qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, encodingOptions);
|
||||
@@ -486,11 +486,11 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
if (!string.IsNullOrEmpty(videoDecoder) && videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
arg.Append("-hwaccel qsv ");
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
arg.Append("-init_hw_device qsv=hw -filter_hw_device hw ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
arg.Append(videoDecoder + " ");
|
||||
@@ -653,7 +653,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
// _fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(fallbackFontPath));
|
||||
// using (var stream = _assemblyInfo.GetManifestResourceStream(GetType(), GetType().Namespace + ".DroidSansFallback.ttf"))
|
||||
// {
|
||||
// using (var fileStream = _fileSystem.GetFileStream(fallbackFontPath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read))
|
||||
// using (var fileStream = new FileStream(fallbackFontPath, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||
// {
|
||||
// stream.CopyTo(fileStream);
|
||||
// }
|
||||
@@ -1624,22 +1624,22 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
// Setup default filtergraph utilizing FFMpeg overlay() and FFMpeg scale() (see the return of this function for index reference)
|
||||
var retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}][sub]overlay{3}\"";
|
||||
|
||||
if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
||||
if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
/*
|
||||
QSV in FFMpeg can now setup hardware overlay for transcodes.
|
||||
For software decoding and hardware encoding option, frames must be hwuploaded into hardware
|
||||
with fixed frame size.
|
||||
with fixed frame size.
|
||||
*/
|
||||
if (!string.IsNullOrEmpty(videoDecoder) && videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}][sub]overlay_qsv=x=(W-w)/2:y=(H-h)/2{3}\"";
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}]hwupload=extra_hw_frames=64[v];[v][sub]overlay_qsv=x=(W-w)/2:y=(H-h)/2{3}\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
@@ -1731,8 +1731,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
vaapi_or_qsv,
|
||||
outputWidth,
|
||||
outputHeight));
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
filters.Add(string.Format(CultureInfo.InvariantCulture, "scale_{0}=format=nv12", vaapi_or_qsv));
|
||||
}
|
||||
@@ -1979,8 +1979,8 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
var videoDecoder = GetHardwareAcceleratedVideoDecoder(state, options);
|
||||
|
||||
// If we are software decoding, and hardware encoding
|
||||
if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase)
|
||||
// If we are software decoding, and hardware encoding
|
||||
if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase)
|
||||
&& (string.IsNullOrEmpty(videoDecoder) || !videoDecoder.Contains("qsv", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
filters.Add("format=nv12|qsv");
|
||||
|
||||
@@ -657,7 +657,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
}
|
||||
|
||||
public IProgress<double> Progress { get; set; }
|
||||
public virtual void ReportTranscodingProgress(TimeSpan? transcodingPosition, float framerate, double? percentComplete, long bytesTranscoded, int? bitRate)
|
||||
public virtual void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate)
|
||||
{
|
||||
Progress.Report(percentComplete.Value);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Services;
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MediaBrowser.Controller.MediaEncoding
|
||||
@@ -90,6 +89,15 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
framerate = val;
|
||||
}
|
||||
}
|
||||
else if (part.StartsWith("fps=", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var rate = part.Split(new[] { '=' }, 2)[^1];
|
||||
|
||||
if (float.TryParse(rate, NumberStyles.Any, _usCulture, out var val))
|
||||
{
|
||||
framerate = val;
|
||||
}
|
||||
}
|
||||
else if (state.RunTimeTicks.HasValue &&
|
||||
part.StartsWith("time=", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@@ -146,7 +154,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
|
||||
if (framerate.HasValue || percent.HasValue)
|
||||
{
|
||||
state.ReportTranscodingProgress(transcodingPosition, 0, percent, 0, bitRate);
|
||||
state.ReportTranscodingProgress(transcodingPosition, framerate, percent, bytesTranscoded, bitRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user