Results 1 to 2 of 2

Thread: [WebCam] Using OpenWRT to record WebCam snapshots to USB drive

  1. #1

    [WebCam] Using OpenWRT to record WebCam snapshots to USB drive

    [WebCam] Using OpenWRT to record WebCam snapshots to USB drive

    With this tutorial you'll be able to take snapshots from a WebCam every second and save them to your USB drive.

    Prerequisites
    • Asus WL-500G Premium (important note: it must not be the V2 version!)
    • USB thumb drive (to save WebCam snapshots on) - either 4 GB (holds approx. 12 hours of snapshots) or 8 GB (holds approx. 24 hours)
    • Logitech QuickCam Pro 5000 (for other supported WebCams, see this and this list)
    • (Optional) Tp-Link TL-WN560G Mini PCI card (the one that comes with the router doesn't work with our firmware)


    Installing OpenWRT firmware
    • Download this OpenWRT firmware and save it to desktop
    • Connect the router to your PC using port 1 - also disconnect any other LAN connections to your PC
    • Change the IP of your NIC to 192.168.1.10 and the subnet mask to 255.255.255.0
    • Push and hold the restore button and power on your router - the ON light should blink once a second
    • Use the command line and navigate to the folder with the .trx file in it with
      Code:
      cd [folder]
      and execute the following command:
      Code:
      tftp -i 192.168.1.1 PUT openwrt-brcm47xx-stamcar-2.6-squashfs.trx
      Please note: Vista users must manually install tftp and telnet: Control Panel -> Programs and Features -> Turn Windows features on or off -> check "Telnet Client" and "TFTP Client" -> OK
    • Wait 40 seconds and pull the power cord from the router
    • Change your PC's NIC IP settings to automatic (DHCP); you can also reattach any other connections
    • Turn on your router - the ON light shouldn't blink anymore - if it does, upload the firmware again and this time wait a little bit longer
    • When the router finishes booting, type this into the command prompt:
      Code:
      telnet 192.168.86.1
      and then
      Code:
      passwd
      then type your desired password twice - this password will be used to login into your router after this point
    • Connect the internet connection to router's WAN port and execute:
      Code:
      reboot
    • After rebooting the router, you can no longer connect via telnet - you must use SSH; use PuTTY to connect to your router (its IP is 192.168.86.1) and login with "root" as username and with the passwod you chose


    WLAN configuration
    • If you wish to use WLAN to connect to your router, you must open it and replace its wireless card
    • Edit the file /etc/config/wireless: add "#" before "option disabled 1"
    • Change the SSID at "option ssid", set "option encryption" to "psk2" and add "option key [your-password]"
    • Then execute
      Code:
      /etc/init.d/network restart
      to restart the network


    Preparing the USB drive
    • Connect the USB drive to one of the router's 2 USB ports and wait approx. 10 seconds for the drive to initialize
    • First, run the fdisk utility with
      Code:
      fdisk /dev/sda
      and delete any existing partitions as instructed, then type in the following commands (press "enter" after each letter or number):
      Code:
      n -> p -> 1 -> "enter" -> "enter"
      You can now save the changes with "w"
    • To format the USB drive for data storage, type
      Code:
      mke2fs /dev/sda1
    • You can access the files on your USB drive with any FTP client - use 192.168.86.1 for IP, username is "root" and the passwod is the one you chose earlier


    Making the startup script
    • To avoid manual mounting and to automatically start recording each time the router starts we need to create a startup script - edit the "/etc/init.d/done" file and add the following in a new line after "set_state done":
      Code:
      umount /dev/sda1
      e2fsck /dev/sda1
      mount /dev/sda1 /mnt
      killall httpd
      while true; do 
      mjpg_streamer -i "input_uvc.so -f 15" -o "output_http.so -p 80 -w /webcam_www" -o "output_file12h.so -f /mnt -d 1000"
      done
      If you possess an 8 GB USB drive, type output_file24h.so instead of output_file12h.so
    • Now reboot your router and the recording should start automatically
    • On your PC, visit http://192.168.86.1/java_simple.html and enjoy live streaming video


    Additional
    • ntpclient is integrated into the firmware. If you wish to change its timezone, execute the following:
      Code:
      echo GMT-1 > /etc/TZ


    Sources:
    Last edited by KoMar; 20-05-2011 at 12:18. Reason: Firmware URL change

  2. #2

    Smile how to get wifi and webcam to work together on ASUS

    Quote Originally Posted by KoMar View Post
    [WebCam] Using OpenWRT to record WebCam snapshots to USB drive

    With this tutorial you'll be able to take snapshots from a WebCam every second and save them to your USB drive.

    Prerequisites
    • Asus WL-500G Premium (important note: it must not be the V2 version!)
    • USB thumb drive (to save WebCam snapshots on) - either 4 GB (holds approx. 12 hours of snapshots) or 8 GB (holds approx. 24 hours)
    • Logitech QuickCam Pro 5000 (for other supported WebCams, see this and this list)
    • (Optional) Tp-Link TL-WN560G Mini PCI card (the one that comes with the router doesn't work with our firmware)


    Installing OpenWRT firmware
    • Download this OpenWRT firmware and save it to desktop
    • Connect the router to your PC using port 1 - also disconnect any other LAN connections to your PC
    • Change the IP of your NIC to 192.168.1.10 and the subnet mask to 255.255.255.0
    • Push and hold the restore button and power on your router - the ON light should blink once a second
    • Use the command line and navigate to the folder with the .trx file in it with
      Code:
      cd [folder]
      and execute the following command:
      Code:
      tftp -i 192.168.1.1 PUT openwrt-brcm47xx-stamcar-2.6-squashfs.trx
      Please note: Vista users must manually install tftp and telnet: Control Panel -> Programs and Features -> Turn Windows features on or off -> check "Telnet Client" and "TFTP Client" -> OK
    • Wait 40 seconds and pull the power cord from the router
    • Change your PC's NIC IP settings to automatic (DHCP); you can also reattach any other connections
    • Turn on your router - the ON light shouldn't blink anymore - if it does, upload the firmware again and this time wait a little bit longer
    • When the router finishes booting, type this into the command prompt:
      Code:
      telnet 192.168.86.1
      and then
      Code:
      passwd
      then type your desired password twice - this password will be used to login into your router after this point
    • Connect the internet connection to router's WAN port and execute:
      Code:
      reboot
    • After rebooting the router, you can no longer connect via telnet - you must use SSH; use PuTTY to connect to your router (its IP is 192.168.86.1) and login with "root" as username and with the passwod you chose


    WLAN configuration
    • If you wish to use WLAN to connect to your router, you must open it and replace its wireless card
    • Edit the file /etc/config/wireless: add "#" before "option disabled 1"
    • Change the SSID at "option ssid", set "option encryption" to "psk2" and add "option key [your-password]"
    • Then execute
      Code:
      /etc/init.d/network restart
      to restart the network


    Preparing the USB drive
    • Connect the USB drive to one of the router's 2 USB ports and wait approx. 10 seconds for the drive to initialize
    • First, run the fdisk utility with
      Code:
      fdisk /dev/sda
      and delete any existing partitions as instructed, then type in the following commands (press "enter" after each letter or number):
      Code:
      n -> p -> 1 -> "enter" -> "enter"
      You can now save the changes with "w"
    • To format the USB drive for data storage, type
      Code:
      mke2fs -j /dev/sda1
    • You can access the files on your USB drive with any FTP client - use 192.168.86.1 for IP, username is "root" and the passwod is the one you chose earlier


    Making the startup script
    • To avoid manual mounting and to automatically start recording each time the router starts we need to create a startup script - edit the "/etc/init.d/done" file and add the following in a new line after "set_state done":
      Code:
      umount /dev/sda1
      e2fsck /dev/sda1
      mount /dev/sda1 /mnt
      killall httpd
      while true; do 
      mjpg_streamer -i "input_uvc.so -f 15" -o "output_http.so -p 80 -w /webcam_www" -o "output_file12h.so -f /mnt -d 1000"
      done
      If you possess an 8 GB USB drive, type output_file24h.so instead of output_file12h.so
    • Now reboot your router and the recording should start automatically
    • On your PC, visit http://192.168.86.1/java_simple.html and enjoy live streaming video


    Additional
    • ntpclient is integrated into the firmware. If you wish to change its timezone, execute the following:
      Code:
      echo GMT-1 > /etc/TZ


    Sources:
    KoMar, this worked like magic!!! thanks for the hardwork. do you know how to make the wifi to work.. i am seeing that for the brcm, kamikaze 2.6 does not support wifi.. there was one post about using kmod-b43.. i do not know how to proceed.. i am a newbie.. any help will be appreciated.

Similar Threads

  1. linuxrc bug? - WL-500g not booting from usb drive with hub
    By daniel632 in forum WL-500g Custom Development
    Replies: 5
    Last Post: 14-03-2012, 16:28
  2. Unstable boot from USB
    By Tamadite in forum WL-500g Q&A
    Replies: 6
    Last Post: 20-08-2008, 16:19
  3. Router is not responding on restart with usb drive
    By before in forum WL-500gP Q&A
    Replies: 7
    Last Post: 11-02-2008, 12:27
  4. 7.09 + USB + hotplug
    By oilinki in forum WL-700g Q&A
    Replies: 0
    Last Post: 18-11-2007, 13:51
  5. change of USB stick to USB drive
    By gamerhk in forum WL-500gP Q&A
    Replies: 2
    Last Post: 14-11-2007, 15:27

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •