V4L2-CTL(1)

๐Ÿ“ฆ
version 1.32.0 ยท 5 versions
, in alpine 3.24, arch rolling, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, ubuntu resolute, ubuntu stonking

๐ŸŽ€ NAME ๐ŸŽ€

v4l2-ctl โ€” bestie, this is the app for controlling video4linux drivers. It lives in the User Commands section (section 1), and honestly? It's that girl. ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

v4l2-ctl [-h] [-d <dev>] [many other options]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

Okay so, real talk: the v4l2-ctl tool is how you control video4linux devices. And when I say devices I mean video, vbi, radio or swradio, and both input and output. ๐Ÿ“น๐Ÿ“ป

It can control, like, almost any aspect of these devices โ€” we're talking the full V4L2 API, no crumbs left. She does it all. Periodt. ๐Ÿ‘‘


โœจ OPTIONS โœจ

So many options, so little time. Let's get into it, bestie. ๐Ÿซถ

  • -A, --list-devices โ€” Lists every v4l device, slay. But wait: if -z was given, then she only lists the devices of the media device whose bus info string matches whatever you put in the -z option. ๐ŸŽฏ
  • -d, --device <dev> โ€” Use device <dev> as the V4L2 device. If <dev> starts with a digit, then /dev/video<dev> is used. Otherwise, if -z was specified earlier, then <dev> is the entity name or interface ID (if prefixed with 0x) as found in the topology of the media device with the bus info string as specified by the -z option. โœจ
  • -v, --verbose โ€” Turn on verbose reporting. She will simply tell you everything. ๐Ÿ—ฃ๏ธ
  • --version โ€” Show version information. ๐Ÿ“Œ
  • -w, --wrapper โ€” Use the libv4l2 wrapper library for all V4L2 device accesses. By default v4l2-ctl will directly access the V4L2 device, but with this option all access will go via this wrapper library. It's giving middle-man energy, but make it official. ๐ŸŒˆ
  • -h, --help โ€” Prints the help message. ๐Ÿ†˜
  • --help-io โ€” Prints the help message for all options that get/set/list inputs and outputs, both video and audio. ๐Ÿ”Œ
  • --help-meta โ€” Prints the help message for all options that get/set/list metadata formats. ๐Ÿท๏ธ
  • --help-misc โ€” Prints the help message for miscellaneous options. The random grab-bag section, iconic. ๐ŸŽฒ
  • --help-overlay โ€” Prints the help message for all options that get/set/list overlay and framebuffer formats. ๐Ÿ–ผ๏ธ
  • --help-sdr โ€” Prints the help message for all options that get/set/list software defined radio formats. ๐Ÿ“ก
  • --help-selection โ€” Prints the help message for all options that deal with selections (cropping and composing). โœ‚๏ธ
  • --help-stds โ€” Prints the help message for all options that deal with SDTV standards and Digital Video timings. ๐Ÿ“บ
  • --help-streaming โ€” Prints the help message for all options that deal with streaming. ๐ŸŒŠ
  • --help-subdev โ€” Prints the help message for all options that deal with v4l-subdevX devices. ๐Ÿงฉ
  • --help-tuner โ€” Prints the help message for all options that deal with tuners and modulators. ๐ŸŽ›๏ธ
  • --help-vbi โ€” Prints the help message for all options that get/set/list VBI formats. ๐Ÿ“ผ
  • --help-vidcap โ€” Prints the help message for all options that get/set/list video capture formats. ๐ŸŽฅ
  • --help-vidout โ€” Prints the help message for all options that get/set/list video output formats. ๐Ÿ“ค
  • --help-edid โ€” Prints the help message for all options that get/set EDIDs. ๐Ÿ–ฅ๏ธ
  • --help-all โ€” Prints the help message for all options. Literally all of them. The whole menu. ๐Ÿ“œ
  • --all โ€” Display all information available. No secrets between us. ๐Ÿ‘€
  • -C, --get-ctrl <ctrl>[,<ctrl>...] โ€” Get the value of the controls [VIDIOC_G_EXT_CTRLS]. ๐Ÿ’ฌ
  • -c, --set-ctrl <ctrl>=<val>[,<ctrl>=<val>...] โ€” Set the value of the controls [VIDIOC_S_EXT_CTRLS]. ๐Ÿ”ง
  • -D, --info โ€” Show driver info [VIDIOC_QUERYCAP]. ๐Ÿชช
  • -e, --out-device <dev> โ€” Use device <dev> for output streams instead of the default device as set with --device. If <dev> starts with a digit, then /dev/video<dev> is used. Otherwise if -z was specified earlier, then <dev> is the entity name or interface ID (if prefixed with 0x) as found in the topology of the media device with the bus info string as specified by the -z option. ๐Ÿ“ฎ
  • -E, --export-device <dev> โ€” Use device <dev> for exporting DMA buffers. If <dev> starts with a digit, then /dev/video<dev> is used. Otherwise if -z was specified earlier, then <dev> is the entity name or interface ID (if prefixed with 0x) as found in the topology of the media device with the bus info string as specified by the -z option. ๐Ÿ“ฆ
  • -z, --media-bus-info <bus-info> โ€” Find the media device with the given <bus-info> string. If set, then -d, -e and -E options can use the entity name or interface ID to refer to the device nodes. Example:
