diff options
Diffstat (limited to 'MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs')
| -rw-r--r-- | MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs | 81 |
1 files changed, 57 insertions, 24 deletions
diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 8afee9f35..c73170fcf 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -179,6 +179,17 @@ namespace MediaBrowser.Controller.MediaEncoding { return null; } + // Seeing reported failures here, not sure yet if this is related to specfying input format + if (string.Equals(container, "m4v", StringComparison.OrdinalIgnoreCase)) + { + return null; + } + + // obviously don't do this for strm files + if (string.Equals(container, "strm", StringComparison.OrdinalIgnoreCase)) + { + return null; + } return container; } @@ -464,21 +475,6 @@ namespace MediaBrowser.Controller.MediaEncoding } /// <summary> - /// Gets the probe size argument. - /// </summary> - /// <param name="state">The state.</param> - /// <returns>System.String.</returns> - public string GetProbeSizeArgument(EncodingJobInfo state) - { - if (state.PlayableStreamFileNames.Count > 0) - { - return _mediaEncoder.GetProbeSizeAndAnalyzeDurationArgument(state.PlayableStreamFileNames.ToArray(), state.InputProtocol); - } - - return _mediaEncoder.GetProbeSizeAndAnalyzeDurationArgument(new[] { state.MediaPath }, state.InputProtocol); - } - - /// <summary> /// Gets the text subtitle param. /// </summary> /// <param name="state">The state.</param> @@ -741,12 +737,18 @@ namespace MediaBrowser.Controller.MediaEncoding if (videoStream.IsInterlaced) { - return false; + if (request.DeInterlace) + { + return false; + } } if (videoStream.IsAnamorphic ?? false) { - return false; + if (request.RequireNonAnamorphic) + { + return false; + } } // Can't stream copy if we're burning in subtitles @@ -1204,11 +1206,6 @@ namespace MediaBrowser.Controller.MediaEncoding } } - if (type == MediaStreamType.Video) - { - streams = streams.Where(i => !string.Equals(i.Codec, "mjpeg", StringComparison.OrdinalIgnoreCase)).ToList(); - } - if (returnFirstIfNoIndex && type == MediaStreamType.Audio) { return streams.FirstOrDefault(i => i.Channels.HasValue && i.Channels.Value > 0) ?? @@ -1456,12 +1453,43 @@ namespace MediaBrowser.Controller.MediaEncoding } } + public static string GetProbeSizeArgument(int numInputFiles) + { + return numInputFiles > 1 ? "-probesize 1G" : ""; + } + + public static string GetAnalyzeDurationArgument(int numInputFiles) + { + return numInputFiles > 1 ? "-analyzeduration 200M" : ""; + } + public string GetInputModifier(EncodingJobInfo state, EncodingOptions encodingOptions) { var inputModifier = string.Empty; - var probeSize = GetProbeSizeArgument(state); - inputModifier += " " + probeSize; + var numInputFiles = state.PlayableStreamFileNames.Count > 0 ? state.PlayableStreamFileNames.Count : 1; + var probeSizeArgument = GetProbeSizeArgument(numInputFiles); + + string analyzeDurationArgument; + if (state.MediaSource.AnalyzeDurationMs.HasValue) + { + analyzeDurationArgument = "-analyzeduration " + (state.MediaSource.AnalyzeDurationMs.Value * 1000).ToString(CultureInfo.InvariantCulture); + } + else + { + analyzeDurationArgument = GetAnalyzeDurationArgument(numInputFiles); + } + + if (!string.IsNullOrWhiteSpace(probeSizeArgument)) + { + inputModifier += " " + probeSizeArgument; + } + + if (!string.IsNullOrWhiteSpace(analyzeDurationArgument)) + { + inputModifier += " " + analyzeDurationArgument; + } + inputModifier = inputModifier.Trim(); var userAgentParam = GetUserAgentParam(state); @@ -1658,6 +1686,11 @@ namespace MediaBrowser.Controller.MediaEncoding case "h264": if (_mediaEncoder.SupportsDecoder("h264_qsv")) { + // qsv decoder does not support 10-bit input + if ((state.VideoStream.BitDepth ?? 8) > 8) + { + return null; + } return "-c:v h264_qsv "; } break; |
