Kodi Community Forum

Full Version: VLC Server audio getting cut off when XBMC playback begins
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I been wanting a specific feature for some time, and just occurred to me that perhaps I can get most of the way there with an external player. Currently using XBMCbuntu 11.0

Whilst playing a video/video playlist for visual effect, I would like to be able to start playback of an audio playlist, the audio of each would be mixed but I would have independent control of each volume level. On previous installations on top of Ubuntu, I simply minimised XBMC, started Banshee and then used and app on my phone to control it and its volume, then full screen XBMC again and use the normal methods to control that. But that doesn't work with XBMCbuntu (I believe X is running but not Gnome/Freedesktop/etc)

If I set up an external player always to present the Play with... option for audio media, and send that to a non-GUI audio player I was hoping that would do the trick. The additional needs were remote control for tracks/volume/play/pause, 'daemon' mode, etc. In the end the simplest solution seemed to be VLC as long as I kicked it off from a command with additional interfaces (say HTTP), I could queue from XBMC normally with the Play with... option, then control it with a VLC Remote app. It would need to be in the background, not claiming XBMC's focus, and not have any video output/window, which as audio only media it wouldn't need anyway.

It seems that the command line options (and probably modules installed) on Ubuntu's VLC are quite different from the Windows examples I found. But after a bit of bumbling I managed to kick off a VLC 'server' in the CTRL-ALT-F1 console of my XBMCbuntu machine which started listening for HTTP remote control connections. I successfully started playing some music using an Android app and could control it.

However, the moment I started some video playback within XBMC the music cut off (was still apparently playing but the source wasn't getting through). Only after stopping the video playback and restarting the VLC audio did sound come back.

I think I read that XBMCbuntu doesn't use PulseAudio at all and it isn't even installed, so I assuming that both are using ALSA devices. Would this indicate that XBMC is forcibly claiming an ALSA device exclusively for playback? And did it work in my previous Ubuntu installation on the desktop precisely because that did use PulseAudio so the sources were being mixed properly? Either way, is there some way to achieve my ends? It does seem fairly clear this is more a VLC issue than XBMC, but the situation is triggered by XBMC so I assumed I should start here and try to work out why, then perhaps move to the VLC folks and see if there are any command line options for fixing this.

All I have is guess work at the moment based on the very little I know of ALSA, but my thought was I would have to create a new virtual device in the asoundrc file, then use another device ('route' type?) to mix the outputs of the XBMC device and the virtual device before sending it to the real physical device. Even so, I've no clue what impact that will have on my passthru (don't really care if this mixing doesn't work for DTS/DD)

Any advice would be greatly appreciated!
Since XBMC Frodo I'm running into the same problem. I use MPD as a non-gui sound player, because I don't have to switch on the TV. With XBMC Eden the alsa device wasn't claimed only in case of a audio playback.

I deactivated every gui sounds, but nevertheless XBMC blocks the alsa device. That's annoying and should be changed.

Pulse audio isn't an option, cause I prefer bit-perfect sound and had always problems with pulse.
Xbmc stops h0gging the sound device after exactly 10 seconds idle. You can see this in the debug log:
Suspended the Sink
Resume the Sink

if you use streamsilence or something in advancedsettings.xml this stops the sink from unloading, as it is forced to stream silence.
But when you start a video in xbmc won't it clam the alsa device again?
Guys, I'm talking about *mixing* audio, not handing exclusive control back and forward, and this is true of Eden and Fro do, with xbmcbuntu.
Thanks for your experiences of audio device blocking, but unless you are working to find a way of getting xbmc to kick off two media streams simultaneously (one video the other audio), and have both audio outputs mixed and independently controlled, then you'll need to start another thread as it is unrelated to any of my questions.
Yes I know what you are seeking. Have you tied setting up a dmix alsa device and setting it to be the default alsa output?

Alternatively pulseaudio (which is not included in xbmcbuntu, but could be added) may provide the answer.

Also do you really need the ausio from the video file? I understood perhaps you wanted the video as background to the external audio. If you don't need the audio from the video track you could set xbmc to a "dummy" or unused audio device, freeing up the actual device for the external player/audio. However if you need mixing then I think dmix or pulseaudio are the answer.
Thanks nickr! No I haven't tried dmix - very much a beginner on this stuff. Is dmix a mixer device (downmix?) I've read about using it before, but got confused on how it worked. Is the idea that 2 different processes can play audio to it at the same time and it mixes them?

If I can achieve it with ALSA, I'd prefer that approach. No I probably don't need the audio from the video file, but I would like to preserve it if possible. There are circumstances where I would like to be able to change the volume of each independently so I can fade one in and the other out, and back again, as needed.