Controlling raspberry pi camera settings with active mjpegstreamer stream

I'm sorry to create a help request for a topic that's so often revisited, but I've been looking through the forums trying to find a way of adjusting a live mjpegstreamer stream from OctoPi when using an RPi camera all day, and so far nothing I have tried has worked:

  1. control.htm - This won't and can't work according to this issue.

  2. v4l2-ctl - Seems to accept commands, but doesn't seem to do anything at all to the stream. Stopping and restarting the stream also had no affect. I made sure to disconnect my usb webcam and reboot to make sure device selection wasn't a problem. Here is an example command I sent in case I'm doing something terribly wrong: v4l2-ctl --set-ctrl=brightness=1

  3. uvcdynctrl - I'm having trouble interpreting the output here, but following a few guides that were intended for use with usb webcams I wasn't able to change the raspberry pi cam image at all.

Can someone point me to a guide that shows how to change brightness, contract, etc. from a live mjpegstreamer stream for a pi cam using any method that works? Or am I on a wild goose chase?

OK, so I had some success. This is what I see when I browse to /webcam/control.htm now:

Previously this page said only Camera Null within the header. Unfortunately I have no idea why things have changed. I added bcm2835-v4l2 to /etc/modules, but have since removed it and I still get the populated control window. I did update my distro, but am having a hard time believing that made it work. I suppose I will need to do a fresh install to fully investigate.

Any thoughts?

So, I've verified that adding bcm2835-v4l2 to /etc/modules fixed control.htm for the raspi cam. However, loading it dynamically via modprobe didn't seem to work for me for whatever reason.

I need to do some more research and see if bcm2835-v4l2 works with the default mjpg-streamer input control or if it requires the raspicam input so.

1 Like

It's looking like the raspi cam doesn't work with the bcm2835-v4l2 module. It seems to work just fine if you use the default usb camera settings though. More to follow.

I know this is an old thread but I would like to ask you @FormerLurker , do you have working control.htm page with RPi Camera v2 in latest OctoPi?


Yes I do. See this guide for enabling camera controls within Octolapse for the raspberry pi camera. This will, as a side effect, also give you access to control.html. In fact, just performing the changes that load the raspicam driver and switching the octopi.txt (raspi to usb + allowing control.htm access) config as shown in the guide should be good enough if you don't care to use Octolapse to control the image. The Octolapse image preferences are pretty convenient though :slight_smile:

1 Like

:see_no_evil: When you mention someone who has an excellent Wiki on his GitHub project! Very good work @FormerLurker!!

One little thing discovered (I don't have access to edit directly in Wiki on GitHub). In case of RPi, there should be really only "auto". I had "raspi" and I was stuck here. After one hour of googling I discovered your comment where point 7 has an important thing:

it should NOT be set to raspi

So change it, please.

Glad to have helped. However, I don't understand what you want me to change in the wiki. Here is what I think you are talking about:

It clearly states to change 'auto' or 'raspi' to 'usb', including a before and after snapshot. However, if I can add clarifying language, I'd like to do that. FYI, there is also a video that follows this guide here, which I should probably link to in the wiki.

Edit: There IS a link to the video, lol! I missed it, even though there is a huge image at the top of the page. I guess I need to add a caption or another plan hyperlink below to make it more obvious.. Documentation is a pain :slight_smile:

such a pain!

1 Like

It should be “usb”? :open_mouth: It began work when I change “raspi” to “auto” :upside_down_face:

Auto may work too, I guess, since it is working for you :slight_smile: I may have to do a bit more research. However, raspi will definitely NOT work :slight_smile:

@FormerLurker Thank you for this guide! It was a life saver.

Were you able to get octolapse image preferences to work with this method? I'm able to get control.htm, however I do get this warning popup on load:

After I acknowledge that alert I'm presented with the controls as expected and the camera loads fine into Octoprint and the snapshot test within Octolapse is successful, I'm even able to get the Custom Image preferences enabled in the camera profile. However when I try to open the Image Preferences I get a generic error coming from: /plugin/octolapse/getWebcamImagePreferences

and returning:

{"error":"An unexpected error was raised while retrieving the input.json file for the 'Pi Cam' camera profile.","success":false}

I'm wondering if these errors could be related? and Perhaps octolapse also doesnt know about control type 9.

Apologies I'm fairly new to the scene, where can I go to see further logs about why getWebcamImagePreferences failed?

HI! Well, that error is a bug in mjpgstreamer, and it shouldn't affect Octolapse. IN fact, Octolapse should correctly render those controls. Can you create an issue on my github page ( and fill out the template? I do need some logs to figure it out though. Set your logging profile to 'log everything', then open the image preferences until you see the error. Close the dialog and switch your debug profile back to 'log all errors'. Edit the logging profile and click on the 'download log' button and include that in the template.

I won't need the entire template filled in, but please fill in the description, the octoprint/octolapse/python version, and attach the log file. Thanks!

Oh, regarding the log file, if it is short, and you can see the error clearly, just paste it in, else create a gist at, then paste a link in the issue. Thanks!

That log was purely enough for me to figure out the issue. Thanks for the tip!

I found this in the log:

  File "/home/pi/oprint/lib/python3.7/site-packages/urllib3/util/", line 392, in parse_url
    return six.raise_from(LocationParseError(source_url), None)
  File "<string>", line 3, in raise_from
urllib3.exceptions.LocationParseError: Failed to parse:

From that I noticed the error in the URL. I added a trailing / to the Base Address in the camera profile like so:

And the Image Preferences loaded right up!

I am getting an error loading the stream but I suspect that's a different issue and I'll go through your troubleshooting docs. I knew it had to be something silly. Thanks for the help!

1 Like