What's new

[Tutorial] Webcam video surveillance via mjpg-streamer

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Is anyone aware of how to use GSPCA devices working without getting Padavan to include the kernel modules in his repo?

Lifecam VX-3000 in particular.
 
Did anyone find a way to save the content of the stream to disk? Actually, would it be possible to set something up on a desktop to catch the network stream and store it on a HDD, to avoid clogging up any SD card or memory stick plugged into the router.
 
Has anyone tried this under Entware instead of Optware?

What changes would be necessary?

rearden
 
Last edited:
Same question here for TeHashX: how about entware?
I tried but it's not working, since it's downloading version r181-1 and not r63-2 and the exec file is not K99webcam but it is S96mjpg-streamer.
 
Can this be recompiled?

I'm trying the latest beta firmware(376.44) on AC66U and the kernel crashes:

Code:
Jul 30 14:53:57 kernel: Linux video capture interface: v2.00
Jul 30 14:53:58 kernel: uvcvideo: Found UVC 1.00 device Microsoft® LifeCam Cinema(TM) (045e:075d)
Jul 30 14:53:58 kernel: uvcvideo: No streaming interface found for terminal 2.Unhandled kernel unaligned access

Can this be recompiled?
 
merlin 376.45

[italiano] la webcam non funzina con il firmware versione 376.45. il modem si resetta, ristinata la versione 3.0.0.4.374.43_0 tutto funziona ancora

[google] The webcam does not work with firmware version 376.45. the modeme resets all the time, restored version 3.0.0.4.374.43_0 everything still works
 
I'm trying the latest beta firmware(376.44) on AC66U and the kernel crashes:

Code:
Jul 30 14:53:57 kernel: Linux video capture interface: v2.00
Jul 30 14:53:58 kernel: uvcvideo: Found UVC 1.00 device Microsoft® LifeCam Cinema(TM) (045e:075d)
Jul 30 14:53:58 kernel: uvcvideo: No streaming interface found for terminal 2.Unhandled kernel unaligned access

Can this be recompiled?
Can you try with 374.43?

merlin 376.45

[italiano] la webcam non funzina con il firmware versione 376.45. il modem si resetta, ristinata la versione 3.0.0.4.374.43_0 tutto funziona ancora

[google] The webcam does not work with firmware version 376.45. the modeme resets all the time, restored version 3.0.0.4.374.43_0 everything still works

There must be some kernel changes, let me see what I can do.
 
router reboot

Whenever I get to this part of the instructions: /opt/etc/init.d/S99webcam start
my router reboots. It doesnt seem like the service is starting.
help?
 
mjpg_streamer
Section: USER COMMANDS (1)
Updated: June 28, 2012
Index
NAME
mjpg_streamer - Stream webcam video to HTTP
SYNOPSIS
mjpg_streamer[-b|--background] [-i "INPUT_PLUGIN [INPUT_OPTIONS]"]
-o "OUTPUT_PLUGIN [OUTPUT_OPTIONS]"

mjpg_streamer-h | --help
mjpg_streamer-v | --version


DESCRIPTION
mjpg_streamertakes JPGs from Linux-UVC compatible webcams, from the filesystem or fromother input plugins and streams them as M-JPEG via HTTP to webbrowsers, VLCand other software. Alternatively, the stream can be saved to a file orsingle frames can be captured and saved. It is the successor ofuvc-streamer, a Linux-UVC streaming application with Pan/Tilt.

Note:The name of the executable program is mjpg_streamer (with underscore) butthe name of the package is mjpg-streamer (with hyphen). The latter is usedin pathnames too.
OPTIONS

-i | --input "<input-plugin.so> [parameters]"
-o | --output "<output-plugin.so> [parameters]"
-h | --help
display a short help message.
-v | --version
display version information.
-b | --background
fork to the background, run in daemon mode.


EXAMPLES

To open an UVC webcam "/dev/video1" and stream it via HTTP:
mjpg_streamer-i "input_uvc.so -d /dev/video1"
-o "output_http.so"

To open an UVC webcam and stream via HTTP port 8090:
mjpg_streamer-i "input_uvc.so" -o "output_http.so -p 8090"

To get help for a certain plugin:
mjpg_streamer-i "input_uvc.so --help"
mjpg_streamer-i input_testpicture.so
-o "output_http.so --help"

This is the minimum command line to start mjpg_streamer with webpages. For the input-plugin default parameters are used:

mjpg_streamer-o "output_http.so
-w /usr/share/mjpg-streamer/www"


FINDING THE PLUGINS
The default search path for the plugins is taken from the variableLD_LIBRARY_PATH. When you get an error saying that plugins can not be found,set LD_LIBRARY_PATH like this:

exportLD_LIBRARY_PATH="/usr/lib/mjpg-streamer"

or - for 64-Bit systems:

exportLD_LIBRARY_PATH="/usr/lib64/mjpg-streamer"

Or instead of just providing the plugin file name, use a complete (absolute)path and filename:

mjpg_streamer-i "/usr/lib/mjpg-streamer/input_uvc.so"


PLUGINS
input_uvc.so- UVC webcam grabber

The following parameters can be passed to this plugin:

