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!

TeHashX

Very Senior Member
New site with updated guide

logo.png


Here is another tutorial about webcam video surveillance via mjpg-streamer from RT-N56U project, thx guys.
If you own a webcam from this list than you can attach it to the RT-N66U routers usb port and see in real time images from it, like babyroom, garage, courtyard...
We need a usb-flash formatted EXT2 or a usb-hdd formated EXT3, may not work on FAT32 or NTFS.
On router UI we have to enable Telnet or SSH under Administration / System Tab (SSH is enabled only on custom firmware and is more safe).

• To start the optware environment:
• go to http://192.168.1.1/APP_Installation.asp and install Download Master (uninstall or disable after, if you are not using it)
• Login to router with putty terminal
ipkg update
ipkg upgrade
ipkg install wget-ssl http://tinyurl.com/mjpg-streamer-r63-2
rm /opt/etc/init.d/K99webcam
/opt/bin/wget -c -O /opt/etc/init.d/S99webcam http://tinyurl.com/S98webcam --no-check-certificate
chmod 755 /opt/etc/init.d/S99webcam
/opt/bin/wget -q http://tinyurl.com/videodev-rt-n66u --no-check-certificate -O- | cat > /opt/etc/webcam/videomod.sh
/opt/bin/wget -c -O /opt/tmp/kmods_video_rt-n66u_2.6.22.19.tar.gz http://goo.gl/c5lBDb --no-check-certificate
cd /
tar -zxf /opt/tmp/kmods_video_rt-n66u_2.6.22.19.tar.gz
/opt/etc/webcam/videomod.sh load
/opt/etc/init.d/S99webcam start
• go to web browser and type: http://192.168.1.1:9999/stream_simple.html default username admin password admin
You can change username, password, resolution, fps...
ipkg install nano
/opt/etc/init.d/S99webcam stop
nano /opt/etc/init.d/S99webcam find this two lines and replace with desired login
osevys.png

• save with CTRL-O / Enter / and exit with CTRL-X

