2021-10-28 10:56:10 +07:00
|
|
|
# v4l2-ctl
|
|
|
|
|
|
|
|
> Control video devices.
|
|
|
|
> More information: <https://manned.org/v4l2-ctl>.
|
|
|
|
|
|
|
|
- List all video devices:
|
|
|
|
|
|
|
|
`v4l2-ctl --list-devices`
|
|
|
|
|
|
|
|
- List supported video formats and resolutions of default video device `/dev/video0`:
|
|
|
|
|
|
|
|
`v4l2-ctl --list-formats-ext`
|
|
|
|
|
|
|
|
- List supported video formats and resolutions of a specific video device:
|
|
|
|
|
2025-03-07 13:06:30 +02:00
|
|
|
`v4l2-ctl --list-formats-ext {{[-d|--device]}} {{path/to/video_device}}`
|
2021-10-28 10:56:10 +07:00
|
|
|
|
|
|
|
- Get all details of a video device:
|
|
|
|
|
2025-03-07 13:06:30 +02:00
|
|
|
`v4l2-ctl --all {{[-d|--device]}} {{path/to/video_device}}`
|
2021-10-28 10:56:10 +07:00
|
|
|
|
2022-05-04 17:12:15 +00:00
|
|
|
- Capture a JPEG photo with a specific resolution from video device:
|
2021-10-28 10:56:10 +07:00
|
|
|
|
2025-03-07 13:06:30 +02:00
|
|
|
`v4l2-ctl {{[-d|--device]}} {{path/to/video_device}} --set-fmt-video=width={{width}},height={{height}},pixelformat=MJPG --stream-mmap --stream-to={{path/to/output.jpg}} --stream-count=1`
|
2021-10-28 10:56:10 +07:00
|
|
|
|
|
|
|
- Capture a raw video stream from video device:
|
|
|
|
|
2025-03-07 13:06:30 +02:00
|
|
|
`v4l2-ctl {{[-d|--device]}} {{path/to/video_device}} --set-fmt-video=width={{width}},height={{height}},pixelformat={{format}} --stream-mmap --stream-to={{path/to/output}} --stream-count={{number_of_frames_to_capture}}`
|
2021-10-28 10:56:10 +07:00
|
|
|
|
|
|
|
- List all video device's controls and their values:
|
|
|
|
|
2025-03-07 13:06:30 +02:00
|
|
|
`v4l2-ctl {{[-l|--list-ctrls]}} {{[-d|--device]}} {{path/to/video_device}}`
|
2023-07-14 07:07:18 +03:00
|
|
|
|
|
|
|
- Set the value of a video device control:
|
|
|
|
|
2025-03-07 13:06:30 +02:00
|
|
|
`v4l2-ctl {{[-d|--device]}} {{path/to/video_device}} {{[-c|--set-ctrl]}} {{control_name}}={{value}}`
|