How to set up a Raspberry Pi camera with Shinobi for reliable, 24/7 CCTV monitoring

This guide walks you through setting up a Raspberry Pi camera with Shinobi Open Source CCTV software. We’ll address common hardware, networking, and performance issues to create a stable monitoring solution that actually works on resource constrained d…


This content originally appeared on DEV Community and was authored by lvn1

This guide walks you through setting up a Raspberry Pi camera with Shinobi Open Source CCTV software. We'll address common hardware, networking, and performance issues to create a stable monitoring solution that actually works on resource constrained devices like the Raspberry Pi 2.

Prerequisites

  • Hardware: Raspberry Pi (tested on Pi 2), compatible CSI camera module (OV5647), reliable power supply, 32GB+ SD card
  • Software: Fresh Raspberry Pi OS installation, SSH client, network access
  • Network: Local network access and basic router configuration knowledge

My Setup

Step 1: Initial Raspberry Pi Setup

Start with a proper foundation to avoid headaches later.

Basic Configuration

  1. Flash Raspberry Pi OS: Use the official Raspberry Pi Imager for a clean Raspberry Pi OS Lite installation (headless) or with Desktop.

  2. Enable SSH: During imaging, enable SSH in the advanced options, or enable it post-boot with sudo raspi-config.

  3. First Boot: Connect via SSH and update everything:

   sudo apt-get update && sudo apt-get upgrade -y

Camera Hardware Verification

Before installing anything, verify your camera actually works:

libcamera-hello -t 2000

You should see a 2-second preview (on connected display) or the command should complete without "camera not found" errors. If this fails, check your ribbon cable connection - everything else depends on this working.

Step 2: Installing Shinobi

The official installer handles most of the heavy lifting, but you need to know the specific steps.

