Configure the Raspberry Pi camera
Follow these steps to configure the Raspberry Pi camera module to send video from the device to a Kinesis video stream.
Note
If you’re using a USB webcam, skip to Install software prerequisites.
- Camera module 1
-
Follow these instructions to update the modules file, enable the camera interface, and verify functionality of your camera. Updating the modules file tells the Raspberry Pi which kernel modules to load at boot time. The camera driver isn't loaded by default in order to conserve system resources on Raspberry Pi devices that aren't using a camera.
-
Open an editor to update the
modules
file with the following command:sudo nano /etc/modules
-
Add the following line to the end of the file, if it's not already there:
bcm2835-v4l2
-
Save the file and exit the editor (Ctrl-X).
-
Reboot the Raspberry Pi:
sudo reboot
-
When the device reboots, connect to it again through your terminal application if you are connecting remotely.
-
Open
raspi-config
:sudo raspi-config
-
Choose Interfacing Options, Legacy Camera. In older builds of the Raspbian Operating System, this menu option might be under Interfacing Options, Camera.
Enable the camera if it's not already enabled, and reboot if prompted.
-
Verify that the camera is working by typing the following command:
raspistill -v -o test.jpg
If your camera is configured correctly, this command captures an image from the camera, saves it to a file named
test.jpg
, and displays informational messages.
-
- Camera module 2 or 3
If you’re using a Camera module 2, you use either
bcm2835-v4l2
(legacy) orlibcamera
(modern). However, thelibcamera
stack is recommended for better support and features. Follow the steps below to confirm thatlibcamera
is up-to-date on your system.libcamera
should come pre-installed on your Raspberry Pi. Check for any updates and update to the latest version for bug fixes and security updates. sudo apt-get update sudo apt-get upgrade
Reboot your system for the updates to take effect.
sudo reboot
Test your camera. This application starts a camera preview stream and displays it on the screen.
libcamera-hello
If you have issues with your camera module, see the Raspberry Pi documentation
for troubleshooting.