kig / rpi-car-control

Wire a Raspberry Pi up to an RC car and drive it from a web page with FPV video
16 stars 1 forks source link

raspvid or raspvid_mjpeg_server - buffer problem #1

Open dawidteo opened 2 months ago

dawidteo commented 2 months ago

Hello,

thank You for this great project for home fun. ;) I have a problem and don't know how to fix it. When for some reason the connection speed drops below the set bitrate for a few seconds, no frame is skipped, which generates terrible delays and makes it impossible to control the car because I have to wait until all the frames from the buffer are loaded. Is it possible to reduce the buffer size, e.g. to 1 frame, so that the video is always realtime?

best regards Dawid

kig commented 2 months ago

This would be caused by the video sender pushing all the frames to the TCP socket.

I don't know if it would help to rewrite raspivid_mjpeg_server to wait for each socket to finish writing the currently sending frame, and then send the latest frame.

If not, making the video stream work so that the browser pulls the latest frame from the server would get around this.