pedroSG94 / RTSP-Server

Plugin of rtmp-rtsp-stream-client-java to stream directly to RTSP player.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Realtime RTSP ( connection lag behind 2s)

Ctrl-X opened this issue · comments

Hi Pedro,

First it's an amazing library, quiet easy to use and really clean !

I'm trying to achieve a real time connection between an android device and VLC on LAN. But no matter what tweak or adjustment on bitrate,res, iFrameInterval, or else... it seems that we always have around 1.7s and 2s lag between emitter and receiver. I think a sub second lag should be realistic on gigabit local network no ?

The congestion flag is always False. Even with everything low, still having the 2s lag. RtspServerCamera1 or RtspServerCamera2, with or without OpenGlview, no preview. Nothing seems to change the lag.

Maybe I'm missing something...

I'm bumping my head with this, so could you point me toward some options or if not achievable, could you explain why do we have that lag ?

I greatly appreciate your work !

Hello,

My library can add delay but it is the time that the device need to process and send the data (it is close to 0). I'm not adding any artificial buffer, my buffer only is used if you have internet problems, but it isn't the case using a LAN.

Around 2s is the normal latency using this type of protocols because players and servers normally have a buffer.
It is the case for VLC that contain around 1-2s of buffer using RTMP and RTSP (you can change it but sometimes it is ignored or working bad).
Using other players you can reduce it but never get totally realtime like using other procotol (like WebRTC that is used in vodIP calls).
Anyway you can use ffplay player that can be configured to reduce the buffer close to 0. Using this command you can get around 0.5s of delay:
pedroSG94/rtmp-rtsp-stream-client-java#1064 (comment)
In this post you can see the delay difference using ffplay by default or configured with nobuffer that I think is the problem in your case using VLC. You can try install ffplay and test it to discard that VLC produce the delay with the buffer.

Thank you really much for you quick answer. So I'm not doing anything wrong ;)

I'll take a look at ffplay to see the delay. If not OK, I will try WebRTC !

Thanks !