fix: pass target audio codec to audio channel filter rather than source

Fixes issues with AAC output >2 channels
This commit is contained in:
Christian Benincasa
2026-02-20 08:51:05 -05:00
parent 7e1d841178
commit e2c7114feb
2 changed files with 3 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
import { AudioFormats } from '../constants.ts';
import { makeConstantOutputOption } from './OutputOption.ts';
export const AudioChannelsOutputOption = (
@@ -8,7 +9,7 @@ export const AudioChannelsOutputOption = (
const opts: string[] = [];
if (
sourceChannels !== desiredChannels ||
(audioFormat === 'aac' && desiredChannels > 2)
(audioFormat === AudioFormats.Aac && desiredChannels > 2)
) {
opts.push('-ac', desiredChannels.toString());
}

View File

@@ -580,7 +580,7 @@ export abstract class BasePipelineBuilder implements PipelineBuilder {
if (!isNull(this.context.desiredAudioState.audioChannels)) {
this.pipelineSteps.push(
AudioChannelsOutputOption(
this.context.audioStream.codec,
this.context.desiredAudioState.audioEncoder,
this.context.audioStream.channels,
this.context.desiredAudioState.audioChannels,
),