mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-28 19:54:48 +03:00
Better bitrate and resolution normalization (#12644)
This commit is contained in:
@@ -2400,7 +2400,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int ScaleBitrate(int bitrate, string inputVideoCodec, string outputVideoCodec)
|
||||
public static int ScaleBitrate(int bitrate, string inputVideoCodec, string outputVideoCodec)
|
||||
{
|
||||
var inputScaleFactor = GetVideoBitrateScaleFactor(inputVideoCodec);
|
||||
var outputScaleFactor = GetVideoBitrateScaleFactor(outputVideoCodec);
|
||||
@@ -2424,6 +2424,12 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||
{
|
||||
scaleFactor = Math.Max(scaleFactor, 2);
|
||||
}
|
||||
else if (bitrate >= 30000000)
|
||||
{
|
||||
// Don't scale beyond 30Mbps, it is hardly visually noticeable for most codecs with our prefer speed encoding
|
||||
// and will cause extremely high bitrate to be used for av1->h264 transcoding that will overload clients and encoders
|
||||
scaleFactor = 1;
|
||||
}
|
||||
|
||||
return Convert.ToInt32(scaleFactor * bitrate);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user