How do I stream a RaspiCam?

We explain how to connect the Raspberry Pi camera module to a datarhei Restreamer.

Use Raspicam as video source for live streaming in datarhei Restreamer

Check that the device is installed correctly before the restreamer recognizes the camera module. As soon as the device is available on the host system, it is automatically displayed in the Restreamer.

There are several types of camera boards available for the Raspberry Pi. The official Raspberry Pi cameras can take high-resolution photos and Full HD 1080p videos and be fully controlled. After the installation in the "raspi-config" menu, all cameras can be used in the Restreamer for live streaming.

ATTENTION! Using the GPU with the Raspicam requires increasing the cache memory to 256 MB. >> To the guide <<

If unexpected behavior occurs, rebooting the Raspberry Pi might help.

If unexpected behavior occurs, restarting the datarhei Restreamer might help.

Note the video where we explain encoding over the GPU from the Raspberry Pi to offload the CPU from the Raspberry Pi.

Enabling the Pi Camera

If you have a Pi camera connected to your Raspberry Pi and you want capture a stream from it, you first need to make it available as a "video4linux" device.

Raspbian buster or earlier

On the console, type sudo modprobe bcm2835-v4l2 and restart Restreamer. Then you should be able to select the Pi camera in the wizard or advanced setup.

Raspbian bullseye

With the latest Raspbian (bullseye) the tools for the camera are based on libcamera which is not necessarly compatible with video4linux and is currently not supported by ffmpeg directly. In order to make the camera available as a video4linux device you have to switch it into legacy mode:

  1. Open /boot/config.txt in an editor, e.g. sudo nano /boot/config.txt

  2. Replace the line camera_auto_detect=1 with start_x=1

  3. Add gpu_mem=256 right after the line with start_x=1

  4. Replace the line with dtoverlay=vc4-kms-v3d with dtoverlay=vc4-fkms-v3d

  5. Save the file and exit the editor

  6. Reboot the Pi

After the Pi rebooted you should see the Pi camera option in the UI.

Alternatively, you can run sudo raspi-config and enable the legacy camera support in the Interface Options section. This will only allocate 128MB GPU memory and will only allow HD streaming (1280x720). If you want FullHD streaming (1920x1080), then open /boot/config.txt in an editor and change the line with gpu_mem=128 to gpu_mem=256.

Raspbian bookworm or later

With the release of Raspbian "bookworm", the legacy mode for the camera is not anymore available and the camera can't be accessed anymore directly from ffmpeg. We recommend to install Raspbian "bullseye" and follow the instructions above.

Learn more

pageUser GuidespageManual

Last updated