Skip to content

Latest commit

 

History

History
103 lines (63 loc) · 5.38 KB

README.md

File metadata and controls

103 lines (63 loc) · 5.38 KB

Pi 4b latency demo

Pi Camera

Transform your Raspberry Pi into a powerful home security camera with the Pi Camera app. Using peer-to-peer (P2P) communication over WebRTC to make a decentralized monitor system, this app connects directly to your Raspberry Pi, allowing you to monitor live video with minimal delay and access historical footage. [demo video]

Key Features

👉 Low-Latency Live Monitoring: Achieve extremely low-latency video streaming through WebRTC technology, ensuring you don’t miss any important moments.

👉 Playback of Historical Footage: Easily view and manage recorded videos to meet your security needs.

👉 Simple Setup: Quickly configure your Raspberry Pi camera through a user-friendly interface.

👉 Privacy Protection: Direct P2P connection without relying on third-party servers ensures that your data is fully under your control.

👉 Open-Source Support: The camera source code is fully open-source, allowing you to customize and extend it as needed.

Setting Up a New Raspberry Pi

Step 0: Prerequisites

  1. A Raspberry Pi with a camera module attached.

  2. A MQTT server. (STUN and TURN servers are optional).


Important Notice

  • MQTT Server (necessary): It must be over SSL/TLS! This server exchanges initialized signals (ICE, SDP) to help p2p hole-punching. Please use the same setting on your raspberry pi camera program. You can setup own MQTT server, or choose some free plans including but not limited to HiveMQ, EXMQ.
  • STUN Server (optional): If it's empty, the Google STUN server stun:stun.l.google.com:19302 will be used by default.
  • TURN Server (optional): This is used for a few mobile networks or specific scenarios. If your NAT setup doesn't allow for p2p hole-punching, the TURN Server will help relay data transfers.

Step 1: Set Configurations on the App

  1. Go to Setting Page.
  2. Click 🌐 icon and paste your servers setting. Here is an example mqtt setting shown on HiveMQ.
  • Notice! Please use WebSocket Port here!


Step 2: Add a New Device in the Setting Page

  1. Click ➕ icon

  2. The app will generate a UUID, which will be used on your Raspberry Pi later.
    If you'd like to assign a specific ID to the device, you can edit the UUID at the beginning. Once confirmed, the UUID cannot be edited; you will need to delete the device and add a new one if changes are needed.

  3. Enter a name in the "Alias", which can be edited at any time in the future.

  4. The new device will appear on the list after clicking the confirm button. You can change the order of devices on the selectors and home page by dragging the ☰ icon.

Step 3: Run Camera Software on Raspberry Pi

  1. Download the pi_webrtc software from the release page.

  2. Run the pi_webrtc on your Raspberry Pi. Here’s an example where the device uid is set to abcdefg-123-1qaz2wsx in the app.

    Important: The MQTT port specified in the command is NOT the WebSocket port (8884), but the standard MQTT protocol port (8883).

    /path/to/pi_webrtc --device=/dev/video0 --fps=30 --width=1280 --height=960 --v4l2_format=h264 --hw_accel --mqtt_host=example.s1.eu.hivemq.cloud --mqtt_port=8883 --mqtt_username=hakunamatata --mqtt_password=WonderfulPhrase --uid=abcdefg-123-1qaz2wsx --record_path=/mnt/ext_disk/video/

For detailed setup instructions, please refer to the guide on the RaspberryPi_WebRTC page.

Step 4: Verify the Connection

  • Please switch to the home page, the app will try to connect to Raspberry Pi.

  • If everything is correct, the status light will turn green.

  • The preview image is refreshed every 90 seconds, and it can be refreshed immediately by scrolling down the page.

Step 5: Share to Other Phones

  1. Click the share button on the phone that can connect to Raspberry Pi already. It'll show the QR code.

  2. Pick up the second phone click the QR code button in the add device section, and scan the QR code will copy the device, including the network setting, to the second phone. Notice! The network setting will be replaced in the second phone if set before.

Contact & Support

If you have any questions, need support, or just want to provide feedback, you can reach out via GitHub Issues. Thank you for using Pi Camera!