The “fall through” approach was the first thing i looked at right after i posted. It’s interesting, and kind of neat in that it allows you to isolate your settings per format. Unfortunately that’s not really what i need.
My problem is that the same codec/format comes in multiple flavors of channels. With Atmos or DTS it’s pretty much a given that the sound is not going to be 2.0, but with EAC3 or AC3 or even AAC or Flac it could be either a 2.0 or 5.1. So i can fall through the profile order until i hit one for let’s say AAC, but then i have no way of telling if it’s AAC 2.0 or 5.1 etc. Basically, isolating a codec is not really what i need. I need to figure out if the stream is 2.0 or surround, and have mcebuddy auto adjust the settings accordingly.
Mcebuddy does have a built in mechanism for figuring the whole 2.0 vs 5.1 thing, but it only works with AC3. For example, i took the same profile you posted above and changed the ffmpeg-audio to 192, since it’s more suitable then 384 for stereo sound.
order=handbrake,ffmpeg
handbrake-unsupported=dts
handbrake-audio=-E copy
handbrake-audioac3=-E copy
ffmpeg-audio=-acodec ac3 -ab 192k
ffmpeg-audioac3=-acodec ac3 -ab 384k
If i use these settings and feed it an EAC3 5.1 file, it will produce a file with 192k audio. If the output format was set to AAC it would produce 256k audio etc.
Same thing goes for AAC 2.0 vs 5.1 etc. AC3 will work as expected though, since the logic for it, and only for it, is already built in and will produce a 192 2.0 or 384 5.1. Basically, with anything other then AC3 the ffmpeg-audioac3 line/command is completely ignored and has zero effect on the conversion, only ffmpeg-audio line is used by mcebuddy. If you have checked the surround sound box in the gui, mcebuddy will pass a -6ch flag to the ffmpeg-audio line and treat those as your surround settings.
In my example i used 192k for the 2.0 output, and 384 for the 5.1 output. Since AAC is not AC3, mcebuddy will ignore the ffmpeg-audioac3=-acodec ac3 -ab 384k, and will use the ffmpeg-audio=-acodec ac3 -ab 192k settings. If i checked that i want surround in the gui it will pass the -6ch flag and i’ll end up with something like ffmpeg-audio=-acodec ac3 -ab 192k -6ch. If my output is also AAC some kind of an internal failsafe kicks in once the conversion starts that doesn’t allow a 5.1 mix on 192k. It will automatically increase the bitrate to 256 (the minimum for AAC 5.1). So in the end i will end up with a 256k 5.1 file. Not sure if it does the same for other formats.
Ideally, it would be great if the ffmpeg-audioac3 would work as a catch-all setting for all surround not just AC3, while ffmpeg-audio would then handle all the 2.0 mix. But that feature is just not there. Finding a workaround has proven challenging so far.