HDMI Audio Issues
#1
I am experiencing some audio issues with XBMC 9.04.1.

I have my system running audio through HDMI with my HD TV. I seem to have no audio problems with apps other than XBMC.

First, I almost never hear any startup or navigation sounds. When I had the system connected to a computer monitor and typical desktop computer speakers, I always heard those sounds.

Second, I receive error messages from XBMC when I try to play AVI videos from my Canon PowerShot A590IS digital camera. The message is a sliding pop-up saying "Failed to initialize audio device. Check your audio settings."

I had no such problems when I had the system connected to a computer monitor and typical desktop computer speakers.

XBMC has no problems playing the audio through HDMI with TV recordings (AVI files created with mencoder), DVDs, and DVD ISO images. XBMC won't play the audio only with the camera movies.

The camera records movies with a format of:

Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 20 tbr, 20 tbn, 20 tbc
Stream #0.1: Audio: pcm_u8, 11024 Hz, mono, s16, 88 kb/s

I can play the camera videos in other apps and hear the audio.

When I try to play the camera videos the logs show a continual repeat of "WARNING decode -avcodec_decode_video didn't consume the full packet . . ."

Because I never had audio problems with the external speakers and only through HDMI, I suspect both problems are related.

System info:

Slackware 13.0 (32-bit), KDE 4.2.4, 2.6.30.5 kernel, XBMC 9.04.1. Asus M3N78-EM motherboard with an Nvidia GeForce 8200/8300 MCP78S chip set, AMD 5050e dual core CPU, 2GB RAM.

I am very much an XBMC newbie. I'll try to provide additional info as requested.

Thanks much.
Reply
#2
While I can't comment on your camera issues, I can give you some commentary on your HDMI Audio issue(s). First, let me describe some of the issues I experienced with HDMI Audio.

Initially I had set the audio device (Settings > System > Audio hardware) to "hdmi" and experienced the following:
1) no navigation menu sounds
2) mp3s (44.1kHz) would play back fast (48kHz)

Looking in the xbmc.log file, I noticed that when played an mp3, it said something to the effect of "trying 44.1kHz; failed. initializing 48kHz; ok;"

