Playing Multicast UDP

3,520 views
Skip to first unread message

pshmo

unread,
Apr 29, 2009, 7:02:43 PM4/29/09
to xuggler-users
I have a VLC server pushing out an MPEG2 file over Multicast UDP.

I have verified using VLC as the player that there are no network
issues, i.e. I can play it on other machines using VLC.

I am not however, able to play using my Xuggler player as the client.
I am thinking I do not understand what container.open is expecting. I
am able to play standard UDP streams, just not multicast.

Thanks for any help

Art Clarke

unread,
Apr 29, 2009, 7:21:51 PM4/29/09
to xuggle...@googlegroups.com
Hi There,

Yikes; I haven't really played with UDP multicast and ffmpeg; Are you able to create an ffmpeg process that can read the data (with the right .sdp file)?  If not, you'll need to get that working first -- we just forward on to ffmpeg for all UDP handling stuff.

- Art
--
http://www.xuggle.com/
xu‧ggle (zŭ' gl) v. To freely encode, decode, and experience audio and video.

Use Xuggle to get the power of FFMPEG in Java.

pshmo

unread,
Apr 30, 2009, 10:46:11 AM4/30/09
to xuggler-users
Yea Art I think I told you before that we're pretty Old School with
our video processsing. Its a problem I am trying work through, and
that starts with using Xuggler.

To my knowledge multicast udp does not utilize an sdp file.

To receive a standard udp stream in Xuggler I pass "udp://@?
localport=XXXX" to container.open and everything works great. For VLC
client to receive multicast udp you simply give it "udp://
xxx.xxx.xxx.xxx: and it plays whatever comes over that pipe. So,
that's what I tried to do in Xuggler but it didn't work.

I did some searching of ffmpeg site, and found a reference to "?
multicast=1", but when I tried to use that it had no effect. I also
saw a post saying that was the "old" way of doing it, and there is
apparently a "new" way, but I was not able to discover what this new
way was.

So, I am posting here in the hope that someone will just know the
answer off the top of their head.

Thanks.

Art Clarke

unread,
Apr 30, 2009, 11:00:12 AM4/30/09
to xuggle...@googlegroups.com
Sorry, I don't know off the top of my head.  Anyone else?

You could check the code of captive/ffmpeg/csrc/libavformat/udp.c for hints?

- Art

pshmo

unread,
May 3, 2009, 1:36:16 PM5/3/09
to xuggler-users
Found the answer, but I'm not sure I like it.

udp://@xxx.xxx.xxx.xxx:xxxx?multicast

The thing I don't like about it is the need to provide a port. If I
set up my VLC multicast ip, why do I need a port? It should be that I
just listen to the multicast ip and the port is not relevant. Anyway I
found out that VLC will default it to 1234, so thats nice.

Also the "?multicast" had me confused because in the ffmpeg udp.c code
it always refers to multicast=1, so I kept trying to say "?
multicast=1".

In anycase I am multicast UDPing MPEG2s so life is good. Now if I
could just extract the KLV I could die happy.

On Apr 30, 10:00 am, Art Clarke <acla...@xuggle.com> wrote:
> Sorry, I don't know off the top of my head.  Anyone else?
>
> You could check the code of captive/ffmpeg/csrc/libavformat/udp.c for hints?
>
> - Art
>
>
>
>
>
> On Thu, Apr 30, 2009 at 7:46 AM, pshmo <psh...@yahoo.com> wrote:
>
> > Yea Art I think I told you before that we're pretty Old School with
> > our video processsing. Its a problem I am trying work through, and
> > that starts with using Xuggler.
>
> > To my knowledge multicast udp does not utilize an sdp file.
>
> > To receive a standard udp stream in Xuggler I pass "udp://@?
> > localport=XXXX" to container.open and everything works great. For VLC
> > client to receive multicast udp you simply give it "udp://
> > xxx.xxx.xxx.xxx: and it plays whatever comes over that pipe. So,
> > that's what I tried to do in Xuggler but it didn't work.
>
> > I did some searching of ffmpeg site, and found a reference to "?
> > multicast=1", but when I tried to use that it had no effect. I also
> > saw a post saying that was the "old" way of doing it, and there is
> > apparently a "new" way, but I was not able to discover what this new
> > way was.
>
> > So, I am posting here in the hope that someone will just know the
> > answer off the top of their head.
>
> > Thanks.
>
> --http://www.xuggle.com/
> xu‧ggle (zŭ' gl) v. To freely encode, decode, and experience audio and
> video.
>
> Use Xuggle to get the power of FFMPEG in Java.- Hide quoted text -
>
> - Show quoted text -

Art Clarke

unread,
May 3, 2009, 5:35:47 PM5/3/09
to xuggle...@googlegroups.com
Good find!  I updated the Tips and Tricks page:
http://wiki.xuggle.com/Tips_and_Tricks

- Art
--

Stas Oskin

unread,
May 6, 2009, 6:13:52 AM5/6/09
to xuggle...@googlegroups.com
Hi.

Thanks for sharing - I stumbled with this issue as well!

So SDP should be used for unicast playback, and this form should be used for multicast?

Regards.

2009/5/3 pshmo <psh...@yahoo.com>

Stas Oskin

unread,
May 7, 2009, 3:22:51 PM5/7/09
to xuggle...@googlegroups.com
Hi.


Found the answer, but I'm not sure I like it.

udp://@xxx.xxx.xxx.xxx:xxxx?multicast

The thing I don't like about it is the need to provide a port. If I
set up my VLC multicast ip, why do I need a port? It should be that I
just listen to the multicast ip and the port is not relevant. Anyway I
found out that VLC will default it to 1234, so thats nice.

Also the "?multicast" had me confused because in the ffmpeg udp.c code
it always refers to multicast=1, so I kept trying to say "?
multicast=1".

In anycase I am multicast UDPing MPEG2s so life is good. Now if I
could just extract the KLV I could die happy.

Any idea if this should work with binary FFMPEG?

I tried both ffmpeg and ffplay with the following syntax:

ffplay udp://@224.1.1.1:4444?multicast
ffmpeg udp://@224.1.1.1:4444?multicast

But nothing seems to be decoded or displayed

Any idea?

Thanks!

Art Clarke

unread,
May 7, 2009, 3:55:13 PM5/7/09
to xuggle...@googlegroups.com
On Thu, May 7, 2009 at 12:22 PM, Stas Oskin <stas....@gmail.com> wrote:
Any idea if this should work with binary FFMPEG?

If it works with Xuggler it should work with FFMPEG

I tried both ffmpeg and ffplay with the following syntax:

ffplay udp://@224.1.1.1:4444?multicast
ffmpeg udp://@224.1.1.1:4444?multicast

I'm getting the sense I should spend more time on RTP :)  Alas, not this week.

- Art

--

Stas Oskin

unread,
May 8, 2009, 4:20:23 AM5/8/09
to xuggle...@googlegroups.com
Hi.


If it works with Xuggler it should work with FFMPEG

Unfortunately it's not. VLC works great, FFMPEG doesn't show/decode anything.

The source is MPEG-2 multi-casting appliance.

Pshmo, perhaps you could run the FFMPEG binary in the below fashion, and let me know that it works in your case?

ffmpeg -i udp://@224.1.1.1:4444?multicast


I'm getting the sense I should spend more time on RTP :)  Alas, not this week.


It might a be a good idea  :).

Regards.

pshmo

unread,
May 10, 2009, 10:43:54 AM5/10/09
to xuggler-users
Hey dudes,

> > If it works with Xuggler it should work with FFMPEG

Not always

> Unfortunately it's not. VLC works great, FFMPEG doesn't show/decode
> anything.
>
> The source is MPEG-2 multi-casting appliance.

Stas, For the record I have not tried to do anything dealing with
hardware, but that maybe coming up for me and so I may come begging
you for info later on.

>
> Pshmo, perhaps you could run the FFMPEG binary in the below fashion, and let
> me know that it works in your case?
>
> ffmpeg -i udp:/...@224.1.1.1:4444?multicast
>

This seemed to work okay for me. I set up VLC to multicast on the
IP:PORT given, and was able to play it through Xuggler code and
ffplay. Also ffmpeg recognized the stream and just complained because
I didn't specify an output. So, my conclusion is that we have the
commandline correct.

I couple of things to look at:
First off, I don't know why the forum says udp:/...@ when it should
read "udp://@"

If thats not the problem, you could have a network issue, because I
had to figure this out as well. Most networks, especially corporate
networks, do not allow multicasting by default. I had to go to our IT
guys to get it turned on and the gave me a specific ip that I was
allowed to multicast on.
At home, I have a Linksys wireless, and I had to go into the the admin
page, somewhere in the security section, and turn off multicast
filtering. Once I did that, everything just started working and I
recall doing a short victory dance around the room.

Another thing I discovered is that when you try to do multicasting
from the VLC GUI it is flakey at best, so I recommend using the
command line interface. Here is the commandline I am using with your
ip/port: "vlc -vvv video1.xyz --sout udp:224.1.1.1:4444 --ttl 12"

One last thing, udp multicast is about as primitive as you can get,
and I do not think you will be able to specify an SDP file, at least I
was not able to.

> > I'm getting the sense I should spend more time on RTP :)  Alas, not this
> > week.
>
> It might a be a good idea  :).
>

