signag / raspi-cam-srv

Web Server for Raspi Camera Access
MIT License
46 stars 6 forks source link

Using raspiCamSrv with OctoPrint #5

Open jesternberg opened 5 months ago

jesternberg commented 5 months ago

I am using raspiCamSrv with RPI5 and 2 cameras. Is it correct to have two versions of the service running on different ports to be able to use the multicam plugin? or is there a better solution.

Also since snapshots are not currently exported you cannot configure the snapshot url in OP. I tried the following path, based on video_feed, but it is not quite right. Using mimetype='multipart/x-mixed-replace, I do see the snapshot directly in a browser. OP is expecting the mimetype to be image/jpeg but with that as the mimetype, both OP and browser do not error but image is not displayed. Any suggestions as to what is wrong?

diff --git a/raspiCamSrv/home.py b/raspiCamSrv/home.py index c0ccb85..f6cc62f 100644 --- a/raspiCamSrv/home.py +++ b/raspiCamSrv/home.py @@ -48,6 +48,23 @@ def video_feed(): return Response(gen(Camera()), mimetype='multipart/x-mixed-replace; boundary=frame')

+def gen2(camera):

signag commented 5 months ago

If you look at the error message, you see "Device or resource busy"
This means that you have another process which uses the camera.

You cannot have multiple processes using the same camera.

I do not know what you have running on your system.
It seems that the raspiCamSrv service is running in the background

You can either run the service or start the Flask server manually.
Not both at the same time.

If you want to start manually, you need to stop the service first:
sudo systemctl stop raspiCamSrv.service

Remember: when booting the device, the service will start automatically.

bradley1999 commented 5 months ago

That's all fine, seems to be up and running, but now have a password problem! On first login after powering off, can't login with current password, and doesn't seem a way to reset it. The option to change password asks for current password.....

signag commented 5 months ago

The simplest way is to reset the database, which will remove the user and force new registration.

However, currently this will also reset the database for motion tracking. If you wanted to avoid this, the only way would be to use a SQLite client to access the database and remove the user entry in table 'user'.

If you don't mind losing all motion tracking events, proceed as follows: sudo systemctl stop raspiCamSrv.service cd ~/prg/raspi-cam-srv source .venv/bin/activate flask --app raspiCamSrv init-db sudo systemctl start raspiCamSrv.service

bradley1999 commented 5 months ago

Thanks, that's fixed it, don't need a record of motion. I realise a problem of my own making which produced the 5000 "device or resource busy" error........I had RaspiCamSrv running on boot using 5000, and then used service to restart it, so two processes running on same ip address.

I have a lot of test photos during testing which aren't needed, how do I delete them all?