Upon investigation, I discovered that the hdmi device (cat /proc/asound/card0/codec#3) only supported 2 samplerates: 48khz and 88.2kHz (an odd samplerate if you ask me)

So.. this can actually explain both issues. If the menu sounds are not 48kHz they might not play and mp3s were in fact being played back at 48kHz, but they were not being resampled.

I looked around for solutions to force the card to resample the audio but didn't find anything that satisfied me. I did notice, however, that the analog portion of the card (cat /proc/asound/card0/codec#0) supported a plethora of samplerates.

All of the resampling options I had found involved using resample libs of varying qualities, essentially forcing the CPU to do the resampling, however I'm certain that the card can do it itself. So I decided to try slaving the hdmi audio off the analog card. I created /etc/asound.conf and entered the following:
Code:
pcm.!default {
    type plug
    slave {
        device "hdmi"
    }
}

I suspect this may be part of your problem with the camera files, since the audio is not 48kHz, however I can't be certain so I will not make any guarantees.

So, with this new asound.conf in place, I went to Settings > System > Audio hardware and changed my analog device back to "default"

The settings for that entire page are as follows:
Output: Analog
AC3 Passthru: off
DTS Passthru: off
Analog device: default
Digital device: iec958
Downmix: enabled

Voila... menu navigation sounds and mp3s played back at the proper speed! Note: I do not know for a fact that the audio card is doing the resampling -- but my CPU usage seems unaffected so, whatever is happening to resample the audio proper, it works and works well.

I hope this works for you and gives you a better understanding of how to look at the features of your audio subsystem.

Also... I recently found that I was getting a lot of "failed to initialize audio" messages after upgrading to jaunty... to fix this I recompiled xbmc from svn and disabled pulseaudio output. Seemed to have fixed my problem there.

Edit: I also always use the AlsaUpgrade script to upgrade ALSA to the latest version instead of the Ubuntu-packaged one, though as long as you're running jaunty, I don't believe this is necessary
Reply
#3
Thanks much for replying!

Currently I have an /etc/asound.conf:

pcm.!default hdmi:NVidia
pcm.iec958 hdmi:NVidia

I don't recall where I grabbed this snippet, but using those config settings finally (after much frustration) provided me audio through HDMI. Regardless I modified the file to:

Code:
#pcm.!default hdmi:NVidia
#pcm.iec958 hdmi:NVidia
pcm.!default {
type plug
slave {
device "hdmi"
}
}

I verified the remaining audio page settings were set as you listed:

Output: Analog
AC3 Passthru: off
DTS Passthru: off
Analog device: default
Digital device: iec958
Downmix: enabled

I could edit some of the options only by first changing the output to digital. Then some of the settings were no longer ghosted. Then I returned the setting to analog.

I rebooted.

No sound at all. I modified the file to:

Code:
pcm.!default hdmi:NVidia
pcm.iec958 hdmi:NVidia
pcm.!default {
type plug
slave {
device "hdmi"
}
}

I again rebooted. Again no sound at all.

I restored the asound.conf file to my original configuration. Sound returned but I again had no audio with my camera movies and had no startup or navigation sounds. Sad

Quote: to fix this I recompiled xbmc from svn and disabled pulseaudio output.
A coincidence that you mention that. After browsing the forum looking for possible answers before posting to this thread, I noticed many issues related to pulse audio. I noticed my build script has that option enabled. I was going to build a new package without that option.
Reply
#4
Thought I would share my working config for hdmi audio off nvidia hardware (Ion platform)

device : default
digital passthrough : hdmi

This config will resample, but also creates a mixer device for two channel
sources. The reason for this is crossfading audio and multiple sounds played at once. This would cause a 'Failed to initialize audio' message without this setup. If your hdmi device is not 0,3 then change it. You can find this information using aplay -a and aplay -A

fyi 'plug' is a alsa software plugin.

Code:
pcm.!default {
    type plug
    slave.pcm "dmixer"
}
pcm.dsp0 {
    type plug
    slave.pcm "dmixer"
}
pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,3"
        #period_time 0
        period_size 1024
        buffer_size 8192
        #periods 128
        rate 44100
     }
     bindings {
        0 0
        1 1
     }
}
ctl.mixer0 {
    type hw
    card 0
}
Reply
#5
woodsman Wrote:Thanks much for replying!

I verified the remaining audio page settings were set as you listed:

Output: Analog
AC3 Passthru: off
DTS Passthru: off
Analog device: default
Digital device: iec958
Downmix: enabled

Before messing around trying to create asound files, why don't you start simple.

If you are using HDMI you should be using Digital as your output. I would suggest starting off with something like this:

Output: Digitial
AC3 Passthru: off
DTS Passthru: off
Analog device: hdmi
Digital device: hdmi
Downmix: enabled

If hdmi doesn't work try iec958 or default.

Once you have audio working as it should be you can look at using asoundrc files to resolve some specific instance problems, but these are fringe cases and shouldn't be your first go to, in fact they can cause more problems than they resolve if everything else isn't setup correctly.
Reply
#6
he'll need at least plug:hdmi for analog
Reply
#7
Quote: Before messing around trying to create asound files, why don't you start simple.
I was thinking much the same thing this afternoon while performing system maintenance on the box in my office.

After some nominal troubleshooting, I believe the problem is the proprietary nvidia drivers. I have not solved the problem per se, but I believe I know the source of the trouble. (I apologize for the following lengthy explanation. I figured the details might help other people in the same situation.)

Some additional info (my apologies for not providing the information in my first post):

I do not yet have a network jack installed in the living room where the HTPC is intended to reside along with the HD TV. Therefore I physically move the box to my office to perform maintenance through my LAN (sync files, update scripts, install patches, etc.). Not that big of a deal right now. Stringing CAT5e is on the to-do list. Smile

