Better resolution image quality from web cam

What is the problem? Trying to increase resolution and quality of web cam and OctoLapse videos. I would like the web cam image to be of better quality when I full size the dashboard and would like OctoLapse to render either 720p or 1080p (preferred) video with better image quality.

What did you already try to solve it?
Referencing these articles



I'm using a PiCamv2.
As documented I changed the octopi.txt file to camera_raspi_options="-x 1280 -y 720 -fps 10"
This did nothing no matter what I set it to.
I then tried camera_usb_options="-r 1280x720 -f 10"
This worked in changing the resolution of the OctoLapse video, but it just looks like a blown up version of the 480p version. The video quality of the webcam during the print seemed unchanged.
I then tried camera_usb_options="-r 1920x1080 -f 10" and while the OctoLapse video size did increase, the quality went down signifigantly. Everything was blury. No way was it actually 1080p.

Logs (octoprint.log, serial.log or output on terminal tab at a minimum, browser error console if UI issue ... no logs, no support!)
OctoLapseTerminalLog.zip (15.1 KB)

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible)
Raspberry Pi 4 2GB (connected to 5V buck converter for power, large heat sink and fans)
Raspberry PiCam V2
Prusa i3 MK3S (connected via USB)

Recently updated everything.
OctoPi 0.17.0
OctoPrint 1.4.0
OctoLapse 0.4.0

Other Plugins installed:
Dashboard (1.14.0)
DisplayLayerProgress Plugin (1.22.1)
Filament Sensor NG (1.0.2)
Resource Monitor (0.2.3)
Tab Order (0.5.8)

For OctoPrint settings
WebCam
Stream URL /webcam/?action=stream
Timelapse Recordings
Snapshot URL http://127.0.0.1:8080/?action=snapshot
Path to FFMPEG /usr/bin/ffmpeg

For OctoPrint settings
Rendering: MP4 - 60FPS
Bitrate: 10000K
Camera: Webcam - Default OctoPi 0.16.0
Custom Image Preferences is unchecked (I get an error: Unable To Enable Custom Preferences)

This line in /boot/octopi.txt worked for me:

camera_raspi_options="-fps 5 -x 1280 -y 720 -quality 100"

after I changed:

#camera="auto"

to:

camera="raspi"

(I found that gem in the comments of the first article you posted)

So setting camera="raspi" allowed me to use the camera_raspi_options value, but I still get the same issue where resolution isn't actually increased, it just zooms in and gets blown up with worse quality.

It looks like my issue is related to this.

Basically 720p and 1080p are not supported resolutions on the PiCam. You must chose one of the resolutions here (must be Full FoV, not Partial FoV).
https://picamera.readthedocs.io/en/latest/fov.html#sensor-modes

Edit: Just tested with 1640x1232, and it worked. Huge improvement.
See post below on how to do it.

1 Like

I was not able to use 3280x2464. The image did not show up on the webcam. So looks like the best solution for PiCam is to set
camera="raspi"
camera_raspi_options="-x 1640 -y 1232 -fps 10 quality 100"
in /boot/octopi.txt

Sure we can increase resolution easily but the bitrate is not enough to support it. I get bad compression artifacts at 10Mbps? Netflix can stream you nearly 4k HDR UHD with that. Whereas here I can't get a reasonably clean 1640x1232.

I am testing the HLS streamer on the test server but I don't know how to change the bitrate. That server has the Pi HD Cam connected. It looks bad.

The production server is 1600x1200 but with that I can go localhost:8080 and change the bitrate to 25Mbps and it looks good.

I'm wondering how they released the HD Cam if there is no way to use its full resolution and a codec efficient enough to stream its image. So there is clearly something I am missing.