Jump to content

Question about excessive latency added by RTMP protocol on local network vs on localhost

18358414

  What I'm doing: I'm trying to stream data via ffmpeg to ffplay via the rtmp protocol (later, ffplay will be replaced with a service that only accepts rtmp data, but for now I'm trying to root out why there's high latency). 

What I'm getting: if I run

ffmpeg -re -i input.flv -c:a copy -c:v copy -rtmp_live live -f tee -map 0 "[f=flv:rtmp_live=live]rtmp://localhost/ffplay/live"

and, on localhost, I also run

ffplay -i rtmp://localhost/live -f flv -listen 1 -fflags -nobuffer -analyzeduration 1

I get a latency of between 1 to 3 seconds (which I determine to be reasonable).  If, however, I run this same command on another machine on the network, replacing `localhost` with `otherhost`, the latency is 20-25 seconds.  I expect a little bit more latency over the network in general, but 25 seconds seems like a big step.  iperf shows the network connection to be perfectly capable of sustaining 996MBPS between the machines, and the ping is 0.272ms on average (average of 100 pings) with no packet loss.  This occurs whether I use ffplay, vlc, mpv, or any other video player, so it doesn't seem to be software-specific (unless ffmpeg is introducing additional latency when not using localhost).  What is causing the extra delay when using otherhost, and how do I reduce that?

If I have to explain every detail, I won't talk to you.  If you answer a question with what can be found through 10 seconds of googling, you've contributed nothing, as I assure you I've already considered it.

 

What a world we would be living in if I had to post several paragraphs every time I ask a question.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×