which will open the video in the Pi’s preinstalled VLC video
player. And just like raspistill, raspivid is a powerful program
with a lot of options. To see what’s possible with it, view all the
command-line options by running the program and piping the
output through less:
$ raspivid 2>&1 less
Testing USB Webcams
With all the different models of webcams out there, there’s no
guarantee that a camera will work right out of the box. If you’re
purchasing a webcam for use with the Raspberry Pi, search online to
make sure that others have had success with the model that you’re
purchasing. You can also check the webcam section of eLinux.org’s
page of peripherals (elinux.org/RPi_USB_Webcams)
that have been
verified to work with the Raspberry Pi.
Be aware that you may need to connect a powered USB hub to your
Raspberry Pi if you want to connect your webcam in addition to your
keyboard and mouse. The hub must be powered because the Rasp-
berry Pi only lets a limited amount of electrical current through its
USB ports, and it may not be able to provide enough power for your
keyboard, mouse,
and
webcam—especially if you’re using one of
the older models of Pi. A powered USB hub plugs in to the wall and
provides electrical current to the peripherals that connect to it so
that they don’t max out the power on your Raspberry Pi.
If you have a webcam that you’re ready to test out with the Raspberry
Pi, use apt-get in the Terminal to install a simple camera viewing ap
-
plication called luvcview:
$ sudo apt-get install luvcview
After apt-get finishes the installation, run the application by typing
luvcview in a Terminal window while you’re in the desktop environ-
ment. A window will open showing the view of the first video source
it finds in the
/dev
folder, likely
/dev/video0
. Note the frame size
that is printed in the Terminal window. If the video seems a little
choppy, you can fix this by reducing the default size of the video.
For example, if the default video size is 640×480, close luvcview
Working with Cameras 147
GSW_RASPI_4ED_FIN.indd 147GSW_RASPI_4ED_FIN.indd 147 10/28/21 10:54 AM10/28/21 10:54 AM