diff options
Diffstat (limited to 'Jellyfin.Api/Helpers/StreamingHelpers.cs')
| -rw-r--r-- | Jellyfin.Api/Helpers/StreamingHelpers.cs | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/Jellyfin.Api/Helpers/StreamingHelpers.cs b/Jellyfin.Api/Helpers/StreamingHelpers.cs index 535ef27c3..3a5db2f3f 100644 --- a/Jellyfin.Api/Helpers/StreamingHelpers.cs +++ b/Jellyfin.Api/Helpers/StreamingHelpers.cs @@ -142,28 +142,15 @@ public static class StreamingHelpers } else { - // Enforce more restrictive transcoding profile for LiveTV due to compatability reasons - // Cap the MaxStreamingBitrate to 30Mbps, because we are unable to reliably probe source bitrate, - // which will cause the client to request extremely high bitrate that may fail the player/encoder - streamingRequest.VideoBitRate = streamingRequest.VideoBitRate > 30000000 ? 30000000 : streamingRequest.VideoBitRate; - - if (streamingRequest.SegmentContainer is not null) - { - // Remove all fmp4 transcoding profiles, because it causes playback error and/or A/V sync issues - // Notably: Some channels won't play on FireFox and LG webOS - // Some channels from HDHomerun will experience A/V sync issues - streamingRequest.SegmentContainer = "ts"; - streamingRequest.VideoCodec = "h264"; - streamingRequest.AudioCodec = "aac"; - state.SupportedVideoCodecs = ["h264"]; - state.Request.VideoCodec = "h264"; - state.SupportedAudioCodecs = ["aac"]; - state.Request.AudioCodec = "aac"; - } - var liveStreamInfo = await mediaSourceManager.GetLiveStreamWithDirectStreamProvider(streamingRequest.LiveStreamId, cancellationToken).ConfigureAwait(false); mediaSource = liveStreamInfo.Item1; state.DirectStreamProvider = liveStreamInfo.Item2; + + // Cap the max bitrate when it is too high. This is usually due to ffmpeg is unable to probe the source liveTV streams' bitrate. + if (mediaSource.FallbackMaxStreamingBitrate is not null && streamingRequest.VideoBitRate is not null) + { + streamingRequest.VideoBitRate = Math.Min(streamingRequest.VideoBitRate.Value, mediaSource.FallbackMaxStreamingBitrate.Value); + } } var encodingOptions = serverConfigurationManager.GetEncodingOptions(); @@ -232,11 +219,17 @@ public static class StreamingHelpers } else { + var h264EquivalentBitrate = EncodingHelper.ScaleBitrate( + state.OutputVideoBitrate.Value, + state.ActualOutputVideoCodec, + "h264"); var resolution = ResolutionNormalizer.Normalize( state.VideoStream?.BitRate, state.OutputVideoBitrate.Value, + h264EquivalentBitrate, state.VideoRequest.MaxWidth, - state.VideoRequest.MaxHeight); + state.VideoRequest.MaxHeight, + state.TargetFramerate); state.VideoRequest.MaxWidth = resolution.MaxWidth; state.VideoRequest.MaxHeight = resolution.MaxHeight; |
