Author Topic: AAC multi-channel to AC3 on-the-fly re-encode with Xine?  (Read 9969 times)

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« on: October 27, 2009, 10:36:14 pm »
My receiver/amplifier doesn't support AAC.   When I playback media encoded in h264 and AAC 6 channel through spdif the receiver only sees the L&R channels.  The centre channel, rear L&R and LFE channels are dropped and there is no downmixing of the content.  The result is nothing but background and effects on the two (L&R) channels my receiver does play.

With MPlayer, in a console, I can start the media playing using an audio filter to on-the-fly re-encode the audio from AAC to AC3 and retain the original 6 channels, no downmixing.  Works great... using mplayer... from the command line...  I have searched for hours and have not found a way to do this with Xine.  Is it possible?

Does anyone know of a way to implement an on-the-fly re-encode of AAC to AC3 with Xine in LMCE?

Thanks,

J.
« Last Edit: October 27, 2009, 10:46:13 pm by phenigma »

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #1 on: October 28, 2009, 04:31:46 am »
Code would have to be added to the Xine_Player to do this. I do know that mplayer has these options for filters, I am not sure what would need to be implemented, a quick look around xine's documentation might answer some of these questions.

It is a very good idea, and something that could be added as device data (to specify to downmix to this as an AV/Amplifiers parameter.)

-Thom

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #2 on: October 28, 2009, 10:42:02 pm »
Thanks Thom.  I'll dig around and see what I can figure out.  It would be nice to have this automatic when an spdif connection is used.

J.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #3 on: October 29, 2009, 03:33:32 am »
it would be good to do some looking around to see what amps support direct AAC or not.

the reason I say this, is because of use case.

If there are more amps out there that support AAC streaming versus not, then we can add a bypass devicedata so that AAC is sent straight through, or the opposite if the opposite is true.

Just some thoughts,
-Thom

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #4 on: October 30, 2009, 06:16:56 pm »
Great idea Thom, I was thinking along those lines.  I'm still trying to figure out if this can be done with Xine plugins or not.

J.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #5 on: October 30, 2009, 06:27:18 pm »
The plugin would have nothing to do with this, all of the work would be done in the Player, basically getting the entertainment area, and looking for related devices in a given category, then reading the device data and acting upon it.

-Thom

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #6 on: October 30, 2009, 06:35:31 pm »
Sorry Thom, I should be more specific, I was referring to Xine plugins (filters), not the xine_plugin of LMCE.  ;-)

J.

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #7 on: December 09, 2009, 08:41:13 pm »
Progress report, what I know so far:

After much searching I havn't found a single Receiver which supports 6ch AAC over S/PDIF (exceeds the spec bitrate it seems).  And the current method xine uses to handle AAC via S/PDIF causes it to output in PCM mode only sending the L/R channels, no centre, no rears, no sub.  An HDMI audio connection should not be affected by this as it can handle 6ch of PCM.

