geeksville / Micro-RTSP

A RTSP video server intended for very small CPUs (ESP32 etc)
MIT License
755 stars 199 forks source link

Have some seconds delay. #13

Open mikelcq opened 5 years ago

mikelcq commented 5 years ago

Hi Kevin,

Nice work! I had a chance to add this to ESP-Who project, just testing for the CAM streaming via UDP. I put the rstp request reading (on rstp port ) in a separate (freertos)task, and VLC plays well. One problem is that there's a 2 or 3 seconds delay, but the view is clear and smooth. I checked the overall time for one frame sending (actually rtsp.broadcastCurrentFrame()), about less than 100ms (about 60~80ms as I remember) in 640x480 res. I'm figuring out what's the root cause, because it should be no delay and better than the httpserver's TCP streaming example(in ESP-Who),which has no delay. Appreciate any help, thanks!

Mike

geeksville commented 5 years ago

hmm - I'm not sure what the latency is in the camera chip (which does the JPEG compression), but I think about 300ms. That wouldn't explain 2 secs though.

bartlomiejcieszkowski commented 4 years ago

after doing some digging i found why there was a delay

it wasn't caused by the esp - cause let's think for a second - If the processing would be consuming too much time - we would see dropped frames, but with the delay - where would the esp store 2-3 second of a buffer ? ;)

it was .. VLC vlc_rtsp_delay

change the value to 0 and it should help (also the VLC doesn't remember changes to cache, so if we select address from a list - it will have value set to a default 1000 -_- )

geeksville commented 4 years ago

Great info! If you have time and are willing could you add this note to readme.md? Others have asked about it. I'd eagerly accept a pull request.

(Sent from a phone - please ignore typos)

On Sat, Jan 4, 2020, 13:44 Bartłomiej Cieszkowski notifications@github.com wrote:

after doing some digging i found why there was a delay

it wasn't caused by the esp - cause let's think for a second - If the processing would be consuming too much time - we would see dropped frames, but with the delay - where would the esp store 2-3 second of a buffer ? ;)

it was .. VLC [image: vlc_rtsp_delay] https://user-images.githubusercontent.com/11327694/71771926-c81e5700-2f42-11ea-9bbf-184cf9d25175.PNG

change the value to 0 and it should help (also the VLC doesn't remember changes to cache, so if we select address from a list - it will have value set to a default 1000 -_- )

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/geeksville/Micro-RTSP/issues/13?email_source=notifications&email_token=AABXB2LYIIUR5HXNV6LMB5DQ4D7K5A5CNFSM4HT5TXK2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIDA6NY#issuecomment-570822455, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABXB2L64JSY7CJC3MPSPQLQ4D7K5ANCNFSM4HT5TXKQ .

Net-time commented 4 years ago

You can change the Vlc cache permanently in advanced settings, usually you should not go below 300 unless you have a very stable network.

DoinStuff35 commented 4 years ago

Thanks for the Info! Did help a lot. But still have a ~1sec. delay on RTSP via VLC with 0ms Caching. HTTP works fine, no delay.

Any Ideas?

Net-time commented 4 years ago

First of all the HTTP version is not actually a stream it is separate single jpeg images so quite easy to encode and send. RTSP is another beast and not sure if the ESP is capable of shortening the delay.