PDA

Bekijk de volledige versie : [WebCam] Using OpenWRT to record WebCam snapshots to USB drive



KoMar
03-03-2008, 21:22
[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 (http://linux-uvc.berlios.de/) and this (http://mxhaard.free.fr/spca5xx.html) 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 (http://www.multiupload.com/4E2IO9U0HJ) 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

cd [folder]
and execute the following command:

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:

telnet 192.168.86.1
and then

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:

reboot
After rebooting the router, you can no longer connect via telnet - you must use SSH; use PuTTY (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) 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 (http://shrani.si/f/1S/VG/2noOcMMt/dsc00244.jpg) 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

/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

fdisk /dev/sda
and delete any existing partitions as instructed, then type in the following commands (press "enter" after each letter or number):

n -> p -> 1 -> "enter" -> "enter"
You can now save the changes with "w"
To format the USB drive for data storage, type

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":

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:

echo GMT-1 > /etc/TZ


Sources:

http://wiki.openwrt.org/OpenWrtDocs/Hardware/Asus/WL500GP
http://forum.openwrt.org/viewtopic.php?id=14186
http://wiki.openwrt.org/UsbStorageHowto
http://wiki.openwrt.org/webcam
http://naaa.de/programme/uvc_streamer/openwrt/HowTo-MJPG-streamer-Kamikaze-7.09.txt

videshi
25-04-2008, 04:00
[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 (http://linux-uvc.berlios.de/) and this (http://mxhaard.free.fr/spca5xx.html) 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 (http://www.stamcar.com/datoteke/openwrt-brcm47xx-stamcar-2.6-squashfs.trx) 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

cd [folder]
and execute the following command:

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:

telnet 192.168.86.1
and then

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:

reboot
After rebooting the router, you can no longer connect via telnet - you must use SSH; use PuTTY (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) 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 (http://shrani.si/f/1S/VG/2noOcMMt/dsc00244.jpg) 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

/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

fdisk /dev/sda
and delete any existing partitions as instructed, then type in the following commands (press "enter" after each letter or number):

n -> p -> 1 -> "enter" -> "enter"
You can now save the changes with "w"
To format the USB drive for data storage, type

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":

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:

echo GMT-1 > /etc/TZ


Sources:

http://wiki.openwrt.org/OpenWrtDocs/Hardware/Asus/WL500GP
http://forum.openwrt.org/viewtopic.php?id=14186
http://wiki.openwrt.org/UsbStorageHowto
http://wiki.openwrt.org/webcam
http://naaa.de/programme/uvc_streamer/openwrt/HowTo-MJPG-streamer-Kamikaze-7.09.txt


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.