I have created for myself a build script to automatically import films into iTunes, making sure that they have compatible audio/video tracks. This generally means that if the input video track isn't H.264, it's converted to it, and if the input audio track isn't DTS, AC-3 or AAC, it's converted to a 2-channel AAC track.
In the special case that the input video's audio track is DTS, AC-3 or multichannel AAC, then a second, 2-channel AAC track is added for compatible with iDevices and my Apple TV 3 (which isn't connected to a device which can decode DTS or AC-3).
Generally this works well, except that if I play the resulting video on my Mac via iTunes or QuickTime Player, they play both audio tracks at the same time, and there doesn't seem to be an option to switch between them. Making them different languages via metadata works, but I'd rather have them both correct.
ffmpeg to do the necessary format conversions and
AtomicParsley to set the iTunes-compatible metadata. I then use a custom AppleScript to import the resulting file and set the media kind to 'Movie' or 'TV Show' (since iTunes always seems to ignore the metadata set in the file and sets it to 'Home Video').
How can I create the video file with the preserved high-quality audio track and the backup 2-channel AAC, and get iTunes and QuickTime Player to play only the best-quality track they can (ideally in a way which can be automated)? I've noticed that films from the iTunes store include several audio streams, but iTunes never plays them simultaneously.
Update: Looks like at some point recently iPhones and iPads were updated to include an AC-3 decoder, and so are also playing both audio tracks simultaneously. I wouldn't even bother with the AAC stream if not for the Apple TV (pre 4)!