Reduce video stream lag
See original GitHub issueCurrently, the lag is between 0.8s and 1.20s using ustreamer.
I recommend swapping it out with mjpg-streamer. As the HDMI-to-USB dongle is providing video in mjpeg format, mjpg streamer can stream it with notably lower lag. From my tests, i would say it is bellow 0.2s. Can you please check?
Installation steps for standalone server:
sudo apt update
sudo apt upgrade
sudo apt-get install build-essential libjpeg8-dev imagemagick libv4l-dev cmake git
mkdir ~/mjpg-streamer
cd ~/mjpg-streamer
git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental
make
sudo make install
Start the video stream server by running:
/usr/local/bin/mjpg_streamer -i "input_uvc.so -f 30 -r 1920x1080" -o "output_http.so -w /usr/local/share/mjpg-streamer/www"
Yes, I was running it at 1080p at 30 fps. Didn’t see any lag between my local and browser stream.
The stream runs on http://raspberrypi:8080/?action=stream
I played around with it for a bit and it seems to perform MUCH faster then ustream with nginx proxy.
Issue Analytics
- State:
- Created 3 years ago
- Comments:26
Top GitHub Comments
Thanks for measuring! I removed those parameters in the latest ansible-role-tinypilot:
From what i gathered, removing these two seemed to be the key in reducing latency.
As you said,
--format jpeg
overrides--encoder hw
and ignores-q 100
so keeping or removing them should not matter.This is the current setting and even with nginx proxy, the latency is well bellow 200ms over 5Ghz WiFi compared to 1000ms from before.