mkuf / prind

print in docker - Deploy a containerized Klipper Stack for your 3D Printer
GNU General Public License v3.0
324 stars 82 forks source link

Libcamera (Pi Cam V3) support? #80

Closed boehser-enkel closed 1 year ago

boehser-enkel commented 1 year ago

Hi again :),

is it possible to support libcamera for e.g. Pi cam V3?

greetings

mkuf commented 1 year ago

Could you elaborate on what you'd like to be supported?
I'm not familiar with libcamera not with Pi Cam V3.

Can't the camera be used with ustreamer or do you expect other functionality?

boehser-enkel commented 1 year ago

Pi Cam V3 needs libcamera to work (and Bullseye i think). I looked at ustreamer and there is at least an issue with a feature request for the new cam. So we have to wait for that?

mkuf commented 1 year ago

Yes, we'll have to wait for ustreamer to support this.
You may link the issue you found here so we can keep track of it and update the dockerfile for ustreamer if necessary.

boehser-enkel commented 1 year ago

https://github.com/pikvm/ustreamer/issues/212

boehser-enkel commented 1 year ago

Yes, we'll have to wait for ustreamer to support this. You may link the issue you found here so we can keep track of it and update the dockerfile for ustreamer if necessary.

Hi. I've got a camera and experimented with it. Too much work will be needed for native support, but Raspberry offers "libcamerify", which works fine with uStreamer. On Raspberry OS, install libcamera-tools and run as follows: libcamerify ./ustreamer -r 1920x1080 --encoder=m2m-image.

mkuf commented 1 year ago

I don't think there is a way to get this work within the container, as the required packages are only available for raspberrypios.
We could try to mount the libcamerify binary and necessary libraries into the container.

I do not own a raspberry pi nor a camera 3 where I could verify if this approach works, so you'd have to do some testing if you want this to work with prind.

Alternatively, you may install ustreamer to your host and remove the webcam service from your override file.

boehser-enkel commented 1 year ago

I ran another container to stream the camera signal (so it's possible at all?) docker run --rm -it --network=host --privileged --tmpfs /dev/shm:exec -v /run/udev:/run/udev:ro -e MTX_PATHS_CAM_SOURCE=rpiCamera bluenviron/mediamtx:latest-rpi I can open the stream via VLC in my network but not inside the klipper container. Why is that?

Also Crownsnest could work? https://github.com/mainsail-crew/crowsnest

mkuf commented 1 year ago

Hey, I'm not familiar with the Image you mention.
What do you mean that klipper can not access it? Usually, you'll have to add the streaming link to the frontend (Mainsail, Fluidd, etc.) to view the stream. Maybe the container is able to output different formats, from which one is compatible with mjpeg?

Crowsnest currently does not provide a docker image and prind already provides a solution for multiple webcams described here: https://github.com/mkuf/prind#multiple-webcams.

boehser-enkel commented 1 year ago

Yes i treid to configure it inside mainsail. No picture is shown I tried with one methid via rtsp and one via http link

mkuf commented 1 year ago

You'll have to be able to access the WebRTC stream via your browser as described here: https://github.com/bluenviron/mediamtx#web-browsers-1 If this does not work, you'll have to get in touch with the mediamtx project, I can't assist you with that.

Also, make sure to correctly set up the webcam in your frontend, using the WebRTC profile and the port/path combination of the container image

boehser-enkel commented 1 year ago

You'll have to be able to access the WebRTC stream via your browser as described here: https://github.com/bluenviron/mediamtx#web-browsers-1 If this does not work, you'll have to get in touch with the mediamtx project, I can't assist you with that.

Also, make sure to correctly set up the webcam in your frontend, using the WebRTC profile and the port/path combination of the container image

Yes i am able to access the stream (Browser or VLC). Only Mainsail is not able to access it (via the same URL)

boehser-enkel commented 1 year ago

I Installed https://github.com/ayufan/camera-streamer/ on my host an can access it via browser on my RPI (http://IP:Port & /stream, /snapshot) but i am not able to access it inside mainsail for streaming

mkuf commented 1 year ago

You'll have to get in touch with the maintail community/devs to get this sorted out.
At this point, prind is not involved anymore and I can't help you with troubleshooting external software.