mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-17 14:33:06 +03:00
update video audio encoding
This commit is contained in:
@@ -370,30 +370,50 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
inputChannels = null;
|
||||
}
|
||||
|
||||
int? transcoderChannelLimit = null;
|
||||
var codec = outputAudioCodec ?? string.Empty;
|
||||
|
||||
if (codec.IndexOf("wma", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
// wmav2 currently only supports two channel output
|
||||
return Math.Min(2, inputChannels ?? 2);
|
||||
transcoderChannelLimit = 2;
|
||||
}
|
||||
|
||||
if (request.MaxAudioChannels.HasValue)
|
||||
else if (codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
var channelLimit = codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1
|
||||
? 2
|
||||
: 6;
|
||||
|
||||
if (inputChannels.HasValue)
|
||||
{
|
||||
channelLimit = Math.Min(channelLimit, inputChannels.Value);
|
||||
}
|
||||
|
||||
// If we don't have any media info then limit it to 5 to prevent encoding errors due to asking for too many channels
|
||||
return Math.Min(request.MaxAudioChannels.Value, channelLimit);
|
||||
// libmp3lame currently only supports two channel output
|
||||
transcoderChannelLimit = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If we don't have any media info then limit it to 6 to prevent encoding errors due to asking for too many channels
|
||||
transcoderChannelLimit = 6;
|
||||
}
|
||||
|
||||
return request.AudioChannels;
|
||||
var isTranscodingAudio = !string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
int? resultChannels = null;
|
||||
if (isTranscodingAudio)
|
||||
{
|
||||
resultChannels = request.TranscodingMaxAudioChannels;
|
||||
}
|
||||
resultChannels = resultChannels ?? request.MaxAudioChannels ?? request.AudioChannels;
|
||||
|
||||
if (inputChannels.HasValue)
|
||||
{
|
||||
resultChannels = resultChannels.HasValue
|
||||
? Math.Min(resultChannels.Value, inputChannels.Value)
|
||||
: inputChannels.Value;
|
||||
}
|
||||
|
||||
if (isTranscodingAudio && transcoderChannelLimit.HasValue)
|
||||
{
|
||||
resultChannels = resultChannels.HasValue
|
||||
? Math.Min(resultChannels.Value, transcoderChannelLimit.Value)
|
||||
: transcoderChannelLimit.Value;
|
||||
}
|
||||
|
||||
return resultChannels ?? request.AudioChannels;
|
||||
}
|
||||
|
||||
private int? GetVideoBitrateParamValue(EncodingJobOptions request, MediaStream videoStream, string outputVideoCodec)
|
||||
|
||||
Reference in New Issue
Block a user