v4l2-ctl -z platform:vivid-000 -d vivid-000-vid-cap

๐ŸšŒโœจ

  • -k, --concise โ€” Be more concise if possible. Less yapping, same tea. โ˜•
  • -l, --list-ctrls โ€” Display all controls and their values [VIDIOC_QUERYCTRL]. ๐Ÿ“‹
  • -L, --list-ctrls-menus โ€” Display all controls and their menus [VIDIOC_QUERYMENU]. ๐Ÿฝ๏ธ
  • -r, --subset <ctrl>[,<offset>,<size>]+ โ€” The subset of the N-dimensional array to get/set for control <ctrl>, for every dimension an (<offset>, <size>) tuple is given. N-dimensional, she's multidimensional, she contains multitudes. ๐Ÿ’ซ
  • --list-devices-input <name> โ€” Same as --list-devices, but only show devices with a current input name that matches <name>. ๐Ÿ”Ž
  • --list-devices-output <name> โ€” Same as --list-devices, but only show devices with a current output name that matches <name>. ๐Ÿ”
  • --log-status โ€” Log the board status in the kernel log [VIDIOC_LOG_STATUS]. ๐Ÿชต
  • --get-priority โ€” Query the current access priority [VIDIOC_G_PRIORITY]. ๐Ÿฅ‡
  • --set-priority <prio> โ€” Set the new access priority [VIDIOC_S_PRIORITY]. <prio> is 1 (background), 2 (interactive) or 3 (record). Pick your fighter. ๐ŸŽฎ
  • --silent โ€” Only set the result code, do not print any messages. ๐Ÿคซ
  • --sleep <secs> โ€” Sleep <secs>, call QUERYCAP and close the file handle. Nap, vibe check, exit. ๐Ÿ˜ด

๐Ÿ’€ EXIT STATUS ๐Ÿ’€

On success, it returns 0. Otherwise, it will return the error code. That's it, that's the whole status report. ๐Ÿซก


๐ŸŒŸ EXAMPLES ๐ŸŒŸ

Query the device information of /dev/video1:

v4l2-ctl -d1 -D

Stream video using MMAP stream I/O from /dev/video0:

v4l2-ctl -d0 --stream-mmap

Stream one frame of video from /dev/video0 and store it in a file:

v4l2-ctl --stream-mmap --stream-count=1 --stream-to=file.raw

Stream video from /dev/video0 and stream it over the network:

v4l2-ctl --stream-mmap --stream-to-host <hostname>

Use qvidcap -p on the host to view the video. ๐Ÿ‘€

Stream video from /dev/video0 using DMABUFs exported from /dev/video2:

v4l2-ctl --stream-dmabuf --export-device /dev/video2

Stream video from a memory-to-memory device:

v4l2-ctl --stream-mmap --stream-out-mmap

Stream video from a capture video device (/dev/video1) to an output video device (/dev/video2):

v4l2-ctl -d1 --stream-mmap --out-device /dev/video2 --stream-out-dmabuf

๐Ÿ™ˆ BUGS ๐Ÿ™ˆ

This manual page is a work in progress. She's a draft, she's growing, we respect the journey. ๐ŸŒฑ

Bug reports or questions about this utility should be sent to the linux-media@vger.kernel.org mailinglist. They're lovely, go say hi. ๐Ÿ’Œ


๐Ÿ’– and that's the whole page, bestie โ€” go forth and control those video4linux devices, you absolute icon. ๐Ÿ’–

This was brought to you by v4l-utils 1.32.0, dated March 2015, and it's still serving looks. ๐ŸŽ€โœจ

๐Ÿ“ฆ where this page comes from