Coder Social home page Coder Social logo

prusa_connect_rtsp's Introduction

What is prusa-connect-rtsp?

Inspired by nunofgs on GitHub and with the help of BillyAB, this project simplifies using RTSP and MJPEG cameras with Prusa Connect.

FFmpeg is used to take periodic snapshots of an RTSP or MJPEG camera stream, then curl is used to pass it through to the Prusa Connect Camera API. By default, snapshots are taken and sent every 10 seconds, with an additional interval of 1 second per camera configured.

Personally, I have it running 5 RTSP streams from Eufy C24 Wi-Fi cameras on a single Raspberry Pi Zero 2W, without issue.

Getting Prusa Connect Tokens

It's best to consult Prusa's official documentation, as the interface may change over time, but the steps below should point you in the right direction:

  1. Open Prusa Connect web interface
  2. On a printer dashboard, go to the Camera tab
  3. Click Add new other camera
  4. Give the camera a name (optional)
  5. Copy the token
  6. Paste the token in to your docker-compose file or docker command

Note: If setting up multiple cameras, the order of your camera stream URLs should match the order of your tokens.

Usage

Camera stream URLs and Prusa Connect tokens are passed through to the script using environment variables. Single camera stream URLs and tokens can be specified, or multiples can be added by separating them with a comma. Below are some examples of how to run the container using Docker Compose or the Docker CLI.

docker compose (recommended)

version: '3.8'
services:
  prusa_connect_rtsp:
    image: jtee3d/prusa_connect_rtsp:latest
    restart: always
    environment:
      CAMERA_URLS: >
        rtsp://username:[email protected]/live0,
        http://username:[email protected]/stream.mjpeg,
        rtsp://username:[email protected]/live0
      TOKENS: >
        5dvoIByhfG7AeODTiNNk,
        MdVaUadfw93MBdlZSlqM,
        fejnJhrhCGncXsDU0R8S

docker cli

docker run \
  -e CAMERA_URLS="\
rtsp://username:[email protected]/live0,\
http://username:[email protected]/stream.mjpeg,\
rtsp://username:[email protected]/live0" \
  -e TOKENS="\
5dvoIByhfG7AeODTiNNk,\
MdVaUadfw93MBdlZSlqM,\
fejnJhrhCGncXsDU0R8S" \
  jtee3d/prusa_connect_rtsp:latest

Optionally, the following environmental values can be speficified:

  • FRAME_CAPTURE_DELAY (default: 1, used as the delay between multiple cameras)
  • CAMERA_CYCLE_DELAY (default: 10, used as the delay after all cameras have been processed, before looping through them again)
  • CONNECTION_TIMEOUT_DELAY (default: 5, timeout for ffmpeg and curl)

Links

Docker Hub: jtee3d/prusa_connect_rtsp

GitHub: jtee3d/prusa_connect_rtsp

Support

If you would like to support this Docker build, please feel free to buy me a coffee!

prusa_connect_rtsp's People

Contributors

jtee3d avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

prusa_connect_rtsp's Issues

Stops working after a few days

I'm running this on Linux Mint along with a couple of other Docker containers. I've noticed this stops streaming images to Prusa Connect after running fine for a few days. Docker ps shows it is still running but docker stats looks like the script is idle. Doing a docker restart on the container restores streaming. This scenario has happened a couple of times. Just a minor annoyance.

I'm not knowledgeable enough of docker to know how to see what might be causing this.

Is it possible to create addon for Home Assistant?

Hello!
Can someone create this as an addon to Home Assistant?
Home Assistants Supervised do not like additional software, outside of the Home Assistant ecosystem, is installed.
So if this script with docker-composed run HA starts to show the issue...

Error messags in docker logs

I was able to get the docker up and running on my synology NAS, but am getting the following notices in the console - I've sanitized userid/password and the token:

Processing camera: 1
URL: rtsp://hidden:hidden@hidden:554/stream1
Token: hidden
Fingerprint: camera0000000001

[rtsp @ 0x7ff60b2ba600] method DESCRIBE failed: 406 Not Acceptable
[in#0 @ 0x7ff60b3edac0] Error opening input: Server returned 4XX Client Error, bu
t not one of 40{0,1,3,4}
Error opening input file rtsp://hidden:hidden@hidden:554/stream1.
Error opening input files: Server returned 4XX Client Error, but not one of 40{0,
1,3,4}
FFmpeg returned an error for camera 1.

Any ideas?

Fingerprint not valid

I appreciate this script, thank you for your efforts!
Unfortunately, it seems that a Fingerprint is still needed. I get this error:

{"message": "Fingerprint is not valid", "code": "FORBIDDEN_INVALID_FINGERPRINT"}Processing camera: 1

kind regards
Sebastian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.