Log in

View Full Version : on-the-fly AC3 encoding for 6 channel AAC files (mplayer)


josk
1st May 2011, 16:48
My old Yamaha receiver is not able to play 6 channel AAC but just AC3 or DTS audio. So I always on-the-fly encode those 6ch AAC audio tracks to AC3 audio tracks using mplayer-mt (debian).

I just updated mine Debian Lenny to Debian Squeeze and now I have channel mapping issue. AC3/DTS files plays on the correct speakers. So my speaker setting should be ok. When I try to play video file that contains 6ch AAC audio track that is on-the-fly encoded to AC3 audio --> I hear those test sounds on the wrong speakers. Example CENTER is REAR RIGHT etc... Dolby Digital icon lights up always on my receievr so I know that AC3 transcoding is not the problem.

Here is command line example how you can on-the-fly encode multichannel AAC audio track to AC3 track.

mplayer-mt -ao alsa -ac hwdts, -ac hwac3, -af channels=6,lavcac3enc=1:640:3 6ch_aac.mp4

I have put those config options to .mplayer/config file:

# Device and passthrough
#=====================
ao=alsa:device=hw=0.1
#For both AC-3 and DTS passthroug, use -afm hwac3
afm=hwac3,
channels=6
#lavcac3enc[=tospdif[:bitrate[:minchn]]]
af=scaletempo,lavcac3enc=1:640:3

So I just need to use following command:

mplayer-mt movie_name.avi/mkv/mp4

Test videos:

6ch aac test video: http://dl.dropbox.com/u/26249587/6ch_aac.mp4
6ch ac3 test video: http://dl.dropbox.com/u/26249587/6ch_ac3.avi

I tried to remap those channels but I always lost one channel (Surround Left).
mplayer-mt -ac hwdts,hwac3, -channels 6 -af channels=6:6:0:0:1:2:4:1:3:4:5:3:2:2,lavcac3enc=1:640 6ch_aac.mp4

Now I don’t know hove to solve this problem. I hope someone of you have some tips for me because it worked that way in Debian Lenny and I don't know why those channels are now mapped to the wrong speakers. Also I only have one 6ch AAC test video and I want to be sure that it contains those channels in right order. Can someone test it? If someone have some other AAC surround test files, please, let me know.

-josk

sneaker_ger
1st May 2011, 22:09
Both the AC3 and AAC sample seem to have the correct mapping for me.

josk
2nd May 2011, 09:06
Both the AC3 and AAC sample seem to have the correct mapping for me.

Thanks! I got an other AAC sample and the problem remains. So the AAC files should be ok.

I don’t know why but at the moment without channel mapping I hear sounds these ways:

My speaker => I hear

FL => FL + LFE
CENTER => FR
FR => SL
SR => CENTER
LFE => SR

Why those channels are in disorder? Any ideas?

I have tried to fix channel ordering and I almost was able to fix all channels. Still the SL is mute and FL plays two different channels.

I think it would help for fixing the issue if I got some clue what is main reason that those channels are in disorder. This situation is only with multichannel AAC files, not AC3/DTS files.

SNEAKER: Could you tell version of mplayer and distro? Or have you combined mplayer by yourself?

sneaker_ger
2nd May 2011, 20:44
SNEAKER: Could you tell version of mplayer and distro? Or have you combined mplayer by yourself?

I was supposed to test on Linux? Only tested on windows with MPC-HC and mplayer 33216.

The voice saying the word "LFE" comes from the left front speaker and only the "grumbling" from the subwoofer, btw. That seems to be intended and not an (additional) error in your configuration.

josk
3rd May 2011, 21:09
Problem solved, I remapped my channels and now that 6ch aac on-the-fly-encoding works like it should be!

mplayer-mt -ac hwdts,hwac3, -channels 6 -af channels=6:6:0:0:2:5:1:2:4:1:3:4:5:3,lavcac3enc=1:640 6ch_aac.mp4

That 6:6:0:0:2:5:1:2:4:1:3:4:5:3 means

6:6 => Total 6 channels and I moved those channels 6 times

0=FRONT LEFT (This was OK! So I just copied that channel to itself => 0:0)
1=FRONT RIGHT (I heard SURROUND LEFT, so I moved it to the correct channel => 1:2)
2=SURROUND LEFT (I heard LFE, so I moved it to the correct channel => 2:5)
3=SURROUND RIGHT (I heard CENTER, so I moved it to the correct channel => 3:4)
4=CENTER (I heard FRONT RIGHT, so I moved it to the correct channel => 4:1)
5=LFE (I heard SURROUND RIGHT, so I moved it to the correct channel => 5:3)

So I added this to my .mplayer/config

# Device and passthrough
#=====================
# Default device ao=alsa (or u could define more detailed: ao=alsa:device=hw=0.1)
ao=alsa:device=hw=0.1
#For both AC-3 and DTS passthroug, use -afm hwac3
afm=hwac3,
channels=6
#lavcac3enc[=tospdif[:bitrate[:minchn]]]
af=scaletempo,channels=6:6:0:0:2:5:1:2:4:1:3:4:5:3,lavcac3enc=1:640:3


I don't know what is wrong with current mplayer-mt / mplayer2 because it needs channel remapping for 6ch AAC audio. Everything worked just fine in earlier versions of mplayer-mt. So I didn’t have to remap those channels.

josk
26th November 2014, 20:17
Old topic but here is correct syntax if you need it to getting work on MPV (MPlayer fork):
http://shellscreen.blogspot.fi/2014/11/6-channel-aac-to-ac3-on-fly-encoding-on.html