[Tutorial] Webcam video surveillance via mjpg-streamer

Discussion in 'Asuswrt-Merlin' started by TeHashX, Dec 2, 2012.

  1. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    764
    Location:
    Europe
    New site with updated guide

    [​IMG]

    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
    [​IMG]
    • 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
    [​IMG]

    Video HERE...
    [​IMG]
     
    Last edited: Oct 28, 2014
  2. Log in / Register to remove this ad

  3. erickkk

    erickkk New Around Here

    Joined:
    Dec 2, 2012
    Messages:
    7
    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?
     
  4. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    764
    Location:
    Europe
    Did you plug in the webcam in usb port? Is in the list of compatible?

    Sent from my HTC One S using Tapatalk 2
     
  5. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    764
    Location:
    Europe
    Fixed driver installation. 07/12/2012

    Sent from my HTC One S using Tapatalk 2
     
  6. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    764
    Location:
    Europe
    Added youtube video HERE...
    [​IMG]
     
  7. netmik3

    netmik3 Regular Contributor

    Joined:
    Dec 8, 2012
    Messages:
    178
    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: Dec 8, 2012
  8. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    764
    Location:
    Europe
    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
     
  9. netmik3

    netmik3 Regular Contributor

    Joined:
    Dec 8, 2012
    Messages:
    178
    Does the usb have to remain connected? Or can i remove it after uninstalling download master?
     
  10. Lost_Animal

    Lost_Animal Occasional Visitor

    Joined:
    Nov 30, 2012
    Messages:
    42
    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.
     
  11. netmik3

    netmik3 Regular Contributor

    Joined:
    Dec 8, 2012
    Messages:
    178
    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#
     
  12. netmik3

    netmik3 Regular Contributor

    Joined:
    Dec 8, 2012
    Messages:
    178
    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'
     
  13. netmik3

    netmik3 Regular Contributor

    Joined:
    Dec 8, 2012
    Messages:
    178
    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
     
  14. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    764
    Location:
    Europe
    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

    this is a normal error, just ignore it
     
  15. netmik3

    netmik3 Regular Contributor

    Joined:
    Dec 8, 2012
    Messages:
    178
    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
     
  16. netmik3

    netmik3 Regular Contributor

    Joined:
    Dec 8, 2012
    Messages:
    178
  17. netmik3

    netmik3 Regular Contributor

    Joined:
    Dec 8, 2012
    Messages:
    178
    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
     
  18. RMerlin

    RMerlin Part of the Furniture

    Joined:
    Apr 14, 2012
    Messages:
    13,489
    Location:
    Canada
    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.
     
  19. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    764
    Location:
    Europe
    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: Dec 8, 2012
  20. netmik3

    netmik3 Regular Contributor

    Joined:
    Dec 8, 2012
    Messages:
    178
    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: Dec 8, 2012
  21. TeHashX

    TeHashX Very Senior Member

    Joined:
    Jul 6, 2012
    Messages:
    764
    Location:
    Europe
    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.
     

Share This Page