Webcam streaming with Guvcview and QtCAM

Action!

Article from Issue 237/2020
Author(s):

If your new webcam doesn't work with the default software on your Linux system, try your luck with Guvcview or QtCAM.

Many webcam manufacturers still don't take Linux seriously, which means that kernel modules for many cameras are often created by freelance developers. In some cases, the manufacturer even changes the chipset during a production run without informing the Linux community. The result of all this uncertainty is that webcam operations in Linux are somewhat unpredictable. A specific system might work out-of-the-box for some cameras but have troubles with others. Users today, however, are accustomed to more seamless hardware configuration. If you, or anyone who depends on you for Linux advice, is having trouble with getting a webcam to work in Linux, one option is to replace the on-board webcam utility shipped with your distro with an alternative application. Guvcview and QtCAM are powerful alternative tools that are suitable for all desktops and support a wide range of cameras.

Tech Talk

On Linux systems, the UVC driver, or the GSPCA driver for older models, can talk to most webcams. The UVC module even supports cameras connected via USB, and it supports webcams built into laptops. A list of compatible webcams can be found on the UVC project's website [1].

The GSPCA driver is used for cameras that do not yet use the UVC driver but can be addressed via a special bridge chipset. A list of supported cameras can be found on the LinuxTV project website [2].

If you use one of these cameras, you can rely on the driver framework, which already contains all additional modules. The modules in turn support a variety of formats, including MPEG2, MPEG4, MJPEG, H.264, and VP8 for moving images, but also JPG, BMP, and PNG for still images. Which format you use depends on the webcam's capabilities.

Guvcview

Guvcview is the GTK+ UVC Viewer [3]. The Guvcview webcam application, which has been under continuous development for more than 10 years, relies on luvcview for video rendering and also makes sound recordings, drawing on PortAudio or PulseAudio for sound capabilities. The software is available from the repositories of popular distributions, and you can download the source code from the project's SourceForge page.

After you install, you will find the Guvcview icon in the desktop menu, usually in the Entertainment Media or Multimedia submenu. After starting the program, two windows open: One window shows the camera image; the other window shows the various settings options.

Use the Capture Picture and Capture Video buttons to specify whether you will capture a stream or a still image. You can set the recording parameters using the configuration groups located below it in the tabs Image Controls, Video Controls, and Audio Controls.

First of all, adjust the resolution and refresh rate to your requirements in the Video Controls area (Figure 1). When the camera resolution changes, the second window with the current camera image is also enlarged or reduced. If you are using several cameras on the computer, select the desired camera via the Device selection field.

Figure 1: Guvcview configuration is based on slide controls and checkboxes.

The Resolution selection field offers only those variants for selection that the camera actually supports. In other words, not all resolution options will be displayed for all cameras. Lower resolutions reduce the required storage space.

The extensive dialog in the Image Controls tab lets you adjust the brightness, contrast, color intensity, and saturation via sliders (Figure 2). You can also adjust the white balance, focus control, backlight correction, and focus.

Figure 2: The settings window in Guvcview avoids unnecessary frills.

Since the software transfers changes in real time to the window with the current camera image, you can immediately see how the parameters you set affect the image. This ability to make changes in real time vastly improves the quality of video streams, making incorrect exposure values and faulty coloring a thing of the past.

The third tab, Audio Controls, is where you set the parameters for audio recording (Figure 3). Guvcview already comes with some useful presets. You'll find several options in the Input device selection field, depending on your choice of computer. Laptops usually come with their own microphones, as do many webcams.

Figure 3: The audio settings are limited to a few options.

If you want to activate the laptop's webcam microphone instead of the default webcam microphone, you need to specify this explicitly in the selection field. In addition to the sampling rate, this dialog lets you set the number of channels and specify the latencies; if necessary, you can also enable some sound effects such as reverb or echo.

Guvcview lets you select the codecs you want to use. Select the Video Codec and Audio Codec entries below Video in the menubar at the top of the window, and enable the desired codec by checking the radio button.

After selecting the desired codec in Video Codec Properties or Audio Codec Properties, you have the chance to customize various codec settings (Figure 4).

Figure 4: Guvcview lets users customize the details of audio and video codecs.

In a further step, you then define the storage path, the file name, and the container format with which Guvcview will save your content. Use the File item in the Video and Photo menus for this. By default, the software uses the free Matroska format with a file extension of .mkv; AVI and WebM are available as alternatives.

If you want to preserve your settings for future sessions, save them in Settings | Save Profile. Settings | Load profile, which lets you enable the profile again later on.

