Skip to main content

HomeKit Camera GStreamer

日本語

Tests (Debian) Tests (macOS) Lint

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.


Sample programs
Wiki

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)
    • openh264enc
    • v4l2h264enc
    • vtenc_h264
    • etc.
  • Dynamic resolution changes while streaming
    • The resolution can be changed during streaming in response to requests from HomeKit.

Requirements

Python

  • Linux: Python 3.10 or later
  • macOS and Windows: Python 3.12 or later

GStreamer

  • GStreamer 1.22.0 or later
  • GStreamer plugins: Good Plugins and Bad Plugins

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 45 (Workstation Edition)
    • Source: PipeWire
    • Camera: MJPEG camera
    • Python: 3.15.0
    • GStreamer: 1.28.8
    • Encoder: openh264enc

Installation

Debian / Ubuntu / Raspberry Pi OS

sudo apt update
sudo apt install python3-pip python3-gst-1.0 gstreamer1.0-plugins-good gstreamer1.0-plugins-bad
pip3 install -U homekit-camera-gstreamer --break-system-packages

Fedora

sudo dnf install python3-pip python3-gstreamer1 gstreamer1-plugins-good gstreamer1-plugins-bad-free gstreamer1-plugin-openh264
pip3 install -U homekit-camera-gstreamer

macOS / Windows

pip3 install -U homekit-camera-gstreamer

The GStreamer will be downloaded automatically from PyPI. 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-ipa

If libspa-0.2-libcamera is 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 under Sources in the output of wpctl status.

3. Run

Choose the sample that matches the aspect ratio of the camera you want to use, and save it as camera.py. You can check the available resolutions and aspect ratios of your camera with python3 -m gst_camera.

Sample code for 16:9 cameras

  • General-purpose cameras and Raspberry Pi Camera Module 3, among others

Sample code for 4:3 cameras

  • Raspberry Pi Camera Module 1 / 2, among others

Run the saved file:

python3 camera.py

Depending on the environment, pipewiresrc may select a low resolution, a narrow field of view, or an unintended format. Update source in 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 ExecStart to 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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for homekit-camera-gstreamer 1.2
File Size Uploaded Provenance Actions
homekit_camera_gstreamer-1.2.tar.gz 19.8 kB With provenance Details for homekit_camera_gstreamer-1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for homekit-camera-gstreamer 1.2
File Interpreter ABI Platform Actions
homekit_camera_gstreamer-1.2-py3-none-any.whl Python 3 none any Details for homekit_camera_gstreamer-1.2-py3-none-any.whl

Total release size: 36.5 kB

Release files / homekit_camera_gstreamer-1.2.tar.gz

Download URL homekit_camera_gstreamer-1.2.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1bf1bf8b372b57901ed4c026646499001392bf7414f18c92cd513fba0833175b
BLAKE2b-256 checksum
How to use checksums
3687b7f53e2f52718e67739c30b4aeda7c235f4b7138af51a659f673b492c6ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / homekit_camera_gstreamer-1.2-py3-none-any.whl

Download URL homekit_camera_gstreamer-1.2-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ba216554d2fbc48440c89b7e863541a5434e15800f7379e8bfcc6f8510a38b6
BLAKE2b-256 checksum
How to use checksums
d156e9fac9a019482d6cd44096b56bccf02c2ccc4b5242f1bd2eba58dd27a98c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for homekit-camera-gstreamer 1.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for homekit_camera_gstreamer-1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page