Run the Official Installer

  1. Switch to root and run installer:
   sudo su
   sh <(curl -s https://cdn.shinobi.video/installers/shinobi-install.sh)
  1. Select "Ubuntu Touchless" when prompted - this works best for Raspberry Pi installations.

  2. Handle IPv6 prompt: If asked about disabling IPv6, choose "Yes" to avoid connectivity issues during installation.

Critical Network Configuration Fix

Here's the part most guides miss: Shinobi will only bind to IPv6 by default, making it inaccessible from other devices on your network.

  1. Edit the configuration file:
   sudo nano /home/Shinobi/conf.json
  1. Add the IP parameter (not "host") at the beginning of the JSON:
   {
      "ip": "192.168.20.15",
      "port": 8080,
      ...

Replace 192.168.20.15 with your actual Pi's IP address.

  1. Restart Shinobi:
   sudo pm2 restart camera
  1. Verify it's working:
   sudo netstat -tlnp | grep :8080

You should see both tcp and tcp6 entries, not just tcp6.

Initial Shinobi Setup

  1. Access the superuser panel: Open http://YOUR_PI_IP:8080/super in your browser.

  2. Default credentials:

    • Username: admin@shinobi.video
    • Password: admin
  3. Create your admin account through the superuser panel.

  4. Log into main interface: Access http://YOUR_PI_IP:8080 (without /super) using your new credentials.

  5. Change superuser credentials immediately in the Preferences tab for security.

Step 3: Camera Streaming Pipeline

Create a reliable video stream that Shinobi can actually connect to.

Install Required Packages

sudo apt-get install -y gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad netcat-openbsd

Create the Streaming Script

  1. Create the script file:
   nano /home/first/streamscript
  1. Add this pipeline (optimized for reliability over quality):
   #!/bin/bash

   # Reliable MJPEG stream using software encoding
   # Hardware encoding isn't available on older Pi models

   BOUNDARY="--boundary"

   PIPELINE="gst-launch-1.0 -q libcamerasrc ! video/x-raw,width=320,height=240,framerate=10/1 ! jpegenc ! multipartmux boundary=${BOUNDARY} ! filesink location=/dev/stdout"

   while true; do
     {
       echo -e "HTTP/1.0 200 OK\r\nContent-Type: multipart/x-mixed-replace; boundary=${BOUNDARY}\r\n";
       ${PIPELINE};
     } | nc -l -p 8090
   done
  1. Make it executable:
   chmod +x /home/first/streamscript

Step 4: Background Service Setup

Set up automatic startup and crash recovery using systemd user services.

Create the Service

  1. Create service directory:
   mkdir -p ~/.config/systemd/user/
  1. Create service file:
   nano ~/.config/systemd/user/shinobi-stream.service
  1. Add service configuration:
   [Unit]
   Description=Shinobi Camera Streamer
   Wants=graphical-session.target
   After=graphical-session.target

   [Service]
   ExecStart=/home/first/streamscript
   Restart=always
   RestartSec=5

   [Install]
   WantedBy=default.target

Enable and Start

Run these commands without sudo (important for user services):

systemctl --user daemon-reload
systemctl --user enable shinobi-stream.service
systemctl --user start shinobi-stream.service

Enable Auto-Start on Boot

This crucial step makes the service start even when you're not logged in:

sudo loginctl enable-linger first

Reboot your Pi to test everything starts correctly.

Step 5: Configure Shinobi Monitor

Connect Shinobi to your camera stream.

  1. Add new monitor: Click the + icon in Shinobi dashboard.

  2. Connection settings:

    • Input Type: MJPEG
    • Full URL Path: http://127.0.0.1:8090
  3. Stream settings:

    • Frame Rate: 10
    • Width: 320
    • Height: 240
  4. Save and test: You should see live video immediately.

Step 6: Performance Tuning

Resource-constrained hardware requires careful balance between quality and performance.

Understanding the Limitations

Older Raspberry Pi models lack hardware video encoders that GStreamer can access. Everything runs on CPU, so optimization is critical.

Tuning Parameters

Adjust the PIPELINE variable in /home/first/streamscript:

For better performance (lower CPU usage):

PIPELINE="gst-launch-1.0 -q libcamerasrc ! video/x-raw,width=160,height=120,framerate=5/1 ! jpegenc quality=50 ! multipartmux boundary=${BOUNDARY} ! filesink location=/dev/stdout"

For better quality (higher CPU usage):

PIPELINE="gst-launch-1.0 -q libcamerasrc ! video/x-raw,width=640,height=480,framerate=15/1 ! jpegenc quality=90 ! multipartmux boundary=${BOUNDARY} ! filesink location=/dev/stdout"

Monitor CPU usage with htop and adjust accordingly.

Troubleshooting Common Issues

"Can't Access from Other Devices"

This is usually the IPv4/IPv6 binding issue:

  1. Check what Shinobi is listening on:
   sudo netstat -tlnp | grep :8080
  1. If you only see tcp6, check your config:
   sudo grep -A3 -B3 '"ip"' /home/Shinobi/conf.json
  1. Make sure you used "ip" not "host" parameter.

"Stream Won't Start"

  1. Check service status:
   systemctl --user status shinobi-stream.service
  1. View service logs:
   journalctl --user -u shinobi-stream.service -f
  1. Test camera directly:
   libcamera-hello -t 2000

"High CPU Usage"

  1. Lower resolution and framerate in your streamscript.
  2. Reduce JPEG quality by adding quality=50 to jpegenc.
  3. Check for multiple streams running accidentally.

Security Considerations

Network Security

  • Change default Shinobi credentials immediately after setup
  • Don't expose port 8080 to the internet via router port forwarding
  • Use strong passwords for all accounts
  • Consider firewall rules to limit access to specific IP ranges:
  sudo ufw allow from 192.168.0.0/16 to any port 8080

System Security

  • Change default Pi password if you haven't already
  • Keep system updated with regular sudo apt update && sudo apt upgrade
  • Monitor access logs in Shinobi's admin panel

Final Notes

This setup prioritizes reliability over fancy features. You'll have a stable, 24/7 monitoring solution that actually works on older hardware. The key insights that make this work:

  1. Use software encoding - hardware encoders aren't reliably available
  2. Fix the IPv4 binding issue - use "ip" parameter, not "host"
  3. Proper systemd service setup - ensures automatic recovery
  4. Conservative performance settings - prevents crashes under load

Once you have this basic setup running reliably, you can experiment with higher resolutions, multiple cameras, or advanced Shinobi features.


This content originally appeared on DEV Community and was authored by lvn1


Print Share Comment Cite Upload Translate Updates
APA

lvn1 | Sciencx (2025-09-17T03:30:57+00:00) How to set up a Raspberry Pi camera with Shinobi for reliable, 24/7 CCTV monitoring. Retrieved from https://www.scien.cx/2025/09/17/how-to-set-up-a-raspberry-pi-camera-with-shinobi-for-reliable-24-7-cctv-monitoring/

MLA
" » How to set up a Raspberry Pi camera with Shinobi for reliable, 24/7 CCTV monitoring." lvn1 | Sciencx - Wednesday September 17, 2025, https://www.scien.cx/2025/09/17/how-to-set-up-a-raspberry-pi-camera-with-shinobi-for-reliable-24-7-cctv-monitoring/
HARVARD
lvn1 | Sciencx Wednesday September 17, 2025 » How to set up a Raspberry Pi camera with Shinobi for reliable, 24/7 CCTV monitoring., viewed ,<https://www.scien.cx/2025/09/17/how-to-set-up-a-raspberry-pi-camera-with-shinobi-for-reliable-24-7-cctv-monitoring/>
VANCOUVER
lvn1 | Sciencx - » How to set up a Raspberry Pi camera with Shinobi for reliable, 24/7 CCTV monitoring. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/17/how-to-set-up-a-raspberry-pi-camera-with-shinobi-for-reliable-24-7-cctv-monitoring/
CHICAGO
" » How to set up a Raspberry Pi camera with Shinobi for reliable, 24/7 CCTV monitoring." lvn1 | Sciencx - Accessed . https://www.scien.cx/2025/09/17/how-to-set-up-a-raspberry-pi-camera-with-shinobi-for-reliable-24-7-cctv-monitoring/
IEEE
" » How to set up a Raspberry Pi camera with Shinobi for reliable, 24/7 CCTV monitoring." lvn1 | Sciencx [Online]. Available: https://www.scien.cx/2025/09/17/how-to-set-up-a-raspberry-pi-camera-with-shinobi-for-reliable-24-7-cctv-monitoring/. [Accessed: ]
rf:citation
» How to set up a Raspberry Pi camera with Shinobi for reliable, 24/7 CCTV monitoring | lvn1 | Sciencx | https://www.scien.cx/2025/09/17/how-to-set-up-a-raspberry-pi-camera-with-shinobi-for-reliable-24-7-cctv-monitoring/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.