Benachrichtigungen
Alles löschen

Prusa Connect w/ RTSP Camera  

  RSS
SAVAGENYHK
(@savagenyhk)
Active Member
Prusa Connect w/ RTSP Camera

Has anyone tried the following method to send images to Prusa Connect thru a docker program? It basically grabs the images from any RTSP camera and sends them directly to Prusa Connect API. 

I'm not a savvy docker expert, but i do have a synology and i just want to know how do i create those containers to make this possible. I'm just not sure what to do with docker-compose.yml or upload.sh file with docker.... q

https://gist.github.com/nunofgs/84861ee453254823be6b069ebbce9ad2

https://www.reddit.com/r/prusa3d/comments/152ghuk/i_connected_my_cheap_wifi_tapo_c100_webcam_to/

Dieses Thema wurde geändert Vor 1 year von SAVAGENYHK
Veröffentlicht : 17/08/2023 11:36 am
SaveYourBacon
(@saveyourbacon)
Active Member
RE: Prusa Connect w/ RTSP Camera

That post did inspire me to create a script I can run on my Raspberry Pi to send snapshots using a USB camera:

!/bin/bash

# Set default values for environment variables
: "${HTTP_URL:= https://webcam.connect.prusa3d.com/c/snapshot }"
: "${DELAY_SECONDS:=60}"   
: "${LONG_DELAY_SECONDS:=180}"
: "${FINGERPRINT:=yourFingerPrint}"
: "${TOKEN:=yourToken}"

while true; do
    dt=$(date '+%Y/%m/%d %H:%M:%S');
    echo "Grabbing snapshot at $dt"    
    # Grab a frame from the USB webcam using fswebcam
    fswebcam -q -r 1280x720 -S 30 --font sans:20 --fps 30 --jpeg 70 --log WebcamErrors.log output.jpg

    # If no error, upload it.
    if [ $? -eq 0 ]; then
        # POST the image to the HTTP URL using curl
        curl -X PUT "$HTTP_URL" \
            -H "accept: */*" \
            -H "content-type: image/jpg" \
            -H "fingerprint: $FINGERPRINT" \
            -H "token: $TOKEN" \
            --data-binary "@output.jpg" 

        # Reset delay to the normal value
        DELAY=$DELAY_SECONDS
    else
        echo "Fswebcam returned an error. Retrying after ${LONG_DELAY_SECONDS}s..."

        # Set delay to the longer value
        DELAY=$LONG_DELAY_SECONDS
    fi

    sleep "$DELAY"
done

It works great for me; you could also use raspistill (instead of fswebcam) if you had a RPi camera. You would need to use the instructions provided in the GitHub post you linked to find your fingerprint and token (and then add them to the script).

Veröffentlicht : 01/09/2023 7:44 pm
Essbante
(@essbante)
Mitglied
RE: Prusa Connect w/ RTSP Camera

I'm using the script ^ and it works great 👍

Veröffentlicht : 03/09/2023 5:47 pm
Teilen: