Available mjpg-streamer configuration options


#1

The following configuration options can be supplied to MJPG Streamer on start to modify certain camera settings. To change any of these options in OctoPi, edit the relevant sections in octopi.txt as described here.

USB webcams (input_uvc.so)

input_uvc.so comes bundled with MJPG Streamer.

  • -d <device>: The video device to use, e.g. -d /dev/video0
  • -r <resolution>: The resolution, e.g. -r 640x480 for 640x480px
  • -f <framerate>: The framerate in frames per second, e.g. -f 10 for 10 fps
  • -q <quality>: The quality of the JPG compression to use, e.g. -q 85 for compression down to 85%
  • -y: Use this if your camera doesn't support MJPG, pictures will be captured in YUVY

Raspicam (input_raspi.so)

input_raspi.so is included in this MJPG Streamer fork by Jackson Liam which also supports the Raspberry Pi Camera. This is the fork that is shipped on the OctoPi SD card image for the Raspberry Pi.

  • -fps or --framerate: set video framerate, default 1 frame/sec
  • -x or --width: width of frame capture, default 640
  • -y or --height: height of frame capture, default 480
  • -quality: set JPEG quality (0 to 100), default 85
  • -usestills: uses stills mode instead of video mode
  • -sh: Set image sharpness (-100 to 100)
  • -co: Set image contrast (-100 to 100)
  • -br: Set image brightness (0 to 100)
  • -sa: Set image saturation (-100 to 100)
  • -ISO: Set capture ISO
  • -vs: Turn on video stablisation
  • -ev: Set EV compensation
  • -ex: Set exposure mode, valid values (according to the RaspiCam documentation):
    • off
    • auto: Use automatic exposure
    • night: Select setting for night shooting
    • nightpreview
    • backlight: Select setting for back-lit subject
    • spotlight
    • sports: Select setting for sports (fast shutter etc.)
    • snow: Select setting optimized for snowy scenery
    • beach: Select setting optimized for beach
    • verylong: Select setting for long exposures
    • fixedfps: Constrain fps to a fixed value
    • antishake: Antishake mode
    • fireworks: Select setting optimized for fireworks
  • -awb: Set AWB mode, valid values (according to the RaspiCam documentation):
    • off: Turn off white balance calculation
    • auto: Automatic mode (default)
    • sun: Sunny mode
    • cloudshade: Cloudy mode
    • tungsten: Tungsten lighting mode
    • fluorescent: Fluorescent lighting mode
    • incandescent: Incandescent lighting mode
    • flash: Flash mode
    • horizon: Horizon mode
  • -ifx: Set image effect (according to the RaspiCam documentation):
    • none: No effect
    • negative: Produces a negative image
    • solarise: Solarise the image
    • whiteboard: Whiteboard effect
    • blackboard: Blackboard effect
    • sketch: Sketch-style effect
    • denoise: Denoise the image
    • emboss: Embossed effect
    • oilpaint: Oil paint-style effect
    • hatch: Cross-hatch sketch style
    • gpen: Graphite sketch style
    • pastel: Pastel effect
    • watercolour: Watercolour effect
    • film: Grainy film effect
    • blur: Blur the image
    • saturation: Colour-saturate the image
    • colourswap: Not fully implemented
    • washedout: Not fully implemented
    • posterise: Not fully implemented
    • colourpoint: Not fully implemented
    • colourbalance: Not fully implemented
    • cartoon: Not fully implemented
  • -cfx: Set colour effect (U:V), the supplied U and V parameters (range 0 to 255) are applied to the U and Y channels of the image. For example, --colfx 128:128 should result in a monochrome image (according to the RaspiCam documentation).
  • -mm: Set metering mode (see raspistill notes), valid values (according to the RaspiCam documentation):
    • average: Average the whole frame for metering
    • spot: Spot metering
    • backlit: Assume a backlit image
    • matrix: Matrix metering
  • -rot: Set image rotation (0-359, at the present only 0, 90, 180 and 270 are supported though)
  • -hf: Set horizontal flip
  • -vf: Set vertical flip

Can't get my webcam to work with OctoPi
Problem with webcam crashes
Webcam exposure
Webcam stream flipped
Pi cam streaming over internet slow
#2

Not sure if you want question in this thread or not, but I have played with the -q setting with the C270 and see no change in compression artifacts in the live feed when altering the parameter from 85 down to 0 rebooting with each change.
Would I only see a difference in a timelaps or does it only effect the jpg size? I did not yet attempt a print and creation of the Timelaps with this setting.
Thanks
Doug


#3

Not all cameras expose all controls via UVC. The C270 exposes fewer than the C525 or C615, which in turn expose fewer than the C920 or C930. It's possible that the JPEG quality is fixed on the C270 (or the version of firmware yours has) or that the artifacts are noise or other capture artifacts (light level, contrast, lens, IR or UV, quirks of your particular die, etc.) and not compression artifacts.

If you hadn't tried such a large range, I'd suggest it was also possible that you are asking it for the same level of compression it's already doing, due to binning (for instance, a camera may only have 3 quality levels and both the default value and the one you request may equate to the same level of compression).


#4

Thanks Supertaz, that all make perfect sense!