Webcam with the Linux UVC driver

  1. follow
Name Depends Size Description
mjpg-streamer libpthread, libjpeg 33738 Streaming application for Linux-UVC compatible webcams

The package motion is not now available in the OpenWrt repositories.

opkg install kmod-video-uvc mjpg-streamer


Don't forget change option enabled '0' to '1'.

  • start on boot
    /etc/init.d/mjpg-streamer enable
  • start mjpg-streamer right now
    /etc/init.d/mjpg-streamer start

NOTE: You will need to edit the mjpeg config to enable the mjpeg streamer. Manually edit the /etc/config/mjpeg-streamer file.

Now open the URL in the Firefox browser or VLC and watch the MJPEG stream (the default username/password is “openwrt”/“openwrt”). In other browsers, scripts, etc., you can use for taking one image or for stream of images.

mjpeg-streamer fps, CPU load, memory usage, bandwidth at different resolutions:

  • Download a package located here and unpack it into /www/webcam_www directory.
  • Edit /etc/init.d/mjpg-streamer - find this line in function start():
[ $enabled -gt 0 -a -c $device ] && sleep 3 && $SSD -S -m -p $PIDF -q -x $PROG -- --input " --device $device --fps $fps --resolution $resolution" --output " --port $port" &

and add -w /www/webcam_www behind --output “ Now it should look like this:

[ $enabled -gt 0 -a -c $device ] && sleep 3 && $SSD -S -m -p $PIDF -q -x $PROG -- --input " --device $device --fps $fps --resolution $resolution" --output " -w /www/webcam_www --port $port" &

The opkg version of mjpg-streamer has no control options for the camera. If you want to control exposure, brightness and other options you'll need to install uvcdynctrl.

Install uvcdynctrl

opkg install uvcdynctrl

List available devices.

/usr/bin/uvcdynctrl -l

List available control options.

/usr/bin/uvcdynctrl -c

Listing available controls for device video0:
  White Balance Temperature, Auto
  Power Line Frequency
  White Balance Temperature
  Backlight Compensation

Create a configuration file based on the current running values.

/usr/bin/uvcdynctrl -W /etc/config/uvcdynctrl

Load a configuration file, which can be edited.

/usr/bin/uvcdynctrl -L /etc/config/uvcdynctrl

The above can be added to /etc/rc.local, via the GUI or command line to load settings required for your camera. I use the above to enable auto exposure and auto white balance which would otherwise be disabled from cold a start.

Here is a writeup of using openWrt for a pan and tilt camera. The devices were NSLU2 for openWrt and Picaxe for microcontroller, but the idea is the same with arduino as micro and other openWrt devices:

Grey day today here in Nova Scotia, you can see at

If the control page doesn't contain any of the controls, edit the file /etc/init.d/mjpg-streamer and replace these lines

service_start /usr/bin/mjpg_streamer --input " \
                --device $device --fps $fps --resolution $resolution" \           
                --output " --www $www --port $port"

by (on a single line )

service_start /usr/bin/mjpg_streamer --input " --device $device --fps $fps --resolution $resolution" --output " --www $www --port $port"

The command mjpg_streamer -h give you usage information and examples.

If your webcam is an uvc supported by V4L but you cannot get an image (white page), you may check that webcam output is not YUV only like output below:

root@OpenWrt:~# v4l2-ctl -V
Format Video Capture:
        Width/Height  : 320/240
        Pixel Format  : 'YUYV'
        Field         : None
        Bytes per Line: 640
        Size Image    : 153600
        Colorspace    : SRGB

The package uvc-streamer is no longer in the OpenWrt repositories.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2019/08/26 16:45
  • by vgaetera