Saturday, 26 April 2025

Pi 5 Birdbox Webcam Setup (Restreamer)

Installing a H264 webcam on a Raspberry Pi.

The following can be completed in 15-30 minutes...

Ingredients

  • Memory Card for the Pi (e.g. 16Gb)
  • Raspberry Pi 5
  • USB Webcam


Installing The Operating System

On a Windows or Linux PC, Run the Raspberry Pi Imager, and Select:

  • Raspberry Pi 5
  • Select Rasberry Pi OS (64-bit)
  • Your memory card (e.g. 16Gb)

Edit Settings, and:

  • Set the device name, e.g. 'camserver'
  • Fill in your Username, Password, WiFi SSID and Password
  • Under 'Services', ensure that SSH is enabled, and select 'Use password authentication'

Then select Install, and wait.

Booting the Pi

Connect a webcam (preferably one supporting H.264)
Insert the memory card into the Pi, and power up
The LED will flash Red, then Green, and after that will blink green every time the memory card is accessed.
If the LED remains Red, this indicates that your power supply cannot provide sufficient current.

Logging In
ssh -l user camserver.local
Disabling USB Auto Suspend and Swapping to Memory Card

Modify the cmdline.txt to add an additional switch to the end, use systemctl to disable the swapfile and then reboot the device:

sudo vi /boot/firmware/cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=ef0fb16a-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles cfg80211.ieee80211_regdom=GB usbcore.autosuspend=-1
sudo systemctl disable dphys-swapfile.service
sync; sudo reboot

ssh -l user camserver.local

Install Docker
# Remove conflicting packages (from a fresh install, there should be none)
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done

# Add Docker's official GPG key:

sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/raspbian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:

echo "Add the repository to Apt sources:"
echo \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo apt-get -y update
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install Docker
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Test Docker

sudo docker run hello-world

Install Restreamer and Icecast2
sudo docker run -d --restart=always --name restreamer \
    -v /opt/restreamer/config:/core/config \
    -v /opt/restreamer/data:/core/data \
    --privileged \
    -p 8080:8080 \
    -p 8181:8181 \
    -p 1935:1935 \
    -p 1936:1936 \
    -p 6000:6000 \
    datarhei/restreamer:latest

sudo apt-get icecast2 


Locate the Webcam

lsusb

Bus 001 Device 013: ID 05a3:9331 ARC International Camera


v4l2-ctl --list-devices

HD Web Camera: HD Web Camera (usb-xhci-hcd.0-1):
/dev/video0
/dev/video1
/dev/media3

Configure Restreamer

Connect to: http://camserver.local:8080/ui/
  * Set admin username / password
  * Select video device /dev/video0
  * Select format: H.264, Framerate: 25, Size: 1920x1080, Probe
  * Select the H264 Stream
  * Select Codec: Passthrough / Copy
  * Select Audio source from webcam
  * Select 44100 rate, 1 channel and Probe
  * Select stream

Configure Icecast2

...







No comments:

Post a Comment