Linux command
v4l2-ctl 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
List
v4l2-ctl --list-devices
Example
v4l2-ctl --list-formats-ext
Example
v4l2-ctl -d /dev/video0 --list-formats-ext
Example
v4l2-ctl -d /dev/video0 --all
List controls
v4l2-ctl -d /dev/video0 --list-ctrls
Set control
v4l2-ctl -d /dev/video0 --set-ctrl brightness=128
Capture
v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=MJPG --stream-mmap --stream-to=photo.jpg --stream-count=1
Example
v4l2-ctl -d /dev/video0 --stream-mmap --stream-to=video.raw --stream-count=100
说明
v4l2-ctl is used to control video4linux devices, including video, VBI, radio, and swradio devices, both input and output. It provides access to nearly all V4L2 API functionality for querying and configuring video devices.
参数
- -d, --device DEV
- Specify target video device (default: /dev/video0)
- -D, --info
- Display driver capabilities
- --all
- Show comprehensive device information
- --list-devices
- List all video devices
- --list-formats-ext
- List supported formats with frame sizes
- -l, --list-ctrls
- List all available controls
- -C, --get-ctrl
- Get control value
- -c, --set-ctrl
- Set control value
- --set-fmt-video
- Set video capture format (width, height, pixelformat)
- --stream-mmap
- Capture using memory-mapped I/O
- --stream-dmabuf
- Capture using DMA buffers
- --stream-to FILE
- Write captured stream to file
- --stream-count N
- Capture N frames
- -e, --out-device DEV
- Specify output device for streaming
- -v, --verbose
- Enable detailed output
- --help-all
- Show complete option documentation
FAQ
What is the v4l2-ctl command used for?
v4l2-ctl is used to control video4linux devices, including video, VBI, radio, and swradio devices, both input and output. It provides access to nearly all V4L2 API functionality for querying and configuring video devices.
How do I run a basic v4l2-ctl example?
Run `v4l2-ctl --list-devices` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d, --device DEV do in v4l2-ctl?
Specify target video device (default: /dev/video0)