Fix audio VBR calculation

Pass encoder, not codec
This commit is contained in:
knackebrot 2023-03-21 15:01:32 +01:00
parent 6a39882a70
commit e0a7e9baa0
2 changed files with 3 additions and 3 deletions

View File

@ -1693,7 +1693,7 @@ public class DynamicHlsController : BaseJellyfinApiController
if (audioBitrate.HasValue && !EncodingHelper.LosslessAudioCodecs.Contains(state.ActualOutputAudioCodec, StringComparison.OrdinalIgnoreCase)) if (audioBitrate.HasValue && !EncodingHelper.LosslessAudioCodecs.Contains(state.ActualOutputAudioCodec, StringComparison.OrdinalIgnoreCase))
{ {
var vbrParam = _encodingHelper.GetAudioVbrModeParam(state.OutputAudioCodec, audioBitrate.Value / (audioChannels ?? 2)); var vbrParam = _encodingHelper.GetAudioVbrModeParam(audioCodec, audioBitrate.Value / (audioChannels ?? 2));
if (_encodingOptions.EnableAudioVbr && vbrParam is not null) if (_encodingOptions.EnableAudioVbr && vbrParam is not null)
{ {
audioTranscodeParams += vbrParam; audioTranscodeParams += vbrParam;
@ -1760,7 +1760,7 @@ public class DynamicHlsController : BaseJellyfinApiController
var bitrate = state.OutputAudioBitrate; var bitrate = state.OutputAudioBitrate;
if (bitrate.HasValue && !EncodingHelper.LosslessAudioCodecs.Contains(actualOutputAudioCodec, StringComparison.OrdinalIgnoreCase)) if (bitrate.HasValue && !EncodingHelper.LosslessAudioCodecs.Contains(actualOutputAudioCodec, StringComparison.OrdinalIgnoreCase))
{ {
var vbrParam = _encodingHelper.GetAudioVbrModeParam(actualOutputAudioCodec, bitrate.Value / (channels ?? 2)); var vbrParam = _encodingHelper.GetAudioVbrModeParam(audioCodec, bitrate.Value / (channels ?? 2));
if (_encodingOptions.EnableAudioVbr && vbrParam is not null) if (_encodingOptions.EnableAudioVbr && vbrParam is not null)
{ {
args += vbrParam; args += vbrParam;

View File

@ -6015,7 +6015,7 @@ namespace MediaBrowser.Controller.MediaEncoding
if (bitrate.HasValue && !LosslessAudioCodecs.Contains(outputCodec, StringComparison.OrdinalIgnoreCase)) if (bitrate.HasValue && !LosslessAudioCodecs.Contains(outputCodec, StringComparison.OrdinalIgnoreCase))
{ {
var vbrParam = GetAudioVbrModeParam(outputCodec, bitrate.Value / (channels ?? 2)); var vbrParam = GetAudioVbrModeParam(GetAudioEncoder(state), bitrate.Value / (channels ?? 2));
if (encodingOptions.EnableAudioVbr && vbrParam is not null) if (encodingOptions.EnableAudioVbr && vbrParam is not null)
{ {
audioTranscodeParams.Add(vbrParam); audioTranscodeParams.Add(vbrParam);