Webcam
From Gentoo Wiki
Resources
This article will provide information on setting up and using webcams on Gentoo using v4l-utils.
Installation
Kernel
The following kernel options need to be activated:
KERNEL Needed Kernel options
Device Drivers ---> <*> Multimedia support ---> [*] Filter media drivers Media device types ---> [*] Cameras and video grabbers Video4Linux options ---> [*] V4L2 sub-device userspace API Media drivers ---> [*] Media USB Adapters ---> <M> USB Video Class (UVC) [*] UVC input events device support
The matching CONFIG_* for the above options are:
- CONFIG_MEDIA_SUPPORT
- CONFIG_MEDIA_SUPPORT_FILTER
- CONFIG_MEDIA_CAMERA_SUPPORT
- CONFIG_VIDEO_V4L2_SUBDEV_API
- CONFIG_MEDIA_USB_SUPPORT
- CONFIG_USB_VIDEO_CLASS
- CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV
USE flags
Recommended USE flags for v4l include: opengl
, qt5
, and udev
- at least qt5
will be needed to follow on with this article.
USE flags for media-tv/v4l-utils Separate utilities ebuild from upstream v4l-utils package
Emerge
Install media-tv/v4l-utils:
root #
emerge --ask media-tv/v4l-utils
Configuration
v4l-utils is used here to check/set the camera's preferences.
Configuration GUI and settings test
user $
qv4l2
Get settings from video device
user $
v4l2-ctl --list-formats-ext
Settings example
Some Cheap USB Cameras (like integrated models in thinkpad latops) always use a 640x480 resolution but are able to use 720p, it is possible to set this in v4l2-ctl:
user $
v4l2-ctl --set-parm=30 --set-fmt-video=width=1280,height=720,pixelformat=MJPG --device /dev/video0
Explanation
--set-parm
= Framerate (integer)
--set-fmt-video
= Resolution + Compression
Check settings
user $
qvidcap
Make options persistent
Getting device info:
root #
lsusb | grep Cam
Creating a rule:
FILE
/etc/udev/rules.d/99-v4linux.rules
Example udev ruleSUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="5986", ATTRS{idProduct}=="0268", PROGRAM="/usr/bin/v4l2-ctl --set-parm=30 --set-fmt-video=width=1280,height=720,pixelformat=MJPG --device /dev/%k"