I am trying to set up the webcam to run at 1080p 30fps smoothly using the HLS streamer on the latest beta version of Octoprint with the new camera stack.
What did you already try to solve it?
I have gone into the camera-streamer files, octoprint.txt files, and changed any resolution and framerate information I can find to what I need. I have also followed these topics to see if any of the information would help:
Currently trying this
Tried setting up restreamer with docker
I got close with restreamer but could not get the camera feed to start. Might need to do a fresh install on the SD card.
I have attempted the new camera stack version and while it had the correct aspect ratio, the resolution and overall quality suffered still even after changing configs. I just attempted setting it up using john's setup here, but it didnt work. I was about to reinstall a fresh image and try again since this one has been beaten on all day trying to get things to work.
Before doing that I will try the new camera stack version again and attempt to use webrtc and the plugin you recommended. I will update with my findings.
Edit: Set up the camera settings config following this post. Despite the setup I am still getting the same low FPS laggy video. My usb-default.conf looks like this:
### Options for USB based cameras
# The port on which the webcam server for the camera should listen on. If you have only
# one camera, leave at 8080. If you have more, change to 8081, 8082, etc. The primary
# camera will be considered the one with 8080.
PORT=8080
# The path to the camera device. Leave as is if you are using no or only one USB camera.
DEVICE=/dev/v4l/by-id/usb-*-video-index0
# The image format of the camera.
FORMAT=YUYV
# The resolution to set on the camera. Defaults to 1280x720.
WIDTH=1920
HEIGHT=1080
# The framerate to set on the camera. Defaults to 15fps.
FRAMERATE=30
# Additional options.
OPTIONS= --camera-options=powerlinefrequency=2
--camera-video.options=videogopsize=60
--camera-video.options=videobitratemode=0
--camera-video.options=videobitrate=4000000
I have been reading through that and this post and so far setting the image format to JPEG has fixed the choppy frame issue. I will try the USB camera config you mention above and see what it does.
When I run the v412-ctl command, I get the following:
Reading the documentation shows that the camera resolution should be set to the full resolution of the sensor, then have the specific video/snapshot/stream resolutions be 1080 (or whatever is desired) as to get the best quality. Is there a way to find what the full resolution of the sensor in my camera is? By changing the settings I have set thusfar, the latency is reduced and the framerate is close to 30fps (some stutters though). The last thing that seems to need attention is the image quality, which is most likely to do with the resolution issues I mentioned above.
That's how I've set it up and it seems that's as good as it's going to get, which I'm happy with. The main thing that helped was changing the image format from YUYV to MJPEG. Fps practically doubled. As far as the connection method, Ethernet wouldn't be feasible in its current location however I could run it on the 5ghz channel and see if it helps at all. The video stream is only 6mb/s so it shouldn't be too big of a burden on my R6700 router.
Interesting development. If I am on my home network and I connect to the Octopi using my external IP (effectively connecting through WAN) its smooth and fine. But when I connected from my phone on 5G full bars it was stuttering and struggling.