Reviving an old, forgotten patch... On Wednesday, 22 February 2006 at 11:01, Corey Hickey wrote:
The problem: 6-channel AAC has a different channel order than MPlayer outputs.
MPlayer wants: 0 - front left 1 - front right 2 - rear left 3 - rear right 4 - front center 5 - lfe
MPlayer gets: 0 - front center 1 - front left 2 - front right 3 - rear left 4 - rear right 5 - lfe
-------------------------------------------------------------------------- For a test source you can probably use any recent hd trailer from Apple. Or: http://movies.apple.com/movies/universal/king_kong/king_kong-tlr_h480p.mov
This works fine because AAC does the downmixing internally: $ mplayer king_kong-tlr_h480p.mov -channels 2
This sounds odd -- the channels are definitely mixed up: $ mplayer king_kong-tlr_h480p.mov -channels 6
If you don't have a 5.1 speaker setup (I don't either), then you can do a quick-n-dirty downmix: $ mplayer king_kong-tlr_h480p.mov -channels 6 \ -af pan=2:0.4:0:0:0.4:0.2:0:0:0.2:0.3:0.3:0.5:0.5
...or an hrtf one: $ mplayer king_kong-tlr_h480p.mov -channels 6 -af hrtf
Either way, you'll hear that the channel position isn't right.
-------------------------------------------------------------------------- The attached patch uses af_channels to handle the reordering. ad_faad.c:init() sets up a routing map and af.c:af_init() uses that map to put a channels filter at the beginning of the audio chain. Try the above examples with a patched mplayer -- they should work correctly.
As far as I know the patch doesn't break anything. Probably it does, but not that I know of. :) Anyway, I don't consider it finished. Some notes:
* It would probably be ideal to have faad handle the reordering, but I don't see a way to do that.
* If this kind of approach seems acceptable, I should switch to af_pan to handle upmixing and downmixing where channels have to be split or combined.
* I don't have any code to deal with 3- or 4- channel AAC. With af_pan I could probably upmix or downmix these appropriately to match the output channel order. Does anyone have a sample?
* This could be applied to audio formats other than AAC, of course. Does anyone have an example of another format that could benefit?
-------------------------------------------------------------------------- So, what do you think? Am I barking up the wrong tree or should I keep working in this direction?
I've tested it on my 4.0 setup and I didn't hear the front center and lfe channels until I downmixed it to 4ch: mplayer -af pan=4:1:0:0:0:0:1:0:0:0:0:1:0:0:0:0:1:0.25:0.25:0:0:0.25:0.25:0:0 \ return,_the_h720p.mov With that, it seems to be working fine (certainly the trailer sounds better than without it). Attached a version updated to current SVN, although the old patch still applies. OK to apply? Regards, R. -- MPlayer developer and RPMs maintainer: http://rpm.greysector.net/mplayer/ There should be a science of discontent. People need hard times and oppression to develop psychic muscles. -- from "Collected Sayings of Muad'Dib" by the Princess Irulan