Ubuntu

How to Install and Test the Fswebcam Software on Ubuntu

When you connect your webcam device, you need a program that lets you work on the captured images. Fswebcam is a command-line webcam program that is available for Linux systems, and it captures images from the V4L1/V4L2 devices. You can use the webcam with supported formats such as png and JPEG. With fswebcam, you can manipulate the captured image such as the resolution using different options. This guide focuses on three ways of installing the fswebcam on Ubuntu. Furthermore, we will discuss the various options to use when working with fswebcam. Let’s get started!

Three Ways of Installing Fswebcam on Ubuntu

When you have your cameras connected to your Ubuntu and want to use them as your webcam, you need a tool like fswebcam to capture the image from the connected device. You can install the fswebcam via the apt repository, from the Ubuntu Software, or as a snap package.

1. Install as a Snap Package

Ubuntu has a snap store where you can install the snap packages such as fswebcam. A snap package is a software that comes with all its dependencies bundled together. You can quickly install the fswebcam from the snap store with the following command:

$ sudo snap install fswebcam

 
You will get an output which confirms that the package has been installed.


To further verify the installation, check the version of the installed fswebcam. You may get a different installed version than the one that we have for this guide.

$ fswebcam --version

 

We will see the different examples on how to test the installed fswebcam. Note that if you decide to uninstall the fswebcam which is installed via snap, you can uninstall it with the following command:

$ sudo snap remove fswebcam

 

That’s how to install fswebcam as a snap package.

2. Install via Apt

The Ubuntu repository contains the fswebcam package that we can install via the apt command. This method installs fswebcam and its dependencies. Run the following command:

$ sudo apt-get install fswebcam

 
Press Y when prompted to install the required dependencies.


Once the installation completes, check the installed version to verify if you have the fswebcam on your Ubuntu ready for use.

3. Install from Ubuntu Software

The Ubuntu Software center contains different packages that you can install graphically. Fswebcam is one of the softwares available in the store. Open the Ubuntu Software on your system, click the search icon at the top, then search for fswebcam.


Next, click the install button and authorize the installation by entering your password.


Once the installation completes, proceed to test how we can use the fswebcam.

How to Test the Fswebcam

Testing fswebcam is an easy task. For this example, we start by capturing an image using the built-in camera. If you connect the external camera sources, fswebcam uses it as the source. Use the following syntax to capture the webcam image and save the picture with the preferred image name:

$ fswebcam <image-name>

 
Fswebcam opens the available camera device, capture the image, and store it in the current directory.


List the contents of the current directory to confirm the captured image that exists.


Suppose you want to change the resolution of the captured image. You can add the -r option followed by the new resolution to use for the image.

$ fswebcam -r 1280x720 <image-name>

 
For instance, let’s use the resolution of 1280×720. The process and output are the same, only that the resolution changes.


The -v is for verbose. With fswebcam, the captured image has banners around it. To bypass this, you can add the –no-banner option.

$ fswebcam -r 1280x720 --no-banner<image-name>

 
You can access the various options that you can use with fswebcam from its help page. The examples that are presented will guide you on the format to follow with the other options depending on the purpose of the options.

Conclusion

The fswebcam software is an excellent program that you can use with your cameras to capture and save the images in different formats. We demonstrated how you can install the program via the snap store, apt, and Ubuntu Software. We also demonstrated how to test and use it to capture the images.

About the author

Denis Kariuki

Denis is a Computer Scientist with a passion for Networking and Cyber Security. I love the terminal, and using Linux is a hobby. I am passionate about sharing tips and ideas about Linux and computing.