There are three ways to deal with this:
1) Use analog 6ch outputs from the MD to the receiver and configure ALSA accordingly (best sound quality, I don`t think AVWizard supports this currently but I havn't checked)
2) Have xine re-encode the AAC to AC3 (or DTS preferably) for S/PDIF output 'on-the-fly'.
3) Have xine down-mix to 2 channel stereo for PCM or analog output and de-coding by a Dolby Pro Logic dsp.  (I REALLY don't want this)

I don't have enough cables, currently, to test #1, and I'd rather not do it this way (even though this gives a much higher sound quality due to lack of compression).  My cats love to chew wires and the fewer I have the better.

I would prefer #2 above but I have not figured out how to implement this functionality in xine_player (or even if xine has this functionality).  This is easy to implement with MPlayer (but would require playing all .mp4 files with mplayer... not desirable.)

So...  I am slowly reading up on xine and trying to push my way through (learning) some c++ coding in the spare time I do have.  For now I am resorting to playing .mp4 files with 6ch AAC using mplayer from the command line.  But I am hoping to figure a way to have xine convert 'on-the-fly' when an S/PDIF output has been selected in avwizard.

J.
« Last Edit: December 10, 2009, 01:23:39 am by phenigma »

Lexje

  • Guru
  • ****
  • Posts: 230
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #8 on: December 09, 2009, 10:20:50 pm »
Not sure if this is of any help, Onkyo seems to support AAC. http://www.funponsel.com/blog/electronics/onkyo-tx-sa505-amplifier-if-only-it-has-hdmi-port.html
Code: [Select]
Onkyo presents TX-SA505, a 7.1-channel amplifier supporting Dolby Digital, Dolby Digital EX, DST, DTS-ES, AAC, Dolby NR Professional Logic IIx, and DTS 96/24 sound processors. It incorporate “Theater-Dimensional” technology which create 5.1-channel sound from only 2 speakers. Other features include 7×100W (6Ω), 24bit/192kHz (DAC), and Audyssey 2EQ that provides advanced precision on each speaker. Everything sounds great… but nothing’s perfect. FYI, TX-SA505 Amp doesn’t come with HDMI port… too bad…
I have two Onk's an old one and a new(er) one. If I can be of any help in testing something just let me know.
If I'm not mistaken on my machine I can redirect any physical input to any other pre-amp input but I haven't really played around too much with this.

You'd have to fill me in about on the fly encoding from AAC to AC3 or DTS, but I'm very interested in this matter too.
I do hope to hook up my NR-906 one of the next days... Still busy getting my HVR-4000 up, and S2 is around the corner (waiting for me to pick up in the shop.. :-) )

I would also be interested in finding a solution to have more control over the various channels, auto level equalisation and such.
Also displaying codec information via LCDproc would be extremely nice...

Erwin

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #9 on: December 09, 2009, 10:22:23 pm »
and displaying the codec info on LCD displays would be useful to users.....why, exactly?

come on guys, stop thinking like geeks.

-Thom

Lexje

  • Guru
  • ****
  • Posts: 230
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #10 on: December 09, 2009, 10:36:35 pm »
Thom-

I don't agree there;
What I mean is today's apparatus are so multi-capable most people are already happy when sound & vision is coming out. I for one don't always know whether a source is DTS or Dolby. Call me geeky, but I find it interesting to know and verify that my equipment is playing DTS rather than Dolby e.g.
Another point e.g is video codecs - maybe all this stuff is crystal clear to you, but certainly not to me.
E.g. my tv comany's cable box is set to output 1080i or p, but if you receive only 720 then my Aquos will still report 1080 from the cable box... So who's fooling who?
True that this information will only be handy while setting up or testing.

Thanks once more for LinuxMCE and your input. I'll be glad to help where I can.

-Erwin
« Last Edit: December 09, 2009, 10:57:52 pm by Lexje »

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #11 on: December 10, 2009, 01:49:19 am »
Not sure if this is of any help, Onkyo seems to support AAC.

Many, many receivers support AAC... through Ethernet UPNP and USB.  I've not found any device that supports AAC over S/PDIF, I don't believe it is possible.

J.
« Last Edit: December 10, 2009, 02:04:26 am by phenigma »

Viking

  • Addicted
  • *
  • Posts: 521
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #12 on: December 10, 2009, 09:46:54 am »
OK, that explains why there is no audio when playing theese 5.1 clips :
http://www.h264info.com/clips.html

I would also prefer option 2 ;)

Viking

Lexje

  • Guru
  • ****
  • Posts: 230
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #13 on: December 10, 2009, 10:54:36 am »
OK, that explains why there is no audio when playing theese 5.1 clips :
http://www.h264info.com/clips.html

I would also prefer option 2 ;)

Viking

Viking,

This intrigues me.
I just downloaded and tested 4 of those trailers:
http://www.dvdloc8.com/clip.php?movieid=12167&clipid=1
http://www.dvdloc8.com/clip.php?movieid=12954&clipid=1
http://www.dvdloc8.com/clip.php?movieid=13599&clipid=2
http://www.dvdloc8.com/clip.php?movieid=13599&clipid=4

I tested all 4 in 2 different ways:
- XP using VLC, connected with spdif to my TX-DS939 Amp. -> All 4 playing with sound. (could not check surround, as only L+R speakers are connected)
- put all the above in LMCE (spdif to NR-906) -> the 3 first ones all playing with sound & surround, the last one is the only one with no sound playing over spdif.

Erwin

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: AAC multi-channel to AC3 on-the-fly re-encode with Xine?
« Reply #14 on: December 10, 2009, 08:09:31 pm »
OK, that explains why there is no audio when playing theese 5.1 clips :
http://www.h264info.com/clips.html

Yepper.  Although I do get audio when I play them, I only get the L&R channels in LPCM format through the S/PDIF cable.

I use the Fantastic 4 720P trailer and one of the I am Legend 1080P trailers, from that site, for my testing.  The FF trailer plays with audio just fine because it is stereo.  The I am Legend trailer only passes the L&R audio.  Anything encoded with multi-channel (>2ch) AAC will act this way (wrt audio).

J.
« Last Edit: December 10, 2009, 08:12:24 pm by phenigma »