Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to stream the live output of the soundcard from our 12.04.1 LTS amd64 desktop to a DLNA-compliant external device in our network? Selecting media content in shared directories using Rygel, miniDLNA, and uShare is always fine - but so far we completely failed to get a live audio stream to a client via DLNA.

Pulseaudio claims to have a DLNA/UPnP media server that together with Rygel is supposed to do just this. But we were unable to get it running.

We followed the steps outlined in live.gnome.org, this answer here, and also in another similar guide.

As soon as we select the local audio device, or our GST-Launch stream in the DLNA client Rygel displays the following message and the client states it reached the end of the playlist:

(rygel:7380): Rygel-WARNING **: rygel-http-request.vala:97: Invalid seek request

This is how we configured GST-Launch in rygel.conf:

mypulseaudiosink-title=Audio on @HOSTNAME@
mypulseaudiosink-launch=pulsesrc device=<device> ! wavpackenc

For <device> we tried with the default sink name, this name appended with .monitor, and in addition with upnp-sink and upnp.monitor that was created when we selected DLNA media server from paprefs. We also tried to encode using lamemp3enc with no luck.

Did we miss any other additional configuration needed to get this running? Are there any other alternatives for sending the audio of our soundcard as live stream to a DLNA client?

share|improve this question
Can you avoid DLNA streaming with your receiver device? My solution is to pass the pulseaudio stream over HTTP, see more here: sandalov.org/blog/1441 –  DmitrySandalov Oct 31 '12 at 21:36
Sorry, no, I really do want DLNA to work because DLNA only is widely implemented on various clients (TVs, AV-receivers, Blueray players, etc.). –  Takkat Oct 31 '12 at 22:03
Takkat, the solution I am talking about solved the problem of streaming to my AVR. If you really want to launch a DLNA server, I had a positive experience with rygel+pulseaudio on 12.04 (after 'pacmd load-module module-http-protocol-tcp'), on 12.10 I received the same 'Invalid seek request' warnings. –  DmitrySandalov Nov 1 '12 at 6:54
@DmitrySandalov: it would be really cool if you shared details on how you succeeded to set up Rygel to live stream the pulseaudio output. –  Takkat Nov 1 '12 at 9:40
add comment

4 Answers

Pavucontrol is the missing item in this jigsaw puzzle! I had also set up everything correctly and the external device(LG TV) was showing that the sound was being played but I did not hear any sound. Today I installed pavucontrol and when I opened it I found the option to channel sound through the DLNA server. The DLNA option is only shown when there is sound output from a player to pulseaudio. enter image description here

share|improve this answer
Thank you for sharing this. How did you set up the DLNA server? For me atm Rygel quits with rather unhelpful segfaults. –  Takkat Dec 22 '12 at 14:31
I have just normal settings. I followed the same link as you have mentioned in your post.[GstLaunch] enabled=true launch-items=audiotestsrc; audiotestsrc-title=Desktop Live Streaming! audiotestsrc-mime=audio/mpeg audiotestsrc-launch=pulsesrc device=upnp.monitor ! lamemp3enc target=quality quality=6 –  jumbli Dec 22 '12 at 16:10
Weird. With Rhythmbox the segfaults have disappeared but I still only get Invalid seek request from Rygel. Media directories are there but my GST-stream is always EOF. –  Takkat Dec 22 '12 at 16:50
add comment

I'm sorry I can't help you with Rygel at all, but there may be an alternative which may work for you.

The principle is get a program to record the stream to an audiofile, then launch miniDLNA with a custom config which points to the directory that stream is in.

Example: Say we're working in ~/stream/. Create ~/stream/minidlna.conf

friendly_name=Live Audio Stream

Then save the stream to an audiofile in that directory. Googling for "FFmpeg record sound card audio" yielded this command

ffmpeg -f alsa -i default -acodec flac ~/stream/OutputStream.flac

but I didn't have much luck with it. Another option is vlc is you have a GUI available and this doesn't work.

Then boot up miniDLNA in another terminal window:

minidlna -d -f ~/stream/minidlna.conf -P ~/stream/minidlna.pid

