Merge pull request #5107 from jellyfin/enhanced-nvdec-vpp-tonemap

(cherry picked from commit bd8c269ea2)
Signed-off-by: Joshua M. Boniface <joshua@boniface.me>
pull/5296/head
Joshua M. Boniface 3 years ago
parent d816995d27
commit 19a01ccdf3

File diff suppressed because it is too large Load Diff

@ -50,6 +50,14 @@ namespace MediaBrowser.Controller.MediaEncoding
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
bool SupportsHwaccel(string hwaccel);
/// <summary>
/// Whether given filter is supported.
/// </summary>
/// <param name="filter">The filter.</param>
/// <param name="option">The option.</param>
/// <returns><c>true</c> if the filter is supported, <c>false</c> otherwise.</returns>
bool SupportsFilter(string filter, string option);
/// <summary>
/// Extracts the audio image.
/// </summary>

@ -296,6 +296,38 @@ namespace MediaBrowser.MediaEncoding.Encoder
return found;
}
public bool CheckFilter(string filter, string option)
{
if (string.IsNullOrEmpty(filter))
{
return false;
}
string output = null;
try
{
output = GetProcessOutput(_encoderPath, "-h filter=" + filter);
}
catch (Exception ex)
{
_logger.LogError(ex, "Error detecting the given filter");
}
if (output.Contains("Filter " + filter, StringComparison.Ordinal))
{
if (string.IsNullOrEmpty(option))
{
return true;
}
return output.Contains(option, StringComparison.Ordinal);
}
_logger.LogWarning("Filter: {Name} with option {Option} is not available", filter, option);
return false;
}
private IEnumerable<string> GetCodecs(Codec codec)
{
string codecstr = codec == Codec.Encoder ? "encoders" : "decoders";

@ -295,6 +295,17 @@ namespace MediaBrowser.MediaEncoding.Encoder
return _hwaccels.Contains(hwaccel, StringComparer.OrdinalIgnoreCase);
}
public bool SupportsFilter(string filter, string option)
{
if (_ffmpegPath != null)
{
var validator = new EncoderValidator(_logger, _ffmpegPath);
return validator.CheckFilter(filter, option);
}
return false;
}
public bool CanEncodeToAudioCodec(string codec)
{
if (string.Equals(codec, "opus", StringComparison.OrdinalIgnoreCase))

@ -39,6 +39,8 @@ namespace MediaBrowser.Model.Configuration
public bool EnableTonemapping { get; set; }
public bool EnableVppTonemapping { get; set; }
public string TonemappingAlgorithm { get; set; }
public string TonemappingRange { get; set; }
@ -65,6 +67,8 @@ namespace MediaBrowser.Model.Configuration
public bool EnableDecodingColorDepth10Vp9 { get; set; }
public bool EnableEnhancedNvdecDecoder { get; set; }
public bool EnableHardwareEncoding { get; set; }
public bool AllowHevcEncoding { get; set; }
@ -88,6 +92,7 @@ namespace MediaBrowser.Model.Configuration
// The left side of the dot is the platform number, and the right side is the device number on the platform.
OpenclDevice = "0.0";
EnableTonemapping = false;
EnableVppTonemapping = false;
TonemappingAlgorithm = "hable";
TonemappingRange = "auto";
TonemappingDesat = 0;
@ -100,6 +105,7 @@ namespace MediaBrowser.Model.Configuration
DeinterlaceMethod = "yadif";
EnableDecodingColorDepth10Hevc = true;
EnableDecodingColorDepth10Vp9 = true;
EnableEnhancedNvdecDecoder = true;
EnableHardwareEncoding = true;
AllowHevcEncoding = true;
EnableSubtitleExtraction = true;

Loading…
Cancel
Save