Webcam

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.
Resources
This article has some todo items:
  • Check kernel options

This article will provide information on setting up and using a webcam 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 core support  --->
         [*] Video4Linux core
         [*] Media Controller API
        Media device types  --->
            [*] Cameras and video grabbers 
        Video4Linux options  --->
            <M> V4L2 flash API for LED flash class devices
        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_CONTROLLER
  • CONFIG_MEDIA_SUPPORT
  • CONFIG_MEDIA_SUPPORT_FILTER
  • CONFIG_MEDIA_CAMERA_SUPPORT
  • CONFIG_VIDEO_V4L2_SUBDEV_API
  • CONFIG_VIDEO_DEV
  • CONFIG_V4L2_FLASH_LED_CLASS
  • CONFIG_MEDIA_USB_SUPPORT
  • CONFIG_USB_VIDEO_CLASS
  • CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV
Note
To enable sound on webcams equipped with a microphone, separate options, such as "USB Audio/MIDI driver" (CONFIG_SND_USB_AUDIO), may need to be configured.

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 Transitional package to be superseded by media-libs/libv4l[utils]

bpf Enables support for IR BPF decoders.
dvb Add support for DVB (Digital Video Broadcasting)
opengl Add support for OpenGL (3D graphics)
qt5 Add support for the Qt 5 application and UI framework
udev Enable virtual/udev integration (device discovery, power and storage device support, etc)

Emerge

Install media-tv/v4l-utils:

root #emerge --ask media-tv/v4l-utils

Additional software

There are several webcam viewer applications in the Gentoo ebuild repository, a few examples are:

Name Package Description
Cheese media-video/cheese Cheesy program to take pictures and videos from a webcam.
guvcview media-video/guvcview Simple Qt5 or GTK+3 interface for capturing and viewing video from v4l2 devices.
kamoso kde-apps/kamoso Application to take pictures and videos from a webcam, by KDE.
Motion media-video/motion Software motion detector.

Media players like VLC or mpv may be used to view or sometimes record video from a webcam.

See media-video for more video software.

Configuration

v4l-utils is used here to check/set the camera's preferences.

Configuration GUI and settings test

Launch the v4l GUI:

user $qv4l2
Note
The availability of the preceding command depends on the qt5 flag for the media-tv/v4l-utils package.

Get settings from video device

Example of using the video4linux control application to display supported video formats:

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

Launch the v4l2 video capture viewer to test if the settings are working:

user $qvidcap
Note
The availability of the preceding command depends on the qt5 flag for the media-tv/v4l-utils package.

Make options persistent

Getting device info:

root #lsusb | grep Cam
Bus 003 Device 007: ID '''5986''':'''0268''' Acer, Inc SunplusIT INC. Integrated Camera

Creating a rule:

FILE /etc/udev/rules.d/99-v4linux.rulesExample udev rule
SUBSYSTEM=="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"

See also

  • v4l-utils — a set of utilities for handling media devices.