mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
Merge pull request #1369 from teacupx/master
Enable Exynos MFC encoder and fix transcoding bitrate control
This commit is contained in:
commit
dbc2cda9d4
@ -1083,14 +1083,22 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
{
|
{
|
||||||
var bitrate = request.VideoBitRate;
|
var bitrate = request.VideoBitRate;
|
||||||
|
|
||||||
// If specific values were requested, then force the caller to supply a bitrate as well
|
|
||||||
if (request.Height.HasValue && request.Width.HasValue)
|
|
||||||
{
|
|
||||||
return bitrate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (videoStream != null)
|
if (videoStream != null)
|
||||||
{
|
{
|
||||||
|
var isUpscaling = request.Height.HasValue && videoStream.Height.HasValue &&
|
||||||
|
request.Height.Value > videoStream.Height.Value && request.Width.HasValue && videoStream.Width.HasValue &&
|
||||||
|
request.Width.Value > videoStream.Width.Value;
|
||||||
|
|
||||||
|
// Don't allow bitrate increases unless upscaling
|
||||||
|
if (!isUpscaling)
|
||||||
|
{
|
||||||
|
if (bitrate.HasValue && videoStream.BitRate.HasValue)
|
||||||
|
{
|
||||||
|
bitrate = GetMinBitrate(videoStream.BitRate.Value, bitrate.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (bitrate.HasValue)
|
if (bitrate.HasValue)
|
||||||
{
|
{
|
||||||
var inputVideoCodec = videoStream.Codec;
|
var inputVideoCodec = videoStream.Codec;
|
||||||
@ -1102,8 +1110,24 @@ namespace MediaBrowser.Controller.MediaEncoding
|
|||||||
bitrate = Math.Min(bitrate.Value, request.VideoBitRate.Value);
|
bitrate = Math.Min(bitrate.Value, request.VideoBitRate.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return bitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int GetMinBitrate(int sourceBitrate, int requestedBitrate)
|
||||||
|
{
|
||||||
|
// these values were chosen from testing to improve low bitrate streams
|
||||||
|
if (sourceBitrate <= 2000000)
|
||||||
|
{
|
||||||
|
sourceBitrate = Convert.ToInt32(sourceBitrate * 2.5);
|
||||||
|
}
|
||||||
|
else if (sourceBitrate <= 3000000)
|
||||||
|
{
|
||||||
|
sourceBitrate = Convert.ToInt32(sourceBitrate * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
var bitrate = Math.Min(sourceBitrate, requestedBitrate);
|
||||||
|
|
||||||
return bitrate;
|
return bitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,6 +207,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|||||||
"hevc_omx",
|
"hevc_omx",
|
||||||
"h264_vaapi",
|
"h264_vaapi",
|
||||||
"hevc_vaapi",
|
"hevc_vaapi",
|
||||||
|
"h264_v4l2m2m",
|
||||||
"ac3"
|
"ac3"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user