How can I change mjpg-streamer parameters on OctoPi?

You can change that via the config file octopi.txt. You can access it in two ways:

  • directly from the Pi: You can find the file at /boot/octopi.txt, just open it with your favorite text editor (e.g. nano), adjust it and then reboot your Pi (since the changes will only take effect at boot time)
  • from another computer: You can plug the OctoPi SD card into a card reader of your choice and plug that into another computer and open the card there. The file can then be found directly in the root directory of the SD card drive.

The file will look something like this:

### Configure which camera to use
#
# Available options are:
# - auto: tries first usb webcam, if that's not available tries raspi cam
# - usb: only tries usb webcam
# - raspi: only tries raspi cam
#
# Defaults to auto
#
#camera="auto"

### Additional options to supply to MJPG Streamer for the USB camera
#
# See https://github.com/foosel/OctoPrint/wiki/MJPG-Streamer-configuration
# for available options
#
# Defaults to a resolution of 640x480 px and a framerate of 10 fps
#
#camera_usb_options="-r 640x480 -f 10"

### additional options to supply to MJPG Streamer for the RasPi Cam
#
# See https://github.com/foosel/OctoPrint/wiki/MJPG-Streamer-configuration
# for available options
#
# Defaults to 10fps
#
#camera_raspi_options="-fps 10"

You can edit your camera's resolution and the refresh rate either via camera_usb_options (if it's an USB webcam) or camera_raspi_options (if it's the Raspberry Pi camera module). Just change the -r parameter to something different supported by your camera (-r <width>x<height>) and remove the # in front of the line or -- if you are running the RaspiCam -- add -x <width> -y <height> to the camera_raspi_options line and again remove the # in front of it. You can find the list of available options for USB webcams and the RaspiCam (they are different!) here:

An example for setting your USB webcam to 1280x720 px resolution and 20 frames per second would e.g. be this line:

camera_usb_options="-r 1280x720 -f 20"

An example for setting your USB webcam to 800x600 px resolution, 10 frames per second and YUVC mode (more CPU intensive, only use if your camera doesn't work otherwise or better yet get a camera that does) would be this line:

camera_usb_options="-r 800x600 -f 10 -y"

An example for setting your RaspiCam to the same parameters would be this line:

camera_raspi_options="-x 1280 -y 720 -fps 20"

Take note of the missing # in front in each of these examples!

8 Likes

Hello <
i can"t fix the camera...... do i have to remove all the # or not ? i have tried several options but nothing is working.
I do not understand it.... i have buy a new USB camera with a resolution 1280x720 with 30 fps i can't connect it in octoprint, the text show above is the same text on my SD card for raspberry, also the # exactly like the text above, the only thing i have change is the camera resolution to:
#camera_usb_options="-r 1280x720 -f 30 still not have connection , what i am doing wrong ??
please help me .....
kind regards
Enzo

you have to remove the #
every line that starts with a # will be ignored by the script

Also make sure that you don't use any plagins that could change the resolution like spaghettidetective

I did try to follow this:

-directly from the Pi: You can find the file at /boot/octopi.txt , just open it with your favorite text editor (e.g. nano ), adjust it and then reboot your Pi (since the changes will only take effect at boot time).

I tried to find this in the Octoprint Terminal but nothing happened. Commands such as "cd .." don't work either. How do you find this file within Octoprint?

The OctoPrint 'terminal' is for communication with your printer. You need to access it from the terminal of the Raspberry Pi, directly on it. Either through a connected screen, or via SSH. To find out more about what SSH is, there's guides all over the internet that explain it much better than I can here.

1 Like

Is there an available guide on troubleshooting bad performance with the camera stream? I'm currently only getting a frame every 5-10 seconds using the Pi Cam v2. I'm at 1080 right now but even 720 yields poor performance.

I have an issue with 2 different cameras. I started with the V2 Pi camera module and everything was working fine. Then I relocated it on the frame of my printer to a different local and it stopped working. So I ordered another one from Amazon and have the same problem. I need to trouble shoot why the cam stopped working. I'm getting the following error in OctoPrint:
"The webcam server is currently not running".

Thanks for the help.

Please open a new thread and attach the webcamd.log :slight_smile:

On OctoPi there are the following additional log files which you'll have to copy over via SSH or an SCP client such as WinSCP :

  • /var/log/webcamd.log : The log of the webcam server. If you are running into issues with your webcam not being recognized or stopping to work out of the blue, this is the log file that might contain the answer. :warning: Important: This log file is missing on some versions of OctoPi, if you can't find it please provide the output of journalctl -u webcamd instead.
1 Like

New thread created here:

The webcam server is currently not running - Get Help / Webcams - OctoPrint Community Forum

1 Like