RootEncoder icon indicating copy to clipboard operation
RootEncoder copied to clipboard

How to reduce streaming delay

Open aimaicai opened this issue 4 years ago • 2 comments

hi, thanks for your great work. I am using your library for an android design. I can successfully stream to an rtsp server. The problem is that I have 4-5 seconds of latency, even with a local network. I also tried to compile your application with demos and I get the same result. I tried to play with the encoder parameters, but didn't get any changes. Before using your library, I tried to use ffmpeg directly to the same rtsp server and with that I have a maximum of one second delay. Did they match what you expect? Do you have any advice on how to reduce latency, even at the cost of quality? Thanks a lot.

aimaicai avatar Nov 09 '21 11:11 aimaicai

I haven't this latency on local network. I'm not using any cache or buffer to increase latency so it is a combination of:

  • Device speed (time from the frame is created to the frame is send to server)
  • Network delay (in this case local so it is close to 0)
  • Server
  • Player

Player used: ffplay Device used: Openplus 7T

https://github.com/aler9/rtsp-simple-server First server. Using OpenGl RTSP example (2,4s): rtsp2

https://github.com/EasyDarwin/EasyDarwin Second server. Using OpenGl RTSP example(2s): rtsp3

Keep in mind that it is not a totally real time protocol. 5s is fine

pedroSG94 avatar Nov 09 '21 13:11 pedroSG94

Thank you for the reply. For my test I'm using rtsp-simple-server as server, ffplay as player and a redmi note 7 as device. It's quite less poweful than your phone, maybe the bottleneck is here. Thanks again

aimaicai avatar Nov 09 '21 17:11 aimaicai