[LINUX/MAC/WINDOWS] AAC/FLAC/WMV 5.1 pass-through to SP/DIF out: transcode to AC3 5.1
#1
Question 
From what I have read it won't work to pass AAC 5.1 over spdif because most receivers (like mine) can't decode it. If passthrough is enabled would it be possible to have xbmc downmix to stereo? It seems like a pretty common problem considering AAC is becoming quite popular and most receivers do not decode it. Am I making this more complicated than it needs to be?
Reply
#2
Rand Al Thor Wrote:If passthrough is enabled would it be possible to have xbmc downmix to stereo?
Anything is possible, it is just not implemented yet becuase no one with the skills required has taken the time to look at it and code it, (plus the fact that no one has requested it before you). Moving to the feature suggestion forum.

What XBMC (or the underlying operating-system/hardware) should really do with 5.1 AAC if the user has selected digital-output in XBMC for pass-through is decode the 5.1 AAC stream to 5.1 PCM and then either pass that on directly to S/PDIF as 5.1 PCM, or encode that 5.1 PCM stream to 5.1 AC3 before passing it to S/PDIF.

"Downmix to stereo" could maybe be an option for all digital-output in XBMC, but if not then it should really only downmix to stereo if the user has selected analog output in XBMC.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#3
what would be the point of such a switch? any hw doing digital input which only accepts 2.0 is faulty by design.

in any case; xbmc will decode to pcm 5.1 and pass that to the audio system. it will, based on your settings, either encode that in real time to ac3 5.1, downmix to stereo then pass as 2.0 ac3 (i think it will, it might pass as 2.0 pcm). the only thing not supported is actually passing it through (which according to elupus' is trivial to add and on his list iirc).

if you are not talking about xbox, please specify so. for the other ports we are waiting for ffmpeg to add their own decoder as afaik there is no downmix code in libfaad
Reply
#4
Hey guys, thanks for the reply. Just so you know spiff I was talking linux and this post was originally in the linux forum Wink I thought perhaps this was just one of the many features that xbmc already had and perhaps my system was not working properly (wouldn't be the first time). Spiff, am i reading you right that it would pass 5.1 pcm to the receiver? In the research I did before posting ( and i could very well be wrong) it appeared that most receivers could only handle 2 channel pcm? Anyway, not a big deal. Thanks for the replies. Cheers.
Reply
#5
i was only talking about xbox. i'm not sure how it is handled on linux, as i have never played with the digital output support. but i'd imagine it would (or atleast should) output 5.1 pcm
Reply
#6
5.1pcm is not possible over SPDIF because of bandwidth requirements. SPDIF is max 2 channel pcm, or compressed 5.1 DD or DTS. That's why HDMI audio is becoming more and more important as it can, in spec 1.1 and beyond, pass 8 channel pcm.

Dustin
Reply
#7
First, a little background: a52Encode is an alsa plug-in that performs real-time ENcoding to AC3. Most of my HD content has lossless FLAC audio, so I can future proof it for LPCM over HDMI down the road. In the meantime, I can use A52Encode to downsample it to AC3 and send it to my current receiver over SPDIF.

I've got a52Encode set-up and working in linux. Playing an .mkv with FLAC soundtrack using "mplayer -ao alsa:device=a52encode" turns on the Dolby light on my AVR and produces 6-channel sound.

However, playing the same file with Audio Output Device = "a52encode" in XBMC fails. No sound is returned.

1. Distro: Ubuntu Hardy Heron
2. Architecture: i686 (X2 4600), sound card is Realtek
3. XBMC source: SVN
4. SVN version:14004M (Compiled: Jun 10 2008)
5. Repro steps:

a. Start XBMC on system with a52encode configured and working
b. Navigate to Settings>Video>Audio Hardware
c. Set "Audio Output Device" to "a52encode"
d. Attempt to play FLAC video or audio file

6. Debug Log is here: http://www.pastebin.ca/1068940
7. XBMC does not crash

Input file is an .mkv container with x264 video and 6 channel FLAC audio.

Same file plays fine with output set to "iec958" (albeit in stereo). I have no issues playing x264 videos with bitstream (ac3 or dts) soundtracks, they are passed through fine.
Reply
#8
Issue appears to be here:

ALSADirectSound.cpp:

// TODO - add an option to only downmix if user want's us
if(iChannels == 6)
deviceuse = "xbmc_51to2:'" + EscapeDevice(deviceuse) + "'";

Seems as if a52encode requires that the number of channels IN matches the number it is configured with. The solution would be that to add code so that:

if (device == a52encode)
n = numberOfChannelsFromALSA
Reply
#9
IGNORE PREVIOUS POST Big Grin

Issue appears to be here:

ALSADirectSound.cpp:

// TODO - add an option to only downmix if user want's us
if(iChannels == 6)
deviceuse = "xbmc_51to2:'" + EscapeDevice(deviceuse) + "'";

Seems as if a52encode requires that the number of channels IN matches the number it is configured with in asound.conf. If the source has 6 channels, XBMC automatically converts them to 2 channels. Since a52encode expects 6 channels, and only gets 2, it cries. This is the bug.

A quick fix (for me) was getting keeping the source input in 6 channels when we are using a52encode. However, this only fixes the issue when the source already matches the number of channels a52encode is expecting. If the source is stereo, or the source is 7 channels, this fix wont work.

The REAL solution would be to add code so that if device is a52encode, XBMC converts all sound to the expected number of channels (from asound.conf) and then passes it through. My code-fu isn't quite up to the task, but this may be a worthwhile task at some point.

I would say it isn't high priority though... Fixing the issue raised a secondary issue. It turns out a52encode is very slow, and playing 1080p content and encoding 6 PCM channels in real-time was far more then my puny 5600+ could handle. Until we have a hardware solution for a52encode (like DTS Connect! and Dolby Live!) or we can unload decoding to the GPU and free up CPU, this doesn't seem like a good solution.

I may be talking to myself, but I wanted to make sure this was all noted in the event someone runs into any of these issues in the future.
Reply
#10
New feature request ticket on trac would be welcomed http://trac.xbmc.org see guidelines:
http://wiki.xbmc.org/?title=What_is_XBMC...to_XBMC.3F

Wink
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#11
note that plex has an implementation of an ac-3 encoder
Reply
#12
Gamester17 Wrote:New feature request ticket on trac would be welcomed http://trac.xbmc.org see guidelines:
http://wiki.xbmc.org/?title=What_is_XBMC...to_XBMC.3F

Wink

Were you talking about this?
http://trac.xbmc.org/ticket/4450
Reply
#13
spiff Wrote:note that plex has an implementation of an ac-3 encoder
Cool, but do you know if the source code for it is cross-platform compatible? Huh
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#14
Yes, it is. As far as XBMC is concerned, it would be implemented as part of the audio filter chain that we hope to develop after Atlantis.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#15
what would be great is if it could one day be like my satellite reciever. It has optical out, and 2 channel stereo RCA plugs. It outputs surround through the optical and stereo through the analog at the same time. that way im able to send 1 to my receiver with surround, the other to other tvs with 2 channel sound. Im sure others distribute it whole apt/house also. Thanks for all the great work.
Reply

Logout Mark Read Team Forum Stats Members Help
[LINUX/MAC/WINDOWS] AAC/FLAC/WMV 5.1 pass-through to SP/DIF out: transcode to AC3 5.11