--- title: Video4Linux 2 (V4L2) breadcrumbs: - title: Media --- {% include header.md %} A tool to manage video input devices (mainly webcams). ## Setup - Install: `apt install v4l-utils` ## Usage - Show video devices: - List devices: `v4l2-ctl --list-devices` - Show brief device info: `v4l2-ctl [-d ] --info` - Show extended device info: `v4l2-ctl [-d ] --all` - Show device formats: `v4l2-ctl [-d ] --info --list-formats` - Show device settings: `v4l2-ctl [-d ] --info --list-ctrls` - If no device is specified, it defaults to `/dev/video0`. - Certain devices show up as multiple `/dev/video*` files. Typically there's one video capture device and one metadata capture device. Use the command above to find out. - Modify video device properties: - Show properties with min, max and current values: `v4l2-ctl [-d ] --all` - Different webcams come with different properties and property names. - Change a property (non-permanent): `v4l2-ctl [-d ] -c =` - Properties may be modified while the device is in use. - As property changes are not permanent, you may want to set them in a script or something. - Higher exposure may lead to reduced frame rate. To make it brighter you may increase the gain instead. - Focus and white balance _can_ typically be left at auto. Brightness, contrast and saturation _should_ typically be left at default. - Logitech C920 and similar: - Disable auto focus: `focus_auto=0` - Disable auto exposure: `exposure_auto=1` - Set exposure manually (after auto is disabled): `exposure_absolute=250` - Set gain: `gain=250` - Disable auto white balance: `white_balance_temperature_auto=0` - Set white balance manually (after auto is disabled): `white_balance_temperature=4000` - Set brightness, contrast and saturation (generally not needed): `brightness=128`, `contrast=128`, `saturation=128` {% include footer.md %}