Skip to main content

A minimalist service for streaming a webcam over HLS

Project description

OctoPrint Stuff

This is a collection of bits and bobs that make running Octoprint a tad easier.

The most notable component is webcamd which is a minimalist drop-in replacement for mjpeg_streamer.

  • Octoprint appends a seemingly-random session ID to the camera URI, which confuses the hell out of mjpg-streamer
  • mjpg-streamer doesn't appear to be capable of handle multiple simultaneous streams, resulting in the infuriating 403: Forbidden! frame already sent error
  • mjpg-streamer itself is complete overkill here

webcamd is based on Igor Maculan’s “Simple Python Motion Jpeg” daemon. It has been reworked to run under python-3.x, accept command-line arguments, to fine-tune the webcam streaming experience.

Note!

The user running webcamd must have sufficient access to the webcam device. On most Linux systems, this is as simple as adding the user to the video group. Otherwise the daemon will have to be run as root, which is NOT recommended.

webcam@.service is a systemd unit file for webcam.py.

haproxy.cfg is a configuration file for haproxy that actually works with non-ancient versions of haproxy, and enforces SSL connections to Octoprint.


webcamd Quickstart

Install Locally

$ pip install .

Run the module directly

$ python3 -m webcamd

Help and Usage

$ webcamd --help

Create a SystemD Service

Open the following file and copy these contents:

/etc/systemd/system/webcamd.service
___________________________________
[Unit]
Description=Webcam Daemon. A minimalist webcam streaming service.
After=network.online.target
Wants=network.online.target

[Service]
Type=simple
User=octoprint
Group=octoprint
ExecStart=/usr/bin/webcamd
ExecStop=killall -u webcam webcamd

[Install]
WantedBy=multi-user.target

Then restart the systemd daemon loader:

$ sudo systemctl daemon-reload

And enable the service, to allow the service to start automatically on boot:

$ sudo systemctl enable webcamd.service


Development

Install Locally with dev dependencies

$ pip install -e .[dev]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webcamd-1.0.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

webcamd-1.0.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file webcamd-1.0.0.tar.gz.

File metadata

  • Download URL: webcamd-1.0.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for webcamd-1.0.0.tar.gz
Algorithm Hash digest
SHA256 afa4c5b432b882ac82ff405ee2ae719bab1c52baace0fe8d73642460cba81c64
MD5 3d407db1207bf1acf87e5a852d052369
BLAKE2b-256 bbbb74ac42727d6c626b34feb5bc3543e833e1fb86230dcf85bdc6028956bdad

See more details on using hashes here.

File details

Details for the file webcamd-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: webcamd-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for webcamd-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99e99251686fd5a38221693d8cabfb9fa542e43b9639081ad2087b964694958d
MD5 7306450d7dab6d98b434f90aa7ef013c
BLAKE2b-256 b2d9c2a9af5ba6b6dc8c923e3a165cceee9fd4a8bb46ae879ad417eb27f2f8f6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page