May I suggest KLV data streams instead :)

Good luck Stas, I think these details are the kind of things we are
just going to have to work through and get posted on the Xuggler Wiki,
because I am not finding this stuff posted anywhere, and am having to
decipher the answers from the ffmpeg code directly.

Stas Oskin

unread,
May 11, 2009, 6:25:23 AM5/11/09
to xuggle...@googlegroups.com
Hi.


This seemed to work okay for me. I set up VLC to multicast on the
IP:PORT given, and was able to play it through Xuggler code and
ffplay. Also ffmpeg recognized the stream and just complained because
I didn't specify an output. So, my conclusion is that we have the
commandline correct.

In my case it just hangs on for a really long time, and sometimes shows some errors.
 

I couple of things to look at:
First off, I don't know why the forum says udp:/...@ when it should
read "udp://@"

Indeed, this was the original form, without the ...
 

If thats not the problem, you could have a network issue, because I
had to figure this out as well. Most networks, especially corporate
networks, do not allow multicasting by default. I had to go to our IT
guys to get it turned on and the gave me a specific ip that I was
allowed to multicast on.

VLC works fine though, so it doesn't seems as network issue. Perhaps FFMPEG not 100% compatible with ranges, of what VLC can read.
 

Good luck Stas, I think these details are the kind of things we are
just going to have to work through and get posted on the Xuggler Wiki,
because I am not finding this stuff posted anywhere, and am having to
decipher the answers from the ffmpeg code directly.

I actually thinking to adapt some of VLC parts to Xuggler, especially the ones responsible for RTP/RTSP reading.

Not sure what amount of effort or time this may require.

Regards.

pshmo

unread,
May 15, 2009, 9:21:20 AM5/15/09
to xuggler-users

>
> I actually thinking to adapt some of VLC parts to Xuggler, especially the
> ones responsible for RTP/RTSP reading.
>
> Not sure what amount of effort or time this may require.

I think it depends upon what you are trying to do, but I think it
would be awesome to have a stand alone streaming player (like vlc) but
based upon java and xuggler, especially if it have an easy to use API.
I mean Red5 is cool, and would be a good starting point, but it just
doesn't handle the types of operations that I am concerned about.
Namely KLV encoded MPEG-2 over multicast udp. Although lately we have
been getting requests for RTSP as well.

Anyway I use VLC allot, and if you did write a java based API with VLC
capabilties you would definitely have have me as a user.
Reply all
Reply to author
Forward
0 new messages