diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index 01d959d70..e6ac990bc 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -292,9 +292,9 @@ namespace MediaBrowser.Api.Playback return "h264_qsv"; } - if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "libnvenc", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase)) { - return "libnvenc"; + return "h264_nvenc"; } if (string.Equals(ApiEntryPoint.Instance.GetEncodingOptions().HardwareAccelerationType, "h264_omx", StringComparison.OrdinalIgnoreCase)) { @@ -338,8 +338,8 @@ namespace MediaBrowser.Api.Playback } - // h264 (libnvenc) - else if (string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase)) + // h264 (h264_nvenc) + else if (string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase)) { param = "-preset high-performance"; } @@ -412,9 +412,9 @@ namespace MediaBrowser.Api.Playback if (!string.IsNullOrEmpty(state.VideoRequest.Level)) { - // h264_qsv and libnvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format + // h264_qsv and h264_nvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format if (string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) || - string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase)) + string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase)) { switch (state.VideoRequest.Level) { @@ -458,7 +458,7 @@ namespace MediaBrowser.Api.Playback if (!string.Equals(videoCodec, "h264_omx", StringComparison.OrdinalIgnoreCase) && !string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) && - !string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase)) + !string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase)) { param = "-pix_fmt yuv420p " + param; } @@ -1645,9 +1645,10 @@ namespace MediaBrowser.Api.Playback var state = new StreamState(MediaSourceManager, Logger) { Request = request, - RequestedUrl = url + RequestedUrl = url, + UserAgent = Request.UserAgent }; - + //if ((Request.UserAgent ?? string.Empty).IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 || // (Request.UserAgent ?? string.Empty).IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1 || // (Request.UserAgent ?? string.Empty).IndexOf("ipod", StringComparison.OrdinalIgnoreCase) != -1) diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs index fbcccbaca..d0d0337c2 100644 --- a/MediaBrowser.Api/Playback/StreamState.cs +++ b/MediaBrowser.Api/Playback/StreamState.cs @@ -75,7 +75,13 @@ namespace MediaBrowser.Api.Playback { if (string.Equals(OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase)) { - return 10; + var userAgent = UserAgent ?? string.Empty; + if (userAgent.IndexOf("AppleTV", StringComparison.OrdinalIgnoreCase) != -1) + { + return 10; + } + + return 6; } return 3; @@ -99,6 +105,7 @@ namespace MediaBrowser.Api.Playback public string OutputVideoSync = "-1"; public List SupportedAudioCodecs { get; set; } + public string UserAgent { get; set; } public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger) { diff --git a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs index 77bd50b9b..9eb796360 100644 --- a/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/BaseEncoder.cs @@ -607,10 +607,10 @@ namespace MediaBrowser.MediaEncoding.Encoder } - // h264 (libnvenc) - else if (string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase)) + // h264 (h264_nvenc) + else if (string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase)) { - param = "-preset high-performance"; + param = "-preset llhq"; } // webm @@ -683,9 +683,9 @@ namespace MediaBrowser.MediaEncoding.Encoder if (!string.IsNullOrEmpty(levelString)) { - // h264_qsv and libnvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format + // h264_qsv and h264_nvenc expect levels to be expressed as a decimal. libx264 supports decimal and non-decimal format if (string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) || - string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase)) + string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase)) { switch (levelString) { @@ -729,7 +729,7 @@ namespace MediaBrowser.MediaEncoding.Encoder if (!string.Equals(videoCodec, "h264_omx", StringComparison.OrdinalIgnoreCase) && !string.Equals(videoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase) && - !string.Equals(videoCodec, "libnvenc", StringComparison.OrdinalIgnoreCase)) + !string.Equals(videoCodec, "h264_nvenc", StringComparison.OrdinalIgnoreCase)) { param = "-pix_fmt yuv420p " + param; } diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 133cc8d70..e2348e8df 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -85,7 +85,7 @@ namespace MediaBrowser.MediaEncoding.Encoder "libopus", //"libvorbis", "srt", - "libnvenc", + "h264_nvenc", "h264_qsv" }; diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs index 177009306..7c4b7fc2f 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingJobFactory.cs @@ -562,9 +562,9 @@ namespace MediaBrowser.MediaEncoding.Encoder return "h264_qsv"; } - if (string.Equals(options.HardwareAccelerationType, "libnvenc", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(options.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase)) { - return "libnvenc"; + return "h264_nvenc"; } if (string.Equals(options.HardwareAccelerationType, "h264_omx", StringComparison.OrdinalIgnoreCase)) {