mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-17 14:33:06 +03:00
adjust bitrate in h264/h265 conversions
This commit is contained in:
@@ -99,7 +99,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
if (videoRequest != null)
|
||||
{
|
||||
state.OutputVideoCodec = state.Options.VideoCodec;
|
||||
state.OutputVideoBitrate = GetVideoBitrateParamValue(state.Options, state.VideoStream);
|
||||
state.OutputVideoBitrate = GetVideoBitrateParamValue(state.Options, state.VideoStream, state.OutputVideoCodec);
|
||||
|
||||
if (state.OutputVideoBitrate.HasValue)
|
||||
{
|
||||
@@ -396,7 +396,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
return request.AudioChannels;
|
||||
}
|
||||
|
||||
private int? GetVideoBitrateParamValue(EncodingJobOptions request, MediaStream videoStream)
|
||||
private int? GetVideoBitrateParamValue(EncodingJobOptions request, MediaStream videoStream, string outputVideoCodec)
|
||||
{
|
||||
var bitrate = request.VideoBitRate;
|
||||
|
||||
@@ -421,6 +421,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
}
|
||||
}
|
||||
|
||||
if (bitrate.HasValue)
|
||||
{
|
||||
var inputVideoCodec = videoStream == null ? null : videoStream.Codec;
|
||||
bitrate = ResolutionNormalizer.ScaleBitrate(bitrate.Value, inputVideoCodec, outputVideoCodec);
|
||||
}
|
||||
|
||||
return bitrate;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user