Capture frames from a WebCam
Capture images from Webcam
Here we have a WebCam (Insta360 One-R with 4K camera mod) presenting itself as /dev/video1 on a Raspberry PI
To capture images every 10 seconds we can use:
1ffmpeg -f v4l2 -i /dev/video1 -r 1/10 out%08d.jpg
Here -i /dev/video1
is the camera's device,
-r 1/10
is the capturing framerate, 1 in every 10 seconds
and out%08d.jpeg
is the filename for each frame generated.
Parameter | Description |
---|---|
-f v4l2 | Tell ffmpeg we are reading from v4l2 (Video For Linux 2) |
-i /dev/video1 | The V4L2 device of the camera to capture from |
-r 1/10 | The frame rate |
out%08d.jpg | The frame filename to write. |
Here the frame rate is the capture rate in frames per second. So 1/10 means that we capture a single frame once every 10 seconds.
For the frame filename pattern, %08d will be replaced by the frame number, in this case 8 digits with leading 0's.
Last modified November 11, 2021: Change format of command lines (522944e)