camerav4l2
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.
- 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 here. Source channel numbers are used as keys ('ch' prefixed) in 'provides' tuple.
- If not given, channel 0 alone will be used by defauilt.
- 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" or "UNKNOWN"
- Case sensitive!
- size (integer tuple)
- Default: varies with norm
- PAL: [768 576]
- 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"
- Desired capture mode. Can be one of:
- GREY (8-bit monochrome)
- RGBP (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
- 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.
- 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"] )