最終更新:2021-11-12 (金) 08:35:51 (868d)
v4l2-ctl
Top / v4l2-ctl
Ubuntu/パッケージ
使い方
v4l2-ctl --all
- 最初のデバイスだけっぽい
user@ubuntu:~$ v4l2-ctl --all Driver Info (not using libv4l2): Driver name : uvcvideo Card type : Integrated Camera Bus info : usb-0000:00:1a.0-1.6 Driver version: 3.13.9 Capabilities : 0x84000001 Video Capture Streaming Device Capabilities Device Caps : 0x04000001 Video Capture Streaming Priority: 2 Video input : 0 (Camera 1: ok) Format Video Capture: Width/Height : 640/480 Pixel Format : 'YUYV' Field : None Bytes per Line: 1280 Size Image : 614400 Colorspace : SRGB Crop Capability Video Capture: Bounds : Left 0, Top 0, Width 640, Height 480 Default : Left 0, Top 0, Width 640, Height 480 Pixel Aspect: 1/1 Streaming Parameters Video Capture: Capabilities : timeperframe Frames per second: 30.000 (30/1) Read buffers : 0 brightness (int) : min=-64 max=64 step=1 default=15 value=15 contrast (int) : min=0 max=95 step=1 default=30 value=30 saturation (int) : min=0 max=100 step=1 default=40 value=40 hue (int) : min=-2000 max=2000 step=1 default=0 value=0 white_balance_temperature_auto (bool) : default=1 value=1 gamma (int) : min=48 max=300 step=1 default=100 value=100 power_line_frequency (menu) : min=0 max=2 default=2 value=2 white_balance_temperature (int) : min=2800 max=6500 step=1 default=4600 value=4600 flags=inactive sharpness (int) : min=1 max=7 step=1 default=2 value=2 backlight_compensation (int) : min=0 max=2 step=1 default=1 value=1 exposure_auto (menu) : min=0 max=3 default=3 value=3 exposure_absolute (int) : min=333 max=5000 step=1 default=333 value=333 flags=inactive exposure_auto_priority (bool) : default=0 value=1 pan_absolute (int) : min=-36000 max=36000 step=3600 default=0 value=0 tilt_absolute (int) : min=-36000 max=36000 step=3600 default=0 value=0 zoom_absolute (int) : min=0 max=10 step=1 default=0 value=0 privacy (bool) : default=0 value=0
デバイスを列挙
デバイス指定
v4l2-ctl -d /dev/videoX
v4l2-ctl --list-formats-ext
- フォーマットと解像度を列挙
- VIDIOC_ENUM_FMT/VIDIOC_ENUM_FRAMESIZES/VIDIOC_ENUM_FRAMEINTERVALS
$ v4l2-ctl --list-formats-ext ioctl: VIDIOC_ENUM_FMT Index : 0 Type : Video Capture Pixel Format: 'MJPG' (compressed) Name : Motion-JPEG Size: Discrete 1280x720 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 320x180 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 320x240 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 424x240 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 640x360 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 640x480 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 848x480 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 960x540 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Index : 1 Type : Video Capture Pixel Format: 'YUYV' Name : YUYV 4:2:2 Size: Discrete 1280x720 Interval: Discrete 0.100s (10.000 fps) Size: Discrete 320x180 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 320x240 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 424x240 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 640x360 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 640x480 Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps) Size: Discrete 848x480 Interval: Discrete 0.050s (20.000 fps) Size: Discrete 960x540 Interval: Discrete 0.067s (15.000 fps)
フレームレート
- VIDIOC_ENUM_FRAMEINTERVALS
$ v4l2-ctl --list-frameintervals=width=640,height=480,pixelformat=YUYV ioctl: VIDIOC_ENUM_FRAMEINTERVALS Interval: Discrete 0.033s (30.000 fps) Interval: Discrete 0.067s (15.000 fps)
フォーマット/解像度
v4l2-ctl --list-formats
- VIDIOC_ENUM_FMT/VIDIOC_ENUM_FRAMESIZES
$ v4l2-ctl --list-formats ioctl: VIDIOC_ENUM_FMT Index : 0 Type : Video Capture Pixel Format: 'MJPG' (compressed) Name : Motion-JPEG Index : 1 Type : Video Capture Pixel Format: 'YUYV' Name : YUYV 4:2:2
v4l2-ctl --list-framesizes?
$ v4l2-ctl --list-framesizes=MJPG ioctl: VIDIOC_ENUM_FRAMESIZES Size: Discrete 1280x720 Size: Discrete 320x180 Size: Discrete 320x240 Size: Discrete 424x240 Size: Discrete 640x360 Size: Discrete 640x480 Size: Discrete 848x480 Size: Discrete 960x540 $ v4l2-ctl --list-framesizes=YUYV ioctl: VIDIOC_ENUM_FRAMESIZES Size: Discrete 1280x720 Size: Discrete 320x180 Size: Discrete 320x240 Size: Discrete 424x240 Size: Discrete 640x360 Size: Discrete 640x480 Size: Discrete 848x480 Size: Discrete 960x540
help
$ v4l2-ctl --help General/Common options: --all display all information available -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] -d, --device=<dev> use device <dev> instead of /dev/video0 if <dev> starts with a digit, then /dev/video<dev> is used -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 -h, --help display this help message --help-all all options --help-io input/output options --help-misc miscellaneous options --help-overlay overlay format options --help-sdr SDR format options --help-selection crop/selection options --help-stds standards and other video timings options --help-streaming streaming options --help-tuner tuner/modulator options --help-vbi VBI format options --help-vidcap video capture format options --help-vidout vidout output format options --help-edid edid handling options -k, --concise be more concise if possible. -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. -w, --wrapper use the libv4l2 wrapper library. --list-devices list all v4l devices --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) --silent only set the result code, do not print any messages --sleep=<secs> sleep <secs>, call QUERYCAP and close the file handle --verbose turn on verbose ioctl status reporting
usage
Usage: Common options: --all display all information available -C, --get-ctrl=<ctrl>[,<ctrl>...] get the value of the controls [VIDIOC_G_EXT_CTRLS] -c, --set-ctrl=<ctrl>=<val>[,<ctrl>=<val>...] set the controls to the values specified [VIDIOC_S_EXT_CTRLS] -D, --info show driver info [VIDIOC_QUERYCAP] -d, --device=<dev> use device <dev> instead of /dev/video0 if <dev> is a single digit, then /dev/video<dev> is used -F, --get-freq query the frequency [VIDIOC_G_FREQUENCY] -f, --set-freq=<freq> set the frequency to <freq> MHz [VIDIOC_S_FREQUENCY] -h, --help display this help message -I, --get-input query the video input [VIDIOC_G_INPUT] -i, --set-input=<num> set the video input to <num> [VIDIOC_S_INPUT] -l, --list-ctrls display all controls and their values [VIDIOC_QUERYCTRL] -L, --list-ctrls-menus display all controls, their values and the menus [VIDIOC_QUERYMENU] -N, --list-outputs display video outputs [VIDIOC_ENUMOUTPUT] -n, --list-inputs display video inputs [VIDIOC_ENUMINPUT] -O, --get-output query the video output [VIDIOC_G_OUTPUT] -o, --set-output=<num> set the video output to <num> [VIDIOC_S_OUTPUT] --list-standards display supported video standards [VIDIOC_ENUMSTD] -S, --get-standard query the video standard [VIDIOC_G_STD] -s, --set-standard=<num> set the video standard to <num> [VIDIOC_S_STD] <num> can be a numerical v4l2_std value, or it can be one of: pal-X (X = B/G/H/N/Nc/I/D/K/M/60) or just 'pal' (V4L2_STD_PAL) ntsc-X (X = M/J/K) or just 'ntsc' (V4L2_STD_NTSC) secam-X (X = B/G/H/D/K/L/Lc) or just 'secam' (V4L2_STD_SECAM) --get-detected-standard display detected input video standard [VIDIOC_QUERYSTD] -P, --get-parm display video parameters [VIDIOC_G_PARM] -p, --set-parm=<fps> set video framerate in <fps> [VIDIOC_S_PARM] -T, --get-tuner query the tuner settings [VIDIOC_G_TUNER] -t, --set-tuner=<mode> set the audio mode of the tuner [VIDIOC_S_TUNER] Possible values: mono, stereo, lang2, lang1, bilingual --list-formats display supported video formats [VIDIOC_ENUM_FMT] --list-formats-mplane display supported video multi-planar formats [VIDIOC_ENUM_FMT] --list-formats-ext display supported video formats including frame sizes and intervals --list-formats-ext-mplane display supported video multi-planar formats including frame sizes and intervals --list-framesizes=<f> list supported framesizes for pixelformat <f> [VIDIOC_ENUM_FRAMESIZES] pixelformat is the fourcc value as a string --list-frameintervals=width=<w>,height=<h>,pixelformat=<f> list supported frame intervals for pixelformat <f> and the given width and height [VIDIOC_ENUM_FRAMEINTERVALS] pixelformat is the fourcc value as a string -V, --get-fmt-video query the video capture format [VIDIOC_G_FMT] -v, --set-fmt-video=width=<w>,height=<h>,pixelformat=<f> set the video capture format [VIDIOC_S_FMT] pixelformat is either the format index as reported by --list-formats, or the fourcc value as a string -w, --wrapper use the libv4l2 wrapper library. --list-devices list all v4l devices --silent only set the result code, do not print any messages --verbose turn on verbose ioctl status reporting Uncommon options: --try-fmt-video=width=<w>,height=<h>,pixelformat=<f> try the video capture format [VIDIOC_TRY_FMT] pixelformat is either the format index as reported by --list-formats, or the fourcc value as a string --get-fmt-video-mplane query the video capture format through the multi-planar API [VIDIOC_G_FMT] --set-fmt-video-mplane --try-fmt-video-mplane=width=<w>,height=<h>,pixelformat=<f> set/try the video capture format using the multi-planar API [VIDIOC_S/TRY_FMT] pixelformat is either the format index as reported by --list-formats-mplane, or the fourcc value as a string --list-formats-out display supported video output formats [VIDIOC_ENUM_FMT] --get-fmt-video-out query the video output format [VIDIOC_G_FMT] --set-fmt-video-out --try-fmt-video-out=width=<w>,height=<h>,pixelformat=<f> set/try the video output format [VIDIOC_TRY_FMT] pixelformat is either the format index as reported by --list-formats-out, or the fourcc value as a string --list-formats-out-mplane display supported video output multi-planar formats [VIDIOC_ENUM_FMT] --get-fmt-video-out-mplane query the video output format using the multi-planar API [VIDIOC_G_FMT] --set-fmt-video-out-mplane --try-fmt-video-out-mplane=width=<w>,height=<h>,pixelformat=<f> set/try the video output format with the multi-planar API [VIDIOC_S/TRY_FMT] pixelformat is either the format index as reported by --list-formats-out-mplane, or the fourcc value as a string --list-formats-overlay display supported overlay formats [VIDIOC_ENUM_FMT] --get-fmt-overlay query the video overlay format [VIDIOC_G_FMT] --get-fmt-output-overlay query the video output overlay format [VIDIOC_G_FMT] --set-fmt-overlay --try-fmt-overlay --set-fmt-output-overlay --try-fmt-output-overlay=chromakey=<key>,global_alpha=<alpha>, top=<t>,left=<l>,width=<w>,height=<h>,field=<f> set/try the video or video output overlay format [VIDIOC_S/TRY_FMT] <f> can be one of: any, none, top, bottom, interlaced, seq_tb, seq_bt, alternate, interlaced_tb, interlaced_bt --get-sliced-vbi-cap query the sliced VBI capture capabilities [VIDIOC_G_SLICED_VBI_CAP] --get-sliced-vbi-out-cap query the sliced VBI output capabilities [VIDIOC_G_SLICED_VBI_CAP] -B, --get-fmt-sliced-vbi query the sliced VBI capture format [VIDIOC_G_FMT] --get-fmt-sliced-vbi-out query the sliced VBI output format [VIDIOC_G_FMT] -b, --set-fmt-sliced-vbi --try-fmt-sliced-vbi --set-fmt-sliced-vbi-out --try-fmt-sliced-vbi-out=<mode> set/try the sliced VBI capture/output format to <mode> [VIDIOC_S/TRY_FMT] <mode> is a comma separated list of: off: turn off sliced VBI (cannot be combined with other modes) teletext: teletext (PAL/SECAM) cc: closed caption (NTSC) wss: widescreen signal (PAL/SECAM) vps: VPS (PAL/SECAM) --get-fmt-vbi query the VBI capture format [VIDIOC_G_FMT] --get-fmt-vbi-out query the VBI output format [VIDIOC_G_FMT] --overlay=<on> turn overlay on (1) or off (0) (VIDIOC_OVERLAY) --get-fbuf query the overlay framebuffer data [VIDIOC_G_FBUF] --set-fbuf=chromakey=<0/1>,global_alpha=<0/1>,local_alpha=<0/1>,local_inv_alpha=<0/1> set the overlay framebuffer [VIDIOC_S_FBUF] --get-cropcap query the crop capabilities [VIDIOC_CROPCAP] --get-crop query the video capture crop window [VIDIOC_G_CROP] --set-crop=top=<x>,left=<y>,width=<w>,height=<h> set the video capture crop window [VIDIOC_S_CROP] --get-cropcap-output query the crop capabilities for video output [VIDIOC_CROPCAP] --get-crop-output query the video output crop window [VIDIOC_G_CROP] --set-crop-output=top=<x>,left=<y>,width=<w>,height=<h> set the video output crop window [VIDIOC_S_CROP] --get-cropcap-overlay query the crop capabilities for video overlay [VIDIOC_CROPCAP] --get-crop-overlay query the video overlay crop window [VIDIOC_G_CROP] --set-crop-overlay=top=<x>,left=<y>,width=<w>,height=<h> set the video overlay crop window [VIDIOC_S_CROP] --get-cropcap-output-overlay query the crop capabilities for video output overlays [VIDIOC_CROPCAP] --get-crop-output-overlay query the video output overlay crop window [VIDIOC_G_CROP] --set-crop-output-overlay=top=<x>,left=<y>,width=<w>,height=<h> set the video output overlay crop window [VIDIOC_S_CROP] --get-jpeg-comp query the JPEG compression [VIDIOC_G_JPEGCOMP] --set-jpeg-comp=quality=<q>,markers=<markers>,comment=<c>,app<n>=<a> set the JPEG compression [VIDIOC_S_JPEGCOMP] <n> is the app segment: 0-9 or a-f, <a> is the actual string. <markers> is a colon separated list of: dht: Define Huffman Tables dqt: Define Quantization Tables dri: Define Restart Interval --set-audio-output=<num> set the audio output to <num> [VIDIOC_S_AUDOUT] --get-audio-input query the audio input [VIDIOC_G_AUDIO] --set-audio-input=<num> set the audio input to <num> [VIDIOC_S_AUDIO] --get-audio-output query the audio output [VIDIOC_G_AUDOUT] --set-audio-output=<num> set the audio output to <num> [VIDIOC_S_AUDOUT] --list-audio-outputs display audio outputs [VIDIOC_ENUMAUDOUT] --list-audio-inputs display audio inputs [VIDIOC_ENUMAUDIO] --get-modulator query the modulator settings [VIDIOC_G_MODULATOR] --set-modulator=<txsubchans> set the sub-carrier modulation [VIDIOC_S_MODULATOR] <txsubchans> is one of: mono: Modulate as mono mono-rds: Modulate as mono with RDS (radio only) stereo: Modulate as stereo stereo-rds: Modulate as stereo with RDS (radio only) bilingual: Modulate as bilingual mono-sap: Modulate as mono with Second Audio Program stereo-sap: Modulate as stereo with Second Audio Program --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) --get-output-parm display output video parameters [VIDIOC_G_PARM] --set-output-parm=<fps> set output video framerate in <fps> [VIDIOC_S_PARM] --wait-for-event=<event> wait for an event [VIDIOC_DQEVENT] <event> is the event number or one of: eos, vsync, ctrl=<id> where <id> is the name of the control --poll-for-event=<event> poll for an event [VIDIOC_DQEVENT] see --wait-for-event for possible events --list-dv-presets list supported digital video presets [VIDIOC_ENUM_DV_PRESETS] --set-dv-preset=<num> set the digital video preset to <num> [VIDIOC_S_DV_PRESET] --get-dv-preset query the digital video preset in use [VIDIOC_G_DV_PRESET] --query-dv-preset query the detected digital video preset [VIDIOC_QUERY_DV_PRESET] --set-dv-bt-timings=width=<width>,height=<height>,interlaced=<0/1>, polarities=<polarities mask>,pixelclock=<pixelclock Hz>, hfp=<horizontal front porch>,hs=<horizontal sync>, hbp=<horizontal back porch>,vfporch=<vertical front porch>, vs=<vertical sync>,vbp=<vertical back porch>, il_vfp=<vertical front porch for bottom field>, il_vs=<vertical sync for bottom field>, il_vbp=<vertical back porch for bottom field>, set the digital video timings according to the BT 656/1120 standard [VIDIOC_S_DV_TIMINGS] --get-dv-bt-timings get the digital video timings in use [VIDIOC_G_DV_TIMINGS] --sleep=<secs> sleep for <secs> seconds, call QUERYCAP and close the file handle --streamoff turn the stream off [VIDIOC_STREAMOFF] --streamon turn the stream on [VIDIOC_STREAMON] --log-status log the board status in the kernel log [VIDIOC_LOG_STATUS]