Video4Linux2 camera capture. More...
Video4Linux2 camera capture.
The camerav4l2 driver captures images from V4L2-compatible cameras.
- Compile-time dependencies
- <sys/types.h>
- <linux/videodev2.h>
- Provides
- Requires
- none
- Configuration requests
- none
- Configuration file options
- port (string)
- Default: "/dev/video0"
- Device to read video data from.
- geode (integer)
- Default: 0
- Set to 1 for SoC camera on AMD Geode.
- i2c (string)
- Default: "/dev/i2c-0"
- i2C device for changing sources on AMD Geode (see below).
- sources (integer tuple)
- Default: NONE
- Some capture cards have few multiple input sources; use this field to select which ones are used. You should define as many provided camera interfaces as the number of sources is given for this option. Source channel numbers are used as keys ('ch' prefixed) in 'provides' tuple.
- If not given, channel 0 alone will be used by default (channel 1 alone will be used by default for AMD Geode).
- Note that switching between channels takes time. Framerate drops dramatically whenever more than one channel is used.
- norm (string)
- Default: "NTSC"
- Capture format; "NTSC", "PAL", "PAL60" or "UNKNOWN"
- Case sensitive!
- size (integer tuple)
- Default: varies with norm
- PAL: [768 576]
- PAL60: [720 480]
- NTSC: [640 480]
- other: [320 240]
- Desired image size. This may not be honoured if the driver does not support the requested size).
- Default: varies with norm
- mode (string)
- Default: "BGR3" ("YUYV" for AMD Geode)
- Desired capture mode. Can be one of:
- GREY (8-bit monochrome)
- RGBP (16-bit packed; will produce 24-bit color images)
- YUYV (16-bit packed, will produce 24-bit color images)
- BGR3, RGB3 (24-bit RGB)
- BGR4, RGB4 (32-bit RGB)
- BA81 (for sn9c1xx-based USB webcams; will produce 24-bit color images)
- MJPG (for webcams producing MJPEG streams not decompressed by V4L2 driver)
- buffers (integer)
- Default: 2 (3 for AMD Geode)
- Number of buffers to use for grabbing. This reduces latency, but also potentially reduces throughput. Use this if you are reading slowly from the player driver and do not want to get stale frames.
- sleep_nsec (integer)
- Default: 10000000 (=10ms which gives max 100 fps)
- timespec value for nanosleep()
- settle_time (double)
- Default: 0.5
- Time (in seconds) to wait after switching to next channel; images grabbed right after channel switching are too bright or messy, so it is better to wait a little while before start grabbing.
- skip_frames (integer)
- Default: 10
- See 'settle_time' - during this settle time frames are grabbed anyway and they are counted. We can decide to stop waiting for stable image after given number of frames was skipped.
- request_only (integer)
- Default: 0
- If set to 1, data will be sent only at PLAYER_CAMEARA_REQ_GET_IMAGE response.
- failsafe (integer)
- Default: 0
- If after few days of grabbing you experience unexpected failures you can try to set this to 1. WARNING! Such failures may (or may not) suggest something wrong is going on with your system kernel. Reboot of whole system is a better solution, although it may not always be desired. This feature is turned off by default - use at your own risk.
Note that some of these options may not be honoured by the underlying V4L2 kernel driver (it may not support a given image size, for example).
- Example
driver ( name "camerav4l2" provides ["camera:0"] )
- Channel 2 explicitly selected:
driver ( name "camerav4l2" sources [2] norm "PAL" size [384 288] mode "BGR4" buffers 4 sleep_nsec 10000 provides ["ch2:::camera:1"] ) driver ( name "cameracompress" requires "camera:1" provides "camera:0" )
- Two channels at the same time:
driver ( name "camerav4l2" sources [0 2] norm "PAL" provides ["ch2:::camera:0" "ch0:::camera:1"] )
- sn9c1xx-based USB webcam (it accepts one buffer and only 352x288 size!):
driver ( name "camerav4l2" norm "UNKNOWN" mode "BA81" size [352 288] buffers 1 provides ["camera:1"] ) driver ( name "cameracompress" requires ["camera:1"] provides ["camera:0"] )
- LogiLink USB 2.0 Video Grabber (two sources: 0 = composite, 1 = s-video).
- One camera scenario:
driver ( name "camerav4l2" port "/dev/video0" sources [0] norm "UNKNOWN" size [720 480] mode "YUYV" buffers 2 sleep_nsec 10000 provides ["ch0:::camera:0"] )
- Two cameras scenario:
driver ( name "camerav4l2" port "/dev/video0" sources [0 1] norm "PAL60" size [720 480] mode "YUYV" buffers 2 sleep_nsec 10000 settle_time 0.1 skip_frames 7 provides ["ch0:::camera:0" "ch1:::camera:1"] )
WARNING! This device uses very unstable driver (usbtv.ko), e.g. setting norm to "PAL" always resulted in kernel panic. Use "PAL60" instead. Buffers should be always set to 2, it won't initialize otherwise. The settle_time and skip_frames in two cameras scenario were chosen experimentally, may require some tweaking. Sizes different than 720x480 seem to be unsupported (messy image).