When I have my HTPC connected in my office, the box is connected to an Acer X193W+ 19 inch wide 1680x1050 monitor via the DVI-D connector. When in the office I use some typical desktop computer speakers connected to the on-board external audio jack. No sound issues with any app when connected in the office. XBMC, Xine, Kaffeine, SMPlayer, MPlayer, command line tools, etc. all play sound just fine. In XBMC I hear the navigation and startup sounds. Even the digital camera movies play within XBMC with no audio problems. XBMC also seems far more stable when connected in the office.

The audio (and instability) problems begin when connected to the HD TV. When in the living room I have been connecting the HTPC to a 37 inch 1920x1080 LG 37LH40 HD TV via HDMI.

Today I connected my HTPC in my office for some maintenance. Once again, no audio issues.

I finished the maintenance and returned the HTPC to the living room. This time I connected a 3.5 mm male-to-male stereo cable from the on-board speaker connector to the TV audio connector. Although I have been trying to run audio through HDMI, if I correctly understand my TV owner's manual, I should be able to run the video through HDMI and audio through the separate "PC" audio jack.

I booted into run level 3. After logging in, from the console I ran speaker-test to device 0,0 (analog device) and heard the audio through the TV speakers. Similarly, I played a wave file using aplay and again heard the sound. This is what I expected and seemed to confirm the TV owner's manual.

I had all options in /etc/asound.conf disabled (commented out).

I started X/KDE (4.2.4). I opened Konsole and ran the exact same tests. No sound. I could hear the sound only when I changed the device parameters in each command to 0,3 (hdmi device). I didn't understand why there is no sound in X/KDE through the external speaker connection but is fine outside of X/KDE.

Eventually I suspected the proprietary nvidia drivers. I'm running 185.18.31. I cannot run the generic nv driver because the generic driver does not support the MCP78S chip set on my Asus M3N78-EM motherboard. My only remaining choice is hardly a choice: vesa. Nonetheless, as I maintain alternate xorg.conf files for testing purposes, I reconfigured X to use vesa.

Both the speaker-test and aplay audio tests I ran previously ran from both the console (outside of X) and from within Konsole in X/KDE. I became reasonably certain then the audio problems begin with the proprietary nvidia drivers.

My next test was to connect the computer to the TV with the external speaker cable and RGB (D-Bus) video cable. I restored the xorg.conf to use the proprietary nvidia drivers. Once again I experienced no audio problems within or without of X. This is the same result I always experience when I connect with the DVI-D cable.

Seems then the audio problems occur only when using the proprietary nvidia drivers and HDMI.

But vesa or an RGB connector are not long-term solutions. With the RGB cable the display is shifted to the right. With an expensive HD TV as a fancy computer monitor, I am not bold enough to run xvidtune to create a custom mode line. Further, I'd rather send the video through HDMI or DVI-D for better quality.

I don't mind finding a solution to running audio through HDMI. I'm under the impression that might be ideal. If the 3.5 mm cable works then the effect is the same to my ears. Yet the nvidia drivers are stopping audio through the external speaker cable by auto-detecting HDMI and then trying to force audio through that device port.

I'm surfing the web to learn whether I can manually configure nvidia so the video is sent to HDMI but not the audio. I appreciate any help with that. Perhaps I can configure /etc/asound.conf to force audio through the external speakers (device 0/plughw:0,3)?

Another choice is to buy a DVI-to-HDMI converter and use the DVI-D video output from the motherboard. I use the DVI-D connector and external speakers in the office where I experience no audio problems. With that option the nvidia drivers do not try to force audio through HDMI.

Quote: If you are using HDMI you should be using Digital as your output.
Configuring XBMC to use the digital output always results in XBMC terminating abruptly any time I stop playing a video file. Sad
Reply
#8
woodsman Wrote:the nvidia drivers are stopping audio through the external speaker cable by auto-detecting HDMI and then trying to force audio through that device port

Why don't you simply disable HDMI audio in the BIOS then? Wink
Reply
#9
Quote:Why don't you simply disable HDMI audio in the BIOS then?
Hmm. Perhaps that will work. I'm unsure where to change that, but I recall when building the machine I had two different connectors to the motherboard for sound. I think when I find the BIOS location to change the output that I probably have to swap connectors too.
Reply

Logout Mark Read Team Forum Stats Members Help
HDMI Audio Issues0