I’m posting this here, since it’s an AC3 “problem” and I suppose could relate in some way to this issue in the thread as well. I had been using a newer Onkyo receiver (605) and had no problems at all with streaming AC3 and DTS to that receiver. I have since pulled that receiver and reconnected an older receiver of mine (Denon AVR-3802). When I pick a video with an AC3 or DTS stream, I get a burst of static for a split second, but then the audio plays fine. I used to have the same problem with a hacked appletv when using Perian to do AC3 passthrough to the Denon (never tried the hacked ATV on the Onkyo).
Anyway, I started playing around the other night to see what I could do to get this to stop. The one thing that did the trick was going to the MIDI setup in the Utilities folder and set the sample rate from 48000 to 44000. When I run the program and pick a video, it plays with no burst of static. the problem is, after that, the midi setup gets reset to 48000 and any subsequent video I choose get the static burst at the beginning of playback. I think this is the sample rate of most AC3 and DTS tracks, right? I dunno. I’m pretty ignorant when it comes to these things.
Again, I have no idea if this relates at all, but have any of you that have this sound issue tried making this change in the MIDI setup to see if it has any effect? And also, is there anyone else having this burst of static issue? Is there any way to permanently get it to stop, as opposed to just having it work one time?
Thanks,
Carl
It reminds me of a problem Perian has. I have tried to hear 5.1 Digital Sound over Quicktime or Front Row with Perian installed. In a forum someone said also this midi thing too but it was useless and changed nothing for me in Frontrow or Quicktime. There is no passthrough AC3 5.1 output.
But now I tried it again with XBMC (changing sample rate to 44.000 in the midi presets) but sadly it does not work either. It changed nothing.
VLC is playing fine every movie with AC3 or DTS never mind which sample rate is adjusted in the midi preset.
Hope this helps.
*System: MacMini, Core Duo with 1,66 GHz, 2 GB Ram, with digital output to Denon AVR-1800, XBMC 05b8 installed*
I’m going to try and catch up with Brandon to work this out when I get a chance. Interestingly there are two problems, both of which stem from potential differences in our code and VLC et al’s.
I’d be interested in a few things (see below). Firstly, you MUST have your digital output set to 48,000Hz 16 bit stereo (the SPDIF transport protocol format) to be able to get AC3. Secondly, try an AAC 5.1 file with beta 9. Do you still get static or is it silent, or does it work?
To help us fix this, we need as many data points as possible (as my receiver - Onkyo SR605 works fine, you guys are my eyes and more importantly, ears).
A quick primer about audio and AC3 first (skip if you’re not interested in the technical details).
**** Begin technical gibberish ****
Basically, raw or "PCM (Pulse Code Modulation) audio, is the simplest and least compressed form audio can come in (Sorta like a windows BMP picture). It stores audio at a given sample rate (eg 48000hz, or 44100 (=CD)), which means how many times the sound is measured (or "sampled") per second. The "sample size" is a measure of the fidelity of each sample. For most purposes, 16 bit is more than enough (ie 2 bytes) for each sample. And of course, we need a sample for each channel (2 for stereo sound, or up to 6 for 5.1 surround). <br />
<br />
So that's PCM. Windows WAV and CD audio are both PCM. If you remember there are 44100 samples per second, each requiring 4 bytes per sample (2 channels x 16 bits per channel per sample) that means a second of CD or WAV stereo audio requires 44100 x 4 or around 160kbyte/sec to store. This is why your 700mb audio cds store around 70 minutes of audio. (70 min = 4200 sec = ~670mb). This will be important when we think about S/PDIF.<br />
<br />
So when Sony and Phillips sat down (probably not historically accurate) and thought up a new interface for their shiny new digital audio players (think Discman and MiniDisk) they, not surprisingly, called it the Sony/Philips Digital Interface Format (SPDIF for short). Your TOSLINK optical and coaxial digital connections all use this protocol to communicate over. Because the first players only played in stereo, they decided the protocol would use two channels, and because their devices were based mostly on CD and other consumer formats, which used a 44100Hz 16 bit format, they'd make the standard guarantee support for a 48000Hz 16 bit stereo stream (+ a bit of headroom, I think it can do 24 bit audio for audiophiles).<br />
<br />
(Extra for Experts - SPDIF is actually a consumer version of a professional standard called AES/BEU, the only difference is fancier cable and connectors, the protocol is essentially identical).<br />
<br />
So what we have is a digital format which has enough bandwidth to push a stereo CD signal down losslessly in realtime from a player to a receiver. This was (? how much) better than the old analog interconnects, and the market loved it. However, then came the home theatre revolution, and with it 5.1 audio. The problem for DVD in particular, was that 5.1 channels of audio wouldn't fit down poor SPDIF's suddenly tiny pipe. The solution - compression. Enter AC3.<br />
<br />
AC-3 (or A/52, or Dolby Digital) is a lossy compression method used in DVD, digital theatre, Bluray, and a multitude of other sources to compress 5.1 audio small enough to fit in about a third of the space the same length of raw PCM audio would require. The details of the algorithm is beyond me, but I gather it uses a psychoacoustic model similar to MP3 (ie it throws away the parts you can't hear).<br />
<br />
AC3 works by encoding audio in blocks of 1536 samples (roughly 0.03 of a second). A 6 channel PCM 16 bit stream of the same length (1536 samples) is (1536 x six channels x 16 bits or 2 bytes = 18KB. (A whole 2 hour DVD in raw 6 channel PCM would likely take up more space than the whole DVD). However, using AC3 compression, that same 1536 sample block takes up only 1.7KB. Most people can't tell the difference when it's played back. Even more interesting, a 2 channel 16 bit PCM stream of 1536 samples only takes up 1536 x 2 channels x 2bytes = 6144 bytes, or 6KB. Remember that SPDIF allows a 2 channel 16 bit PCM stream at up to 48000khz, and suddenly we have multichannel sound that can fit down that tiny SPDIF pipe.<br />
<br />
Thats great, but there's two small problems. One, how do we tell the receiver that we're sending it AC3 instead if the PCM it's expecting. Easy - we send it an 8 byte header that tells it "Here comes some AC3." <br />
<br />
The second problem is video. Most players (XBMC in particular, syncs audio and video by saying, well, if this is 48000Hz audio, ie 48000 samples/sec, if we've played 48000 samples, then by golly, we must need to play a second of video." You'll remember that the AC3 packet we talked about above is only 1.7KB, whereas there's enough audio for the equivalent of 6KB of 2 channel PCM. Consequently we have to oad out the difference with silence (zeroes). If you drew out this stream (the AC3 bitstream) on graph paper, or an oscilloscope, you'd see bursts of activity about a quarter of the time, then flat lines for the remainder. If you played it through a receiver that didn't understand AC3, it would sound horrible (the "helicopters" above).
Phew! Long story short - we need to know a few things about your setup (hopefully you understand why from the above) -
- What brand of receiver you have, and whether it supports AC3 ( ie do you get surround from DVD).
- How your receiver is connected - optical or coaxial, and what sound device on the computer side you have
- Whether your receiver detects an AC3 stream when you try to play it in XBMC - ie, does your receiver switch into Dolby Digital mode (Prologic or 2.0 Surround don't count!)
- Whether you get silence or static.
- Lastly, if you're running the latest v0.5 b9, if a video with an AAC or FLAC 5.1 surround track plays back or you get the same static.
Fingers crossed Brandon and I and the rest of the team can sort this out, but we need your help!
My configuration is a MacMini, Core Duo with 1,66 GHz, 2 GB Ram, with digital output SPDIF to Denon AVR-1800, XBMC 05b9 installed. The Denon AVR-1800 is AC3 and DTS capable. If I play a DVD with Apple DVD Player or VLC AC3 5.1 Audio works. I see it in the display of the receiver. It changed from Dolby Sourround to Dolby Digital (AC3/5.1).
First Test: Midi setup is adjusted to 48,000Hz 16 bit stereo playing music and movies with standard stereo sound. This works fine without problems. Receiver shows Dolby Sourround because it only can change between Dolby Sourround and Dolby Digital automatically.
Second test: If I try to play a movie with AC3 stream in XBMC (0.5b9) now it makes a short scratch and then I get silence (no “helicopters” any more). Like in the versions before. Same behavior if I play the Apple HD-Trailer “The dark knight” (AAC 5.1) scratch and then silence. No display of Dolby Digital on the receiver.
Third test: Trying to play a movie with stereo sound again resulted in silence (without scratch) also and the klick sound of the menue is gone. When going to the music menue and playing a mp3 file I hear the music and the click sounds are again audible.
Fourth test: After all this I tried to play a movie with stereo sound again and now I’m hearing the sound again.
It seems that the first time I’m trying to play a movie with AC3 XBMC changed output settings and they are not changing if I play a movie with simple stereo sound after this. The setting are changed when I play a mp3 file between my tests. Then the stereo movie has it’s normal sound.
Hope this helps and keep on with the good work!!!
Hi,
Done some more testing with the latest build (0.5.0b9). Receiver is a Sony ST-DB930, connected to a mac mini’s built in optical output. Optical settings in Audio Midi setup as per recommendations (48KHz, 16Bit)
Standard content : plays fine.
AAC 5 channel content (Dark Knight HD trailer): lights up the Surround light on the receiver, display shows DD5.1. However there’s no sound. Skipping forwards or backwards gives a small click of static from the receiver. Surround light stays on even after the film is stopped, until new (stereo) content is played.
AC3 content (either xvid or mkv): Lights the Surround light, receiver shows DD5.1. Still no sound. No static on fast forward either 
Quitting OSXBMC leaves the receiver stuck thinking it’s still playing 5.1 content (ie. surround light and receiver showing 5.1 while back at the desktop), until something else resets the audio.
Previous builds of OSXBMC didn’t light the surround light up, so it’s getting there… 
AC3 works fine in VLC for xvid / mkv’s / dvd’s etc.
Cheers
Jon
MBP to Kenwood DTS Dolby Digital VR-606 reciever by mini-TOSLink.
Just like previous betas, 0.5b9 gives a short scratch followed by silence. The surround indicator does not light up.
The content plays with digital surround using VLC. Midi settings make no difference. I uninstalled Perian with no effect.
For now I set my output to analog and thank you guys for working on this bug!
Thanks for the testing guys! Looks like our actual audio stream is ok, but we’re still not sending an appropriate header down the wire. I’ve got a few things to try tonight, so hopefully will have a solution for this shortly. Keep the reports coming!
OK, I’ve altered the AC3 encoder encapsulation code to mirror how VLC does things. This still works on my receiver, so fingers crossed it will fix things for everyone else. I purposely haven’t fixed the AC3 passthrough code, because if this fix works for AAC and not for AC3, I’ll know i’ve nailed it. This means you’ll need a 5.1 AAC/FLAC file to test (try an Apple HD movie trailer). If it works for AAC, it will work for AC3 passthrough, and Elan and I will get it into the next beta.
This is just the binary, so you’ll need to replace XBMC under OSXBMC.app/Contents/MacOS with it. Good luck!
http://dn-0.com/xbmc-trac/attachment/ticket/114/XBMC.tar.bz2
10x 4 ur work, but this is the report when i lunch the application:
Process: XBMC [7750]<br />
Path: /Applications/OSXBMC.app/Contents/MacOS/XBMC<br />
Identifier: org.xbmc.XBMC<br />
Version: ??? (???)<br />
Build Info: XBMC-0000~1<br />
Code Type: X86 (Native)<br />
Parent Process: launchd [80]<br />
<br />
Date/Time: 2008-06-26 12:59:41.300 +0200<br />
OS Version: Mac OS X 10.5.3 (9D34)<br />
Report Version: 6<br />
<br />
Exception Type: EXC_BREAKPOINT (SIGTRAP)<br />
Exception Codes: 0x0000000000000002, 0x0000000000000000<br />
Crashed Thread: 0<br />
<br />
Dyld Error Message:<br />
Library not loaded: /opt/local/lib/libfreetype.6.dylib<br />
Referenced from: /Applications/OSXBMC.app/Contents/MacOS/XBMC<br />
Reason: image not found
Thanks for your hyper fast reaction. But XBMC now crashed on my Mini 
Are you making it executable? Not tested it yet, just a suggestion…
YES: chmod 777 XBMC
and chown fatez:admin XBMC
still remain the crash
Sorry, my bad. Give me 5 minutes to get a working build up.
Ok, sorry that build is a bit of a disaster. It’s linked against development versions of all the libraries rather than the release ones in the OSXBMC.app. Of course those libraries exist on my system not yours. Its a bit late in the day for me to fix it now, so I’ll get elan to build a proper one tomorrow. In the meantime, if you don’t mind a bit of compiling, install MacPorts and install the development libs, after which my build will work fine.
Sorry! :S…
(Once you install MacPorts, the command to run is:
sudo port install libsdl libsdl_image libsdl_mixer glew fribidi freetype python24 mysql5 lzo libmad samba3 pcre fontconfig
Once again, sorry! This is terrible... Elan is gonna kill me....
Hang in there, I think we've got the problem solved, and should have a proper release with this fixed for good by the weekend.
10x Tokyo, but now i have to go to work… i will install mac port this night…
sorry but i can't test it, 'couse i don't have enought free space to install mac port and lybrary... :(
Anyone can test this new binary?
Alright, please try this binary, into which I incorporated tokyovigilante’s patch:
afp://dn-0.com/samples/Outbox/XBMC-ac3.zip
Unzip, rename to “XBMC”, make executable, and replace in OSXBMC.app/Contents/MacOS. Remember, as he stated: “I purposely haven’t fixed the AC3 passthrough code, because if this fix works for AAC and not for AC3, I’ll know i’ve nailed it. This means you’ll need a 5.1 AAC/FLAC file to test (try an Apple HD movie trailer). If it works for AAC, it will work for AC3 passthrough, and Elan and I will get it into the next beta.”
Hi,
Thanks for the quick patch, it’s great to know you are helping fix obscure problems that aren’t affecting many people 
But, still no luck with the patch
I get exactly the same as before, playing the batman QT HD trailer gives me a blue multichannel light and dolby digital on the display of the receiver, but I get no sound. Skipping forwards gives me the shortest click of static, but still no sound 
Receiver is a Sony ST-DB930, connected to a mac mini’s built in optical output. Optical settings in Audio Midi setup as per recommendations (48KHz, 16Bit).
If there’s anything I can do to help debug stuff, I’d be more than happy 
Cheers,
Jon
Hi!
doesn’t work for me… i’ve tryed AAC and FLAC but still remain in stereo mode on.
I also played an movie HD apple trailer but no luck for me.
Same here: AAC still gives scratch then silence