phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.35k stars 1.43k forks source link

Huge latency - around 15 seconds #390

Open kalwinskidawid opened 2 years ago

kalwinskidawid commented 2 years ago

Hey, At the outset, I will say that I am trying to establish a connection via websocket and rtsp. I use forked node-rtsp-stream. I have problem with huge latency about 10-15 seconds. I came to the conclusion that ffmpeg is to blame. My observations: When I use ffmpeg -rtsp_transport tcp -fflags discardcorrupt -f mpeg1video -i rtsp://{id-address} - at the start there is a delay of about 8-6 seconds after which the stream gently accelerates and finally the delay is on the level of 1-2sec. However with the newest version of jsmpeg I get on frontend only jsmpeg possible garbage data. skipping

When I use ffmpeg -rtsp_transport tcp -fflags discardcorrupt -i rtsp://{id-address} -f mpegts -codec:v mpeg1video -b:v 1000k -bf 0 - I have a latency of about 18-10 seconds at startup and I can't go below that even if I try to speed up the whole stream with startup arguments

What's wrong?