The-EG / OctoPrint-CameraSettings

An OctoPrint plugin that allows a user to interactively change camera settings.
GNU Affero General Public License v3.0
56 stars 7 forks source link

[FR] Raspicam - change resolution without a reboot? #24

Open Naugrimohtar opened 3 years ago

Naugrimohtar commented 3 years ago

So today I can change RaspiCam resolution via editing '/boot/octopi.txt' an then rebooting... Is there a way to change it on the fly? Incorporate into this plugin? This would be hugely helpful!

The-EG commented 3 years ago

I'll put this on the TODO list to research.

It's technically possible to send a request to set the resolution in a similar manner to how the controls are set, but since mjpg-streamer is expecting the stream to be of a particular size I'm not sure how well it would behave if it suddenly changes without warning.

uStreamer might work better since it seems to be able to handle changes and even a lack of the camera stream better...

In any case, this will require some testing and thought!

edit: FWIW, I think you can do that without a reboot already. Changing /boot/octopi.txt and then running sudo systemctl restart webcamd should work.

BobCraig10 commented 3 years ago

That would be a great addition to a WONDERFUL plugin! Great job!!

Naugrimohtar commented 3 years ago

Just as an asside sudo systemctl restart webcamd did work to try changes to /boot/octopi.txt

For those curious, I have two RaspiCam versions and here are the settings I found that work best for me: Old (V1 camera) camera_usb_options="-r 1296x972 -f 20"

New (V2 camera) camera_usb_options="-r 1280x960 -f 20"

The following website helped me learn more about the native resultions for them: Camera Modes

The-EG commented 3 years ago

If you ever want to use higher resolutions (at the cost of FPS), check out the modprobe options described: here. (uStreamer itself is also a nice alternative to mjpg-streamer)