Page 1 of 1

Streaming synchronized raw audio to multiple clients

Posted: 19 Jul 2012 18:56
by bradvido
I'm using VLC 2.0.2 win32.

I'm attempting to stream audio from a VLC instance (server) to multiple different VLC clients. This is raw audio only (no video). The server and all clients are Windows7.

I believe that UDP will give me the best synchronization, but it's not currently working for me.

Here is my commands i'm using for UDP streaming:

The server:

Code: Select all

vlc.exe --demux=rawaud --rawaud-channels 2 --sout udp:224.1.1.152:1152 -
(the - on the end grabs audio from stdin of shairport4w. This audio plays perfectly in VLC when I remove the --sout option).

The client:

Code: Select all

vlc.exe udp://@224.1.1.152:1152
In the debug console for the client, I see "main stream error: cannot pre fill buffer"

Note: I've also tried using 239.255.12.42 as the multicast IP, but it did not work either (same error).

All firewalls are turned off, but the clients never start playing the udp stream.
The server seems to play it just fine, at least i see the seconds counting up when i start play audio.

Update: The udp streaming works perfectly if I try to stream a .mp3 from the server.
This streams correctly:

Code: Select all

vlc "C:\Users\Public\Music\Sample Music" --sout udp:239.255.12.42
Update2: I am able to successfully stream using the raw audio, but only over http (which isn't providing the synchronous nature i would get from udp)
This streams correctly (using http):

Code: Select all

vlc --demux=rawaud --rawaud-channels=2 - --sout "#std{access=http,mux=asf}"

Re: Streaming synchronized raw audio to multiple clients

Posted: 20 Jul 2012 11:28
by Rémi Denis-Courmont
I would much recommend RTP over raw UDP for multicast raw audio.

UDP generally sucks and does not really work for anything other than MPEG2.

Re: Streaming synchronized raw audio to multiple clients

Posted: 20 Jul 2012 14:12
by bradvido
I am now using RTP, but I need a little help getting it correct. Any suggestions for an ideal music streaming sout command would be greatly appreciated!

The command I'm using to stream the audio is:

Code: Select all

vlc.exe --demux=rawaud --rawaud-channels=2 - --sout "#transcode{vcodec=none,acodec=mpga,ab=128,channels=2,samplerate=44100}:rtp{dst=239.255.12.42,port=5004,mux=ts,ttl=1}"
I connect the client using:

Code: Select all

vlc rtp://@239.255.12.42:5004
The problem is that the client does not play the stream smoothly, it keeps dropping in an out and stuttering.

The reason i'm using transcode is because the client would not connect when I didn't transcode.
When I try to stream without transcoding using this command:

Code: Select all

vlc.exe --demux=rawaud --rawaud-channels=2 - --sout "#rtp{dst=239.255.12.42,port=5004,ttl=1}"
I get this error on the client: SDP required:
A description in SDP format is required to receive the RTP stream. Note that rtp:// URIs cannot work with dynamic RTP payload format (96).
Note, I've also tried mp3 as the acodec, but this did not improve stream quality.

The stream plays perfectly at the server if I don't try and stream it to clients.

Re: Streaming synchronized raw audio to multiple clients

Posted: 20 Jul 2012 14:53
by Rémi Denis-Courmont
Raw audio is s16b at 44100Hz. Anything else requires an SDP.

Re: Streaming synchronized raw audio to multiple clients

Posted: 20 Jul 2012 15:12
by bradvido
Raw audio is s16b at 44100Hz. Anything else requires an SDP.
Thanks for your quick reply.

So would I modify my command like so?

Code: Select all

vlc.exe --demux=rawaud --rawaud-channels=2 --rawaud-samplerate=44100 - --sout "#rtp{dst=239.255.12.42,port=5004,ttl=1}"