When the configuration is complete, start capturing the video or still image by pressing the button at the top left and center of the configuration window. Use the Quit button to the right to exit the application; the camera window will also close automatically.

QtCAM

QtCAM, offered by US vendor e-con Systems Inc. and developed in India, is available as free software under the GPLv3 license [4]. Binary packages are available for Ubuntu and its derivatives, Fedora (version 30 and later), and several other popular Linux distros. Documentation and source code are available on the vendor's website.

QtCAM supports numerous e-con cameras, as well as other cameras that can be addressed via the UVC module and V4L2 cameras. The manufacturer provides a list of compatible cameras on its website, but the list does not include many older models.

QtCAM offers an intuitive graphical user interface with a state-of-art ergonomic look. You can use up to six cameras simultaneously, which makes the software suitable for video surveillance systems. However, using QtCAM in a mutli-camera, video surveillance system would require some manual operation, because the software does not include surveillance functions such as motion sensors and automatic recording.

The program window is divided into two areas. Vertically, on the left, you will find a setting range that combines different categories into separate settings segments, while the larger area on the right displays the camera images (Figure 5).

Figure 5: QtCAM uses a single window to control the image display.

After installing QtCAM, you will find an icon in the start menu. Clicking on the icon opens a terminal and prompts you for your admin password (the software requires extended privileges). The program window then opens in full-screen mode.

QtCAM offers very simple user dialogs. In the vertical function bar, you can use the slider at the top to select whether you want to record a still image or a video stream.

To the right of the slider, you will find a trigger that executes the selected function. Below it, select the desired device in a selection box. Depending on the camera model and its technical features, the settings at the bottom vary.

To configure the basic settings, first open the Image Quality Settings group. In addition to the brightness, contrast, and color saturation, you can also adjust the white balance and sharpness of the image with separate sliders. Since the software displays the camera image in the right section of the program window while you are making an adjustment, the results of the adjustments are visible on the screen – virtually in real time.

You can use the Still Capture Settings category to set special adjustments for still capture, such as the color space and compression. To adjust the resolution, there is also a drop-down list that lists all physical resolutions supported by the camera.

You define the storage path for the recordings in a separate input field. By default, the software uses the Pictures/ subdirectory in your home folder as the backup path.

In the last step, define the output format of the recordings. You can choose between JPG, BMP, RAW, or PNG. Video Capture Settings is where you set the video parameters (Figure 6). The options include the frame rate, color space, and compression specifications, as well as the video resolution.

Figure 6: Although QtCAM offers fewer configuration options than Guvcview, it does allow for device-specific adjustments.

The software also asks you which output format you want to use. What QtCAM means by this is the container format, but thus far it only supports AVI. In a further step, you can specify the desired encoder. The software lets you choose between MJPEG and H.264, which compresses videos in a better way, resulting in significantly smaller video files of the same quality.

In the last option, set the backup path for the video recordings. The bottom group of settings, Audio Capture Settings, is where you configure the audio settings. First select the desired device. You can choose between two devices in the system (e.g., if you use a webcam with an additional microphone on a desktop computer or laptop with a built-in microphone). Depending on the hardware you are using, you then specify the sampling rate and the number of usable recording channels. You can also specify the recording sensitivity.

When the settings are complete, start recording. While a video sequence is running, a green illuminated time display appears top left in the program window. The time display gives you information on how long the recording has been running.

After you press the stop button in the top left corner, the software asks if it should save the new file in the predefined path. QtCAM automatically assigns a file name. To exit the program after saving a file, press Exit in the lower left vertical settings bar. The window will close after a prompt.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Free Software Projects

    Voice over IP on the Internet gives communication a personal touch, but it takes applications like Cheese and WebcamStudio to exploit the creative potential of Internet telephony.

  • Like Qlockwork

    QML makes writing desktop applications a breeze, and you can later compile them into standalone programs that work more or less anywhere.

  • Amsn

    Many Webcam owners use MSN Messenger by Microsoft for video messaging. Linux users can run Amsn to connect eye to eye.

  • Motion Detection

    The motion detector software, Motion, monitors the video signal from one or multiple cameras and is able to detect whether a significant part of the picture has changed, record and track movement, or launch arbitrary external commands to trigger other actions.

  • PiCam Surveillance

    The new PiCam camera for the Raspberry Pi delivers image data with very little overhead, making it ideal for video surveillance applications. We find the bumps in the road you'll encounter and show you how to smooth them out with a few Linux commands and pipes.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News