-d | --device <DEVICE>
Video device to open. Example: /dev/video0.
-r | --resolution <RES>
The resolution of the video device. Can be one of the following strings:QSIF QCIF CGA QVGA CIF VGA SVGA XGA SXGA or a custom value like thefollowing example: 640x480.
-f | --fps <NUMBER>
Frames per second. You must choose a value supported by your camera.
-y | --yuv
Enable YUYV format and disable MJPEG mode.
-q | --quality <PERCENT>
JPEG compression quality in percent (activates YUYV format, disables MJPEG).
-m | --minimum_size <SIZE>
Drop frames smaller then this limit, useful if the webcam producessmall-sized garbage frames. This may happen under low light conditions.
-n | --no_dynctrl
Do not initalize dynctrls of Linux-UVC driver.
-l | --led <on|off|blink|auto>
Switch the LED "on", "off", let it "blink" or leave it up to the driverusing the value "auto".

input_file.so- File input plugin.

-d | --delay <DELAY>
Delay to pause between frames in ms.
-f | --folder <DIRECTORY>
Folder to watch for new JPEG files.
-r | --remove
Remove/delete JPEG file after reading.
-n | --name
Ignore changes unless filename matches.

input_gspcav1.so- GSPCAV1 webcam grabber.

-d | --device <DEVICE>
Video device to open.
-r | --resolution <RES>
The resolution of the video device. Can be one of the following strings:QSIF QCIF CGA QVGA CIF VGA SVGA XGA SXGA or a custom value like thefollowing example: 640x480.
-f | --format <r16|r24|r32|yuv|jpg>
Grabbing format, should be set to 'jpg'. Can be: r16 r24 r32 yuv jpg.

input_testpicture.so- Test picture input plugin.

-d | --delay <DELAY>
Delay to pause between frames in ms.
-r | --resolution <RES>
Can be one of 960x720, 640x480, 320x240, 160x120.

output_http.so- HTTP output plugin

-w | --www <DIRECTORY>
Directory that contains webpages in flat hierarchy (no subdirectories). ForopenSUSE packages this is
/usr/share/mjpg-streamer/www.
-p | --port <PORT>
TCP port for this HTTP server. The default port is 8080.
-c | --credentials <USERNAME:pASSWORD>
Ask for "username:password" on connect.
-n | --nocommands
Disable execution of commands.

output_file.so- File output plugin.

-f | --folder <DIRECTORY>
Directory to save pictures.
-m | --mjpeg
Save the stream to an mjpeg file.
-d | --delay <DELAY>
Delay after saving pictures in ms.
-s | --size <NUMBER>
Size of ring buffer (max number of pictures to hold).
-e | --exceed <NUMBER>
Allow ringbuffer to exceed limit by this amount.
-c | --command <COMMAND>
Execute command after saving picture.

output_udp.so- UDP output plugin.
This plugin saves a picture from the stream upon receiving an UDP request.The request is sent usingmjpg_streamer_udp_client.

-f | --folder <DIRECTORY>
Directory to save pictures.
-d | --delay <DELAY>
Delay after saving pictures in ms.
-c | --command <COMMAND>
Execute command after saving picture.
-p | --port <PORT>
UDP port to listen for picture requests. UDP message is the filename tosave. By default the client uses port 2001.

output_autofocus.so- Autofocus output plugin
This plugin continuously grabs a fresh frame, calculates focus for bestsharpness and adjusts the focus accordingly.

-d | --delay <DELAY>
Delay between grabbing frames in ms. Defaults to 1000.


EXIT STATUS
A runningmjpg_streamercan be stopped with CTRL-C or by sending the signal SIGINT (kill -SIGINT) tothe process. Receiving the signal will shutdown all plugins and freeresources. On normal termination it returns a zero exit status and onerror it returns 1.
AUTHOR
Tom Stöveken, Márton Miklós
 
Last edited:
Try with firmware 374.43

My previous firmware was 374.40 so I rolled back there and everything works now.

But I wish we were able to be on the latest and greatest firmware. I wonder if it's possible to update the modules to be compatible with the current 374.45? Or is it the firmware that is the culprit?
 
Hi TeHashX,

Could you create step by step tutorial for setup mjpg-streamer on Entware ( as i see in this topic only optware ) ?

Can mjpg-streamer works with Cam connected through HUB ( if hub take power from usb port) ?

And one more question about mjpg-streamer, can we create motion detection with save video files on Attachment HDD based on this Software?
 
Last edited:
Hi TeHashX,

Could you create step by step tutorial for setup mjpg-streamer on Entware ( as i see in this topic only optware ) ?
It's easy on entware too but after firmware 374.43 some kernel changes make router to crash when starting mjpg-streamer

Can mjpg-streamer works with Cam connected through HUB ( if hub take power from usb port) ?
Yes, should work http://forums.smallnetbuilder.com/showthread.php?t=10083
And one more question about mjpg-streamer, can we create motion detection with save video files on Attachment HDD based on this Software?
Dunno, I have to see
 
Last edited:
It's easy on entware too but after firmware 374.43 some kernel changes make router to crash when starting mjpg-streamer

Now i have myself compilled FW ver. 376.47 Beta 2

( i test with hub connection\i didn't test directly connection )
In sys log i see "Video Device not detected" after logs about mjpg-stream loaded.

Today i change my usb device configuration and test with directly connection webcam

In Entware version I need change configuration in main Start\Stop script as you changed in Optware, or need edit some other configuration file ?
 
Now i have myself compilled FW ver. 376.47 Beta 2

( i test with hub connection\i didn't test directly connection )
In sys log i see "Video Device not detected" after logs about mjpg-stream loaded.

Today i change my usb device configuration and test with directly connection webcam

In Entware version I need change configuration in main Start\Stop script as you changed in Optware, or need edit some other configuration file ?
In entware you should already have S96mjpg-streamer startup script if is installed from repository
Code:
opkg install mjpg-streamer
 
How can I completely remove Optware webcam

(ipkg remove wget-ssl ) ????
 
Last edited:

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top