It should locate OutputStream.flac and then be accessible from your network device.

Hopefully if you haven't already got it solved that's given you a few ideas.

share|improve this answer
Promising approach - thank you - but it needs further refinement. With a quick test with miniDLNA today I couldn't get the stream file recognized by my DLNA client. In addition the streams produced by ffmpeg seem to be rather poor (static noise). I'm at it and let you know. –  Takkat Oct 16 '12 at 21:02
So far we are able to generate a flac or mp3 audio file from the audio sink with ffmpeg or avconv. However this file will not be recognized by miniDLNA unless we quit recording. Thenafter we can open this file again on the DLNA client while recording another instance but the stream always starts from the beginnning of the recording and stops at the time it was when we started listening on the client. Any ideas how to overcome this? –  Takkat Oct 27 '12 at 15:32
So, do you mean once you've broken off the ffmpeg process to stop recording, only then is the file recognized by miniDLNA? Also, is the audio quality any better? I'll try it out on my machine and see if I can get it going again. (I had something similar working last year for transcoding movies on the fly) –  mtdevans Oct 27 '12 at 16:34
Yeah in the first place. Second time I can acess it from the client but it starts from the beginning (i.e. whenever I started recording) and stops in the middle (ie. after exactly the time between start recording and start receiving on the client). Audio is fine now, had to disable duplex. –  Takkat Oct 27 '12 at 16:37
add comment

One idea I had to stream "what I hear" to a DLNA renderer (like WDTV) was to server the stream with VLC as http stream with pulse://alsa_output.xxx.monitor as input and transcode it to MP3 or FLAC. Then I wanted to use some DLNA control point to let the renderer play taht stream. VLC does serve the transcoded stream correctly, but it does not allow to set the mime type, so the renderer refuses to play it.

The next idea was to write a http server in python that serves the stream instead. It gets the audio stream from pulse with parec, encodes it with flac (or lame or whatever you want) and sets the mime type correctly.

It works with the following (very simple) script:


import BaseHTTPServer
import SocketServer
import subprocess

PORT = 8080
# run "pactl list short |grep monitor" to see what monitors are available
# you may add a null sink for streaming, so that what is streamed is not played back locally
# add null sink with "pactl load-module module-null-sink"
MONITOR = 'null.monitor'
MIMETYPE = 'audio/flac'
ENCODER = 'flac - -c --channels 2 --bps 16 --sample-rate 44100 --endian little --sign signed'
BUFFER = 65536

class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_HEAD(s):
    print s.client_address, s.path, s.command
    s.send_header('content-type', MIMETYPE)
def do_GET(s):
    pa = subprocess.Popen('parec -d {} | {}'.format(MONITOR, ENCODER), shell = True, bufsize = BUFFER, stdout = subprocess.PIPE)
    while True:
        data = pa.stdout.read(1024)
        if len(data) == 0: break
    print 'stream closed'

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "listening on port", PORT

except KeyboardInterrupt:


Adjust the parameters, run it, and point the DLNA renderer to your machine. It worked for me with a WDTV as renderer and an Android phone with BubbleUPnP as control point (You can type in the stream URL when adding a new item to the playlist manually). But it should work with any DLNA compliant devices.

share|improve this answer
add comment

Not sure if this is will be useful for you now, but I written a post about getting this to work on Ubuntu 12.10:


share|improve this answer
Thank you for sharing this - its exactly what so far always failed with me. From this site's design we'd like to encourage you to outlined the steps you took (in addition to just posting the link to your blog) because links may disappear over time thus leaving your answer useless. I'll get back to you as soon as I was able to test this. –  Takkat Nov 7 '12 at 7:27
Here's my observations so far: Following your guide crashes Rygel with SEGFAULT when selecting the audio stream from the client in 12.04. In 12.10 we are unable to create a stream with GST-Launch. Anything missing? –  Takkat Nov 8 '12 at 11:41
The question was about 12.04 and this answer is for Ubuntu 12.10, otherwise I'd vote it up. :) –  jdthood Nov 28 '12 at 15:24
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.