To start mjpg-streamer automatically on every router reboot we have to make a script (available only on Merlin's firmwares)
nano /jffs/scripts/post-mount and add this lines
#!/bin/sh
/opt/etc/init.d/S99webcam start

• save with CTRL-O / Enter / and exit with CTRL-X
chmod a+rx /jffs/scripts/post-mount (make it executable)

If you want to access the webcam from wan, we have to create another script that open the port 9999 (available only on Merlin's firmwares)
nano /jffs/scripts/firewall-start add this lines
#!/bin/sh
iptables -I INPUT -p tcp --destination-port 9999 -j ACCEPT

• save with CTRL-O / Enter / and exit with CTRL-X
chmod a+rx /jffs/scripts/firewall-start (make it executable)
/opt/etc/init.d/S99webcam start

Now just type your_wan_ip adress:9999/stream_simple.html in browser and should see your webcam
If you have dynamic ip, better set a dynamic dns

Tested successfully with Logitech C270 webcam

Video HERE...
 
Last edited:
I try to follow the tutorial but stuck on start the service with Asuswrt-Merlin (fail to install kernel video modules from repository), do I need to flash DD-WRT or OpenWRT?
 
Did you plug in the webcam in usb port? Is in the list of compatible?

Sent from my HTC One S using Tapatalk 2
 
I really want to try this. I have a logitech c260 right here. But I can't use a usb drive. Other port is already in use by a printer. I don't want to use a hub.

Could you please post instruction using jffs only? I'm using merlin and enabled jffs. Tools page shows jffs as unmounted for some reason though. Thank you. EDIT: jffs formatted and mounted.

EDIT 2: Well I guess I can remove the printer temporarily. For some reason I thought I would keep the USB drive eventhough download master can be removed. USB can be removed too yes?
 
Last edited:
You may open the router and put a microsd card instead of USB drive but you will lose the warranty.

Sent from my HTC One S using Tapatalk 2
 
Does the usb have to remain connected? Or can i remove it after uninstalling download master?
 
Does the usb have to remain connected? Or can i remove it after uninstalling download master?

If you put a microsd card inside your router (loose Warranty) then you don't have to remove anything and you don't have to mount any USB drive.

But if you have ONLY USB drive available, you CAN'T remove it after installation because all the Optware remains on USB drive.
If you remove it, then you loose all your installations.
 
Ok Im going to have to open it.

Im getting an error using nano

ASUSWRT RT-N66U_3.0.0.4 Sat Dec 1 19:41:47 UTC 2012
admin@(none):/tmp/home/root# nano /opt/etc/init.d/S99webcam
Error opening terminal: xterm.
admin@(none):/tmp/home/root#
 
I also had this error

admin@(none):/tmp/home/root# ipkg update
Downloading http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/Packages.gz
Updated list of available packages in /opt/lib/ipkg/lists/optware.oleg
Downloading http://dlcdnet.asus.com/pub/ASUS/wireless/ASUSWRT/Packages.gz
wget: server returned error: HTTP/1.1 404 Not Found
An error ocurred, return value: 1.
Collected errors:
ipkg_download: ERROR: Command failed with return value 1: `wget -q -P /opt/ipkg-y9DYmb http://dlcdnet.asus.com/pub/ASUS/wireless/ASUSWRT/Packages.gz'
 
Sorry, third error I got.

admin@(none):/tmp/home/root# chmod 755 /opt/etc/init.d/S99webcam
chmod: /opt/etc/init.d/S99webcam: Operation not permitted
 
You done something wrong for sure, better formating the drive to ext3 after saving your files and restart installation, watch the video and don't plug the printer until is all ok.
If you have a lot of files and don't want to format than delete the entire optware folder, type in terminal:
rm -r /mnt/sda1/asusware
plug the camera
reboot
restart installation carefully

admin@(none):/tmp/home/root# ipkg update
Downloading http://ipkg.nslu2-linux.org/feeds/op...le/Packages.gz
Inflating http://ipkg.nslu2-linux.org/feeds/op...le/Packages.gz
Updated list of available packages in /opt/lib/ipkg/lists/optware.oleg
Downloading http://dlcdnet.asus.com/pub/ASUS/wir...RT/Packages.gz
wget: server returned error: HTTP/1.1 404 Not Found
An error ocurred, return value: 1.
Collected errors:
ipkg_download: ERROR: Command failed with return value 1: `wget -q -P /opt/ipkg-y9DYmb http://dlcdnet.asus.com/pub/ASUS/wir...RT/Packages.gz'
this is a normal error, just ignore it
 
Well I installed the SD card which is freaking cool to have included.

I'm starting fresh. Ignoring one error as your stated.

Your video isn't working right now for some reason.

Hope I don't get the other 2 errors.

Also, when I install download master, I see an upgrade option which I did last time. This time I won't do that.
http://screencast.com/t/6tClyBgg
 
Still getting this error
admin@(none):/tmp/home/root# chmod 755 /opt/etc/init.d/S99webcam
chmod: /opt/etc/init.d/S99webcam: Operation not permitted
 
The error while trying to download from the Asus repo is normal. That's because Asus hasn't set it up as a proper repo, just ignore that error.

Also make sure you are using an ext2 or ext3 filesystem where you have Optware installed. NTFS and FAT32 won't work properly.
 
Try changing permission with winscp, go to /mnt/sda1/asusware/etc/init.d and set Octal to 0755, after continue installation from this point.
 
Last edited:
Oh its fat32, how do i wipe and format the sd?
What about the upgrade download master?
I tried mkfs.ext3 /dev/sda1 but I'm not sure how to unmount
 
Last edited:
Oh its fat32, how do i wipe and format the sd?
What about the upgrade download master?
I tried mkfs.ext3 /dev/sda1 but I'm not sure how to unmount

put in some card reader, microsd - sd adaptor, or an android phone and use easeus partition master, minitool partition wizard
DM update has nothing to do with mjpg-streamer, better use transmissionbt, look at my signature.
Anyway, if you plan to use microsd card for downloading torrents, the speed will be very low.
 

Latest threads

Sign Up For SNBForums Daily Digest

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