mpromonet / v4l2rtspserver

RTSP Server for V4L2 device capture supporting HEVC/H264/JPEG/VP8/VP9
The Unlicense
1.83k stars 423 forks source link

How to reduce latency? #189

Closed rmokerone closed 3 years ago

rmokerone commented 4 years ago

Thanks to the author, this project is great! I try to use H264's UVC camera as a video capture device, run the program on the ARM development board, when using ffplay for video playback on my laptop (the cache has been set to 0), the playback delay is about 800ms. It is known that the UVC camera is directly connected to the computer for playback, with a delay of about 200ms. I would like to ask, is there any way or idea to reduce the delay as much as possible.

mpromonet commented 4 years ago

Hi @rmokerone, The problem of latency is not an easy one, the first thing is to established latency of each layer (capture, processing, network sending, network transport, network recieving, uncompressing, display). It is easy to measure the overall latency capturing the screen that display a counter, but getting each latency is far more difficult. v4l2rtspserver just read v4l2, look for SPS/PPS, post to a queue and the queue is read and send frame to live555. It may have some latency queuing/dequeing, using StreamReplicator to serve multiple clients I think the first thing, if your board have a display, is to try with loopback network, to measure the network impact.

Best Regards, Michel.