[FFmpeg-user] FFMpeg Streaming via UDP

Andy Furniss adf.lists at gmail.com
Thu May 5 18:38:36 CEST 2016


Bogdan Mariesan wrote:
> Hi Andy,
>
> Sorry for the fuss, my email client added the http part... that was
> not intended there.

OK, maybe from an ffmpeg users pov it would be best to test on a lan
without the hole punching code just to see if that part works.

> On the client side I am using Java to run the FFMpeg process and in
> Android using IJKPlayer to play the stream. I've added pastebin links
> since it keeps the code well formatted. Client side -
> http://pastebin.com/bkajPR5Q Server used to achieve the UDP hole
> punching - http://pastebin.com/vEGdw3QF Android -
> http://pastebin.com/gpUUQyjG

Missing / on line 38.

I am far too lazy to check if the ports are reversed properly etc - If I
were doing this I would be looking at tcpdumps to check.


> UDP hole punching is the mechanism through which you can establish
> P2P connections when your devices are behind routers, secure NATs
> etc. where a direct connection between the devices would be
> impossible. This can be achieved by having both devices connect to a
> public ip server via UDP. When the connection is to the server is
> done, on both devices public and private UDP ports are open by the
> NAT. Then a direct connection can be established using the public IPs
> of the routers of the two devices by specifying the public and
> private(local) ports on both sides. Hope i made it clear.
>
> So basically I'm opening a P2P connection between the two devices.
>
> The IPs reported by my UDP hole punching server are below (i've
> changed them a bit for security reasons):

OK, maybe it should work "normally" though I don't think it would be
robust with multiple clients behind the same nat as the ffmpeg server is
a different connection from the middle server so the sports could in
theory get changed.

In the UK I think 3g/4g providers do carrier grade nat - I don't know
if/how that would affect things.

>
> My laptop running FFMpeg which sits behind a router 5.2.66.19-56190
>
> My Android phone using 3G/4G 109.55.132.187-52547
>
> And the log generated by FFMpeg is: http://pastebin.com/fyzyk9X1
>
> Hope it makes more sense now.
>
> Kind regards, Bogdan


More information about the ffmpeg-user mailing list