Webcam streaming with Guvcview and QtCAM
Action!
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.
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.
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.
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).
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).
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.
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
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.