Low Latency camera capture with FFmpeg on Linux
A couple of students from my school’s robotics club and I have been working on a robot for this year’s RoboCup’s Rapidly Manufactured Robot Challenge.
The only view robot operators can have of the arenas are the robot’s own cameras. We have been using
FFmpeg for camera capture, but it’s had terrible latency issues. The
documentation doesn’t mention anything about
reducing latency. Setting -fflags nobuffer
as written in
this SO answer combined with specifying
-input_format
(not needed if the default format is high enough FPS,
check v4l2-ctl --list-formats-ext
)
yields the lowest latency possible, only limited by hardware capabilities:
ffplay -fflags nobuffer -input_format mjpeg /dev/video0
Hopefully I’ve saved you some headache. :D