HomeKit Camera GStreamer
This Python library exposes GStreamer video sources as HomeKit cameras in Apple Home.
It can use Raspberry Pi Camera Modules, USB/webcams, PipeWire, and network streams as inputs. It automatically selects a supported encoder and lets multiple Apple devices view the video simultaneously.
Features
- Supports multiple simultaneous streams
- Streams can be served to multiple devices at the same time.
- An input source that supports simultaneous use by multiple clients is required, such as PipeWire or a network stream.
- Supports nearly every source supported by GStreamer
- PipeWire
- USB/webcams
- Raspberry Pi Camera Modules
- Screen capture (macOS / Windows; Wayland not yet supported)
- Network streams
- Files
- etc.
- Automatic H.264 encoder selection (
encodebin)openh264encv4l2h264encvtenc_h264- etc.
- Dynamic resolution changes while streaming
- The resolution can be changed during streaming in response to requests from HomeKit.
Tested Environments
- Raspberry Pi
- Model: Raspberry Pi 3 Model B Plus
- OS: Ubuntu Server 26.04 LTS
- Kernel: 7.0.0-1016-raspi
- Source: PipeWire
- Camera: Raspberry Pi Camera Module 2 (IMX219)
- Python: 3.14.4
- GStreamer: 1.28.2
- Encoder:
v4l2h264enc
- PC
- OS: Fedora Linux 44 (Workstation Edition)
- Source: PipeWire
- Camera: MJPEG camera
- Python: 3.14.6
- GStreamer: 1.28.6
- Encoder:
openh264enc
Installation
Debian (Ubuntu, Raspberry Pi OS)
sudo apt install gstreamer1.0-plugins-good gstreamer1.0-plugins-bad libgstreamer1.0-0 gir1.2-gst-plugins-base-1.0 python3-gst-1.0 python3-gi python3-pip
pip3 install https://github.com/Naka-Masa19/homekit-camera-gstreamer/releases/download/v1.0/homekit_camera_gstreamer-1.0-py3-none-any.whl --break-system-packages
macOS / Windows
pip3 install https://github.com/Naka-Masa19/homekit-camera-gstreamer/releases/download/v1.0/homekit_camera_gstreamer-1.0-py3-none-any.whl
The first startup may take some time.
Configuration Example (Camera via PipeWire)
1. Install PipeWire
sudo apt install pipewire wireplumber gstreamer1.0-pipewire
Cameras that use libcamera, such as Raspberry Pi Camera Modules, also require the following packages:
sudo apt install libspa-0.2-libcamera libcamera-ipaIf
libspa-0.2-libcamerais not available in your environment, try the following instead:sudo apt install pipewire-libcamera libcamera-ipa
2. Set the Default Camera
wpctl status
wpctl set-default [camera ID]
Replace
[camera ID]with the ID shown underSourcesin the output ofwpctl status.
3. Run
Choose the sample that matches the aspect ratio of the camera you want to use, and save it as camera.py.
- General-purpose cameras and Raspberry Pi Camera Module 3, among others
- Raspberry Pi Camera Module 1 / 2, among others
Run the saved file:
python3 camera.py
Depending on the environment,
pipewiresrcmay select a low resolution, a narrow field of view, or an unintended format. Updatesourcein the sample code as needed to match your camera. In particular, colors may not display correctly and the field of view may be narrow with Raspberry Pi Camera Modules.
4. Register as a Service
Place a file with the following contents at ~/.config/systemd/user/homekit-camera.service:
[Unit]
Description=HomeKit camera daemon
Wants=pipewire.service
After=pipewire.service network-online.target
[Service]
ExecStart=/usr/bin/python3 /home/USER/camera.py
Restart=on-failure
#WorkingDirectory=/home/USER/HomeKit
[Install]
WantedBy=default.target
Update the path in
ExecStartto match where you installed the program.
Test the service:
systemctl --user start homekit-camera.service
systemctl --user status homekit-camera.service
journalctl --user -f -u homekit-camera.service
Enable the service:
loginctl enable-linger $USER
systemctl --user enable --now homekit-camera.service
License
This project is released under the Apache License 2.0. For third-party license notices included with the sample code, see THIRD_PARTY_LICENSES.md.
Metadata
Release files for homekit-camera-gstreamer 1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| homekit_camera_gstreamer-1.1.tar.gz | 17.5 kB | Without provenance | Details for homekit_camera_gstreamer-1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| homekit_camera_gstreamer-1.1-py3-none-any.whl | Python 3 | none | any | Details for homekit_camera_gstreamer-1.1-py3-none-any.whl |
Total release size: 32.8 kB
Release files / homekit_camera_gstreamer-1.1.tar.gz
| Download URL | homekit_camera_gstreamer-1.1.tar.gz |
|---|---|
| Size | 17.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc3b8ff90aa3b92d35390fac54a10ee9bb9b466bb506b6d406ff1377a3a5bb1a
|
|
BLAKE2b-256 checksum How to use checksums |
e1b34a58371e2b7a49e45aed8c4d8e7dffcc0b585bf1416dd9723d369a5fe237
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / homekit_camera_gstreamer-1.1-py3-none-any.whl
| Download URL | homekit_camera_gstreamer-1.1-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0560dc867d77a049afb529dd926a1690a9dcc44411253356076692a20d11f9e5
|
|
BLAKE2b-256 checksum How to use checksums |
0b23414e5b5bb92cdc4c6ac766780949125d1b948bf680aa45ebdc2dd2e1c41d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for homekit-camera-gstreamer 1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.