Skip to content

Commit ed96a9e

Browse files
committed
Fix per-track audio settings being active when not selected
1 parent 2b223cf commit ed96a9e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ff-utils-winforms/Data/CodecUtils.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,21 +86,22 @@ public static string GetAudioArgsForEachStream(MediaFile mf, int baseBitrate, in
8686
List<AudioStream> allAudioStreams = Program.mainForm.streamListBox.Items.OfType<MediaStreamListEntry>().Where(x => x.Stream.Type == Stream.StreamType.Audio).Select(x => (AudioStream)x.Stream).ToList();
8787
List<AudioStream> checkedStreams = Program.mainForm.streamListBox.CheckedItems.OfType<MediaStreamListEntry>().Where(x => x.Stream.Type == Stream.StreamType.Audio).Select(x => (AudioStream)x.Stream).ToList();
8888
List<AudioConfigurationEntry> audioConf = TrackList.currentAudioConfig != null ? TrackList.currentAudioConfig.GetConfig(mf) : null;
89+
bool perTrack = Program.mainForm.encAudConfModeBox.SelectedIndex == 1;
8990

9091
foreach (AudioStream s in checkedStreams)
9192
{
9293
int indexTotal = allAudioStreams.IndexOf(s);
9394
int indexChecked = checkedStreams.IndexOf(s);
9495
int ac = overrideChannels > 0 ? overrideChannels : s.Channels;
9596

96-
if (audioConf != null)
97+
if (perTrack && audioConf != null)
9798
ac = audioConf[indexTotal].ChannelCount;
9899

99100
if (baseBitrate > 0)
100101
{
101102
int kbps = (baseBitrate * MiscUtils.GetAudioBitrateMultiplier(ac)).RoundToInt();
102103

103-
if (audioConf != null)
104+
if (perTrack && audioConf != null)
104105
kbps = audioConf[indexTotal].BitrateKbps;
105106

106107
args.Add($"-b:a:{indexChecked} {kbps}k");

0 commit comments

Comments
 (0)