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

### Additional options to supply to MJPG Streamer for the USB camera
# See
# 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
# 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!

Control Camera settings
Sjcam 5000 working with octoprint?
Adjusting Pi Camera without removing the SD card?
Webcam delay on octoprint
OctoPi Camera resolution won't change