{"id":19355452,"url":"https://github.com/TzuHuanTai/RaspberryPi-WebRTC","last_synced_at":"2025-04-23T09:32:57.834Z","repository":{"id":44451714,"uuid":"490155405","full_name":"TzuHuanTai/RaspberryPi-WebRTC","owner":"TzuHuanTai","description":"Turn your Raspberry Pi into a low-latency home security camera by using native WebRTC with the v4l2 hardware H.264 encoder and the software-based OpenH264 encoder for live video stream.","archived":false,"fork":false,"pushed_at":"2025-04-08T03:34:43.000Z","size":28798,"stargazers_count":857,"open_issues_count":19,"forks_count":37,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T11:05:09.655Z","etag":null,"topics":["cpp","encoding","ffmpeg","h264","libcamera","raspberry-pi","security-camera","v4l2","video","webrtc","webrtc-video"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TzuHuanTai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["TzuHuanTai"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://paypal.me/TzuHuanTai"]}},"created_at":"2022-05-09T06:06:35.000Z","updated_at":"2025-04-09T00:11:56.000Z","dependencies_parsed_at":"2023-12-02T07:23:14.992Z","dependency_job_id":"0a0c0f40-b038-4082-8333-d07f3e6c90ec","html_url":"https://github.com/TzuHuanTai/RaspberryPi-WebRTC","commit_stats":{"total_commits":325,"total_committers":3,"mean_commits":"108.33333333333333","dds":0.006153846153846176,"last_synced_commit":"0103c7a3587dc4b990d030bac68c7d82fcdd1558"},"previous_names":["tzuhuantai/raspberrypi-webrtc","tzuhuantai/raspberrypi_webrtc"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TzuHuanTai%2FRaspberryPi-WebRTC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TzuHuanTai%2FRaspberryPi-WebRTC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TzuHuanTai%2FRaspberryPi-WebRTC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TzuHuanTai%2FRaspberryPi-WebRTC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TzuHuanTai","download_url":"https://codeload.github.com/TzuHuanTai/RaspberryPi-WebRTC/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250407558,"owners_count":21425516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","encoding","ffmpeg","h264","libcamera","raspberry-pi","security-camera","v4l2","video","webrtc","webrtc-video"],"created_at":"2024-11-10T06:01:09.887Z","updated_at":"2025-04-23T09:32:57.827Z","avatar_url":"https://github.com/TzuHuanTai.png","language":"C++","readme":"\u003ch1 align=\"center\"\u003e\r\n    Raspberry Pi WebRTC\r\n\u003c/h1\u003e\r\n\r\n\u003cp align=\"center\"\u003e\r\n    \u003ca href=\"https://chromium.googlesource.com/external/webrtc/+/branch-heads/5790\"\u003e\u003cimg src=\"https://img.shields.io/badge/libwebrtc-m115.5790-red.svg\" alt=\"WebRTC Version\"\u003e\u003c/a\u003e\r\n    \u003cimg src=\"https://img.shields.io/github/downloads/TzuHuanTai/RaspberryPi_WebRTC/total.svg?color=yellow\" alt=\"Download\"\u003e\r\n    \u003cimg src=\"https://img.shields.io/badge/C%2B%2B-20-brightgreen?logo=cplusplus\"\u003e\r\n    \u003cimg src=\"https://img.shields.io/github/v/release/TzuHuanTai/RaspberryPi_WebRTC?color=blue\" alt=\"Release\"\u003e\r\n    \u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache_2.0-purple.svg\" alt=\"License Apache\"\u003e\u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n\u003cp align=center\u003e\r\n    \u003cimg src=\"doc/pi_4b_latency_demo.gif\" alt=\"Pi 4b latency demo\"\u003e\r\n\u003c/p\u003e\r\n\r\nTurn your Raspberry Pi into a low-latency security camera using the hardware encoder and WebRTC.\r\n\r\n- Supports real-time adjustment of camera parameters and video recording download.\r\n- Support [multiple users](doc/pi_4b_users_demo.gif) for simultaneous live streaming.\r\n- Support signaling \r\n\r\n  **MQTT**\r\n    * [picamera.js](https://www.npmjs.com/package/picamera.js)\r\n    * [picamera-react-nadive](https://www.npmjs.com/package/picamera-react-native)\r\n    * [picamera-app](https://github.com/TzuHuanTai/picamera-app) *(demo application)*\r\n    * [picamera-web](https://picamera.live) *(demo application)*\r\n\r\n  **[WHEP](https://www.ietf.org/archive/id/draft-ietf-wish-whep-02.html)**\r\n    * [Home Assistant](https://www.home-assistant.io)\r\n    * [eyevinn/webrtc-player](https://www.npmjs.com/package/@eyevinn/webrtc-player)\r\n- 🎥 [Watch demo](https://www.youtube.com/watch?v=JZ5bcSAsXog)\r\n\r\n\r\n# Quick Start\r\n\r\nTo set up the environment, please check out the [tutorial video](https://youtu.be/g5Npb6DsO-0) or the steps below.\r\n\r\n## Hardware Requirements\r\n\r\n\u003cimg src=\"https://assets.raspberrypi.com/static/51035ec4c2f8f630b3d26c32e90c93f1/2b8d7/zero2-hero.webp\" height=\"96\"\u003e\r\n\r\n* Raspberry Pi (Zero 2W/3B/3B+/4B/5).\r\n* CSI or USB Camera Module.\r\n\r\n## Environment Setup\r\n\r\n### 1. Install Raspberry Pi OS\r\n\r\nUse the [Raspberry Pi Imager](https://www.raspberrypi.com/software/) to install Raspberry Pi Lite OS on your microSD card.\r\n\r\n\u003cdetails\u003e\r\n  \u003csummary\u003e\r\n    \u003cb\u003e💡 Can I use a regular Raspberry Pi OS, or does it have to be Lite?\u003c/b\u003e\r\n  \u003c/summary\u003e\r\n\r\n\u003e You can use either the Lite or full Raspberry Pi OS (the official recommended versions), but Lite OS is generally more efficient.\r\n\r\n\u003c/details\u003e\r\n\r\n### 2. Install Dependencies\r\n\r\n```bash\r\nsudo apt update\r\nsudo apt full-upgrade\r\nsudo apt install libmosquitto1 pulseaudio libavformat59 libswscale6\r\n```\r\n\r\n### 3. Download \u0026 Unpack\r\n\r\nPrepare the binary file from [Releases](https://github.com/TzuHuanTai/RaspberryPi_WebRTC/releases).\r\n```bash\r\nwget https://github.com/TzuHuanTai/RaspberryPi_WebRTC/releases/latest/download/pi_webrtc-v1.0.6-rc.3_raspios-bookworm-arm64.tar.gz\r\ntar -xzf pi_webrtc-v1.0.6-rc.3_raspios-bookworm-arm64.tar.gz\r\n```\r\n\r\n### 4. Set Up MQTT\r\n\r\nYou can use a free cloud MQTT service like  [HiveMQ](https://www.hivemq.com) or [EMQX](https://www.emqx.com/en), or set up your own self-hosted broker.\r\n\r\n\u003cdetails\u003e\r\n  \u003csummary\u003e\r\n    \u003cb\u003e💡 Is MQTT registration necessary, and why is MQTT needed?\u003c/b\u003e\r\n  \u003c/summary\u003e\r\n\r\n\u003e MQTT is one option for signaling P2P connection information between your camera and the client UI. WHEP, on the other hand, runs an HTTP service locally and does not require a third-party server. It is only suitable for devices with a public hostname. If you choose to self-host an MQTT server (e.g., [Mosquitto](doc/SETUP_MOSQUITTO.md)) and need to access the signaling server remotely via mobile data, you may need to set up DDNS, port forwarding, and SSL/TLS.\r\n\r\n\u003c/details\u003e\r\n\r\n## Running the Application\r\n\r\n* Set up the MQTT settings on your [Pi Camera App](https://github.com/TzuHuanTai/Pi-Camera-App) or [Pi Camera Web](https://picamera.live), and create a new device in the **Settings** page to get a `UID`. \r\n* Run the command based on your network settings and `UID` on the Raspberry Pi:\r\n    ```bash\r\n    ./pi_webrtc \\\r\n        --camera=libcamera:0 \\\r\n        --fps=30 \\\r\n        --width=1280 \\\r\n        --height=960 \\\r\n        --use_mqtt \\\r\n        --mqtt_host=your.mqtt.cloud \\\r\n        --mqtt_port=8883 \\\r\n        --mqtt_username=hakunamatata \\\r\n        --mqtt_password=Wonderful \\\r\n        --uid=your-custom-uid \\\r\n        --no_audio \\\r\n        --hw_accel # Only Pi Zero 2W, 3B, 4B support hw encoding\r\n    ```\r\n\r\n\u003e [!IMPORTANT]\r\n\u003e Use `--hw_accel` for Pi Zero 2W, 3B, 3B+, and 4B. Remove for Pi 5 or devices without hardware encoding.\r\n\r\n* Go to the Live page to enjoy real-time streaming!\r\n\r\n\u003cp align=center\u003e\r\n    \u003cimg src=\"doc/web_live_demo.jpg\" alt=\"Pi 5 live demo on web\"\u003e\r\n\u003c/p\u003e\r\n\r\n# [Advance](https://github.com/TzuHuanTai/RaspberryPi_WebRTC/wiki/Advanced-Settings)\r\n\r\n- [Using the V4L2 Driver](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#using-the-legacy-v4l2-driver) (for usb camera)\r\n- [Run as Linux Service](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#run-as-linux-service)\r\n- [Recording](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#recording)\r\n- [Two-way communication](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#two-way-communication)\r\n- [Virtual Camera](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings##virtual-camera)\r\n- [WHEP with Nginx proxy](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#whep-with-nginx-proxy)\r\n- [Use WebRTC Camera in Home Assistant](https://github.com/TzuHuanTai/RaspberryPi-WebRTC/wiki/Advanced-Settings#use-webrtc-camera-in-home-assistant)\r\n","funding_links":["https://github.com/sponsors/TzuHuanTai","https://paypal.me/TzuHuanTai"],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTzuHuanTai%2FRaspberryPi-WebRTC","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTzuHuanTai%2FRaspberryPi-WebRTC","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTzuHuanTai%2FRaspberryPi-WebRTC/lists"}