Skip to the content.

Video Capture and Take Photo Using CLI

Checking Video Sources

# List loaded kernel modules and filter for uvcvideo
lsmod | grep uvcvideo

Installing v4l-utils and guvcview

# Install v4l-utils and guvcview
sudo apt install v4l-utils -y
sudo apt install guvcview -y

Listing Video Devices

# List available video devices
v4l2-ctl --list-devices

Capturing Video

Capturing Video with guvcview

# Capture video using guvcview and save to ~/.config/guvcview2
guvcview --video /dev/video0 --format=yuv420 --resolution=640x480 --capture=read

Capturing Video with ffmpeg

# Use ffmpeg to capture video from /dev/video0, encode with libx264, and save to ~/Pictures/output.mp4
ffmpeg -f v4l2 -i /dev/video0 -c:v libx264 -preset ultrafast ~/Pictures/output.mp4