Page 1 of 2 12 LastLast
Results 1 to 15 of 27

Thread: [HOW-TO] webcam

  1. #1
    Join Date
    Dec 2007
    Location
    The Netherlands - Eindhoven
    Posts
    1,767

    [HOW-TO] webcam

    UPDATE: in the beta firmware on http://wl500g.googlecode.com you can use the refresh-time in the web admin with the same end result as in this how-to. Might be even easier :-)

    Well, I decided to make a little how to for simple webcamming via the admin-interface.
    Everybody knows that rcamd isn't really the best way to stream your webcam since it uses all your cpu... but I have a solution for that
    Also, not every motion detection program seems to work with webcams supported by the router, but rcamd usually does.

    allright, here we go:

    Step 1
    First of all we need a compatible webcam, you can look in the forums for a good one that works. http://wl500g.info/showthread.php?t=...Busb%5D+webcam

    I myself have the Logitech Quickcam 4000 pro connected.
    So next thing we do is connect it to the router, and then configure the settings in the webadmin interface.

    you can make it look similair like this if you want.
    note that the webcam driver should be loaded automatically, so it doesn't matter what you select.
    Just save the settings and reboot the device.

    Step 2
    Now log in via putty into your router.
    make sure you have putty maximized so your screen is completely filled with putty
    issue the command
    ps
    or
    ps axf
    to see the list of active processes

    in that list of processes you will find something similair to this:
    rcamd -p 7777 -s 0 -z MET-1METDST,M3.5.0/2,M10.5.0/3 -a 0 -t 0 -r 0 -f 640x480 -m 100 -c 100
    note that it will appear 3 times in the list, if it does not, your webcam is probably not supported!

    just select this piece with your mouse so it'll become white:

    now just open up notepad and press control + c to paste it into notepad.

    Now make sure, that everytime I call my copied rcamd process, you use your own copied version, as it might differ!

    Step 3
    Now we will do some magic
    rcamd -p 7777 -s 0 -z MET-1METDST,M3.5.0/2,M10.5.0/3 -a 0 -t 0 -r 0 -f 640x480 -m 100 -c 100
    the bold piece in this code is importand, you need to change it.
    -s is an option that allows you to lower the framerate, so also the cpu usage
    at this time it says 0, so it will capture an unlimited frames per second, till the cpu or the webcam can't handle any faster, we are about to change that.
    now if we change the 0 into a 4, the webcam will send every 4 seconds 1 image. so that will give you a framerate of 0.25fps
    no worries, it won't show up as only 1/4 of your screen
    You can adjust this number to your own wish, but I like the 4, because you won't notice the webcam is runnig on the performance
    Now also place a "&" behind the whole line, and end up having something similair to this:
    rcamd -p 7777 -s 4 -z MET-1METDST,M3.5.0/2,M10.5.0/3 -a 0 -t 0 -r 0 -f 640x480 -m 100 -c 100 &
    Step 4
    now we are still in putty will make the final hand to the evil process:
    vi /tmp/local/sbin/post-mount
    Now paste somewhere in this file the following:
    #Restart rcamd with proper settings
    killall rcamd
    sleep 3
    after this lines, paste your own rcamd copy!
    so it will look like this:
    #Restart rcamd with proper settings
    killall rcamd
    sleep 3
    rcamd -p 7777 -s 4 -z MET-1METDST,M3.5.0/2,M10.5.0/3 -a 0 -t 0 -r 0 -f 640x480 -m 100 -c 100 &
    now save the file and:
    flashfs save && flashfs commit && flashfs enable && reboot
    now to be sure it works, just issue "ps" to look at the cpu usage, and check if rcamd is using hardly any cpu

    Final step
    YES! now you can finally watch your webcam!
    huh? what not working?
    probably you have problems with the activeX webcam program on the webcam site.
    if you don't know what the site is...
    http://yourasusip:7776


    As far as I know the active X version only works with IE
    first go to control panel of windows, then to internet options:

    go to the security tab
    select trusted websites
    lower the the security level to lowest
    click on websites to add a new website to be trusted


    enter your asus ip adress or domain to add into the trusted websites
    make sure you have https selection off, otherwise you won't be able to add something.

    now apply everything and refresh your webcam page
    just install the activeX, and when promted if you want to run the object on your pc, answer yes
    and tata, here is your webcam feed
    Be sure the time changes in the picture
    you probably need to adjust the focus of the webcam too, for a sharp image, just turn around the lens wheel (with most webcams)


    now if you use the activeX version, yo can left click and right click on the image.
    left click will capture a screenshot and save it to somewhere on your disk
    right click will capture a movie to your harddisk

    I hope this works for ppl
    Last edited by wpte; 23-07-2009 at 20:35.

  2. #2
    Join Date
    Mar 2008
    Location
    Next to Serpent ..
    Posts
    62
    Tnx alot wpte, this is much easy to folow for me, maybe others too.
    Restarting manually the process step on my nerves ^^.

  3. #3
    Join Date
    Dec 2007
    Location
    The Netherlands - Eindhoven
    Posts
    1,767
    Quote Originally Posted by poiu View Post
    Tnx alot wpte, this is much easy to folow for me, maybe others too.
    Restarting manually the process step on my nerves ^^.
    haha, yes I know, but if you don't kill the original process...
    you hardly will be able to do anything

    oh and the "&" is most likely to be the most importand, otherwise it'll stop working after an hour of 2

    I also corrected a little mistake in the how-to, didn't change anything to the scripts
    I hope it's all clear, and I didn't make a mess of it

  4. #4
    Sorry for this noobquestion - but:

    After testing all my webcams i found just one which is "working": an old Creative Webcam III

    Works like a charm - but with ONE problem: I need to plug it in when the device is booted completely... otherwise i have no rcamd process except of rcamdmain.

    I can fix it by pulling the cam out of the usb jack and replugging it - which is not a good solution for a fixed installation of course

    So is there *any* way to re-initate that USBdriver / device recognition / init / whatever without hands on the hardware?

    Any hints are highly appreciated....

  5. #5

    Arrow PLEASE make a tutorial for webcam (other than rcamd)

    This is what i got: wl-500gp router, latest oleg firmware, philips webcam.

    This is what i've tried:
    1. webcam (rcamd) started from administration page. works, but at certain point it crashes
    2. rcamd killed and started in post-boot (for slower framerate). it crashes also
    3. i've installed motion, but i didn't got it started. i've started the driver but it didn't worked

    Please, can someone make a tutorial for using webcam as a surveilance cam...?? I want to get mails with pictures if something is moving in front of the webcam.

    I've managed to make rcamd send mail, but it doesn't use the server i've set...and it crashes.

    I've read that Palantir works simply as streaming server. It doesn't send mail alerts, and i did'n tried to install it.

    Please help. Thanks

  6. #6
    Join Date
    Dec 2007
    Location
    The Netherlands - Eindhoven
    Posts
    1,767
    well... does your webcam work with rcamd?

    otherwise different software won't work either most likely... (drivers maybe don't support your webcam)

    anyway...
    sourceforge: http://sourceforge.net/search/?words...ewfilter=Apply

    google: http://www.linux.com/news/hardware/p...a-linux-webcam

    maybe you find some program that is usefull for you, then you might be able to compile it yourself... or I'll give it a go

  7. #7
    Hi Wpte & thanks for the how to -

    Have been using this for a while but would now like to backup the images that are taken.

    I am assuming at the moment that display.jpg is just overwritten with every refresh, but I would like to store these images instead.

    Is this possible - is there a setting in rcamd that I can use or could I create a script to copy/move display.jpg every time it is modified.

    Thanks in advance for any help with this.

    ** BTW: the reason I am doing this is I want to create a stop-motion video of a plant growing ***

    I can see that display.jpg is symlinked to /var/tmp/display.jpg and in turn this file is dynamically syslinked to record0.jpg - record5.jpg

    this seems to be the last 6 images - is there a way to change the symlinks to the usb drive and to set it to record the last 100 images instead of the last 5??
    Last edited by velcrow; 23-07-2009 at 13:07. Reason: more info

  8. #8
    Join Date
    Dec 2007
    Location
    The Netherlands - Eindhoven
    Posts
    1,767
    Hey velcrow,

    I made this little script here:
    Code:
    #!/bin/sh
    #Seconds of sleep before doing another copy
    SLEEP=15
    #Source JPG file that needs to be copied.
    SOURCEJPG=/var/tmp/display.jpg
    #Output folder which will contain all the JPG files
    OUTPUT=/mnt/webcamimages
    #Choose between a counting name or date
    #COUNTING   or    DATE
    MODE=COUNTING
    
    COUNT=0
    
    
    if [ $MODE="COUNTING" ]; then
    		while /bin/true; do
    			/bin/cp $SOURCEJPG $OUTPUT/$COUNT.jpg
    			COUNT=$(($COUNT + 1))
    			/bin/sleep $SLEEP
    		done
    	fi
    else
    	if [ $MODE="DATE" ]; then
    		while /bin/true; do
    		/bin/cp $SOURCEJPG $OUTPUT/img\_$(/bin/date '+%Y%m%d_%H%M%S').jpg
    		/bin/sleep $SLEEP
    		done
    	fi
    it's quite self explaining
    unfortunately my plan for saving it by date+time in the filename didn't worked out too well, since I'm not too familiar with the bash syntax.
    however the counting filename works fantastic

    just edit it to personal preferences...
    and execute it like this:
    ../sbin/webcammon.sh &
    so you can shut down your pc while the router keeps the images rolling in

    The limitation so far is, that I have no idea what the maximum number for count is... probably around 32000 or 65000 keep an eye on it
    I hope you find it usefull, and maybe someone can fix my horrible mistake of the date saving thing

    EDIT:
    Thanks to EdP the date and time thing is working now

    a little example of a result:
    http://wpte.kicks-ass.net/downloads/timelapse.mpg
    Last edited by wpte; 23-07-2009 at 19:10.

  9. #9
    Join Date
    Dec 2008
    Location
    Netherlands
    Posts
    74
    Hi,

    Here's a suggestion on how to fix the date thing:

    replace that cp sentence by the following:
    Code:
    /bin/cp $SOURCEJPG $OUTPUT/img\_$(/bin/date '+%Y%m%d_%H%M%S').jpg
    Or something similar. That way your files will be named
    /mnt/webcamimages/img_20090723_193943.jpg (etc.)

  10. #10
    Join Date
    Dec 2007
    Location
    The Netherlands - Eindhoven
    Posts
    1,767
    Quote Originally Posted by EdP View Post
    Hi,

    Here's a suggestion on how to fix the date thing:

    replace that cp sentence by the following:
    Code:
    /bin/cp $SOURCEJPG $OUTPUT/img\_$(/bin/date '+%Y%m%d_%H%M%S').jpg
    Or something similar. That way your files will be named
    /mnt/webcamimages/img_20090723_193943.jpg (etc.)
    Ah, thank you EdP
    bash is a bit different than I'm used to

  11. #11
    Join Date
    Dec 2008
    Location
    Netherlands
    Posts
    74
    Ýou're very welcome. It's not much different from sh, ksh, even pretty similar to csh and tcsh which were popular back in the day

  12. #12
    Join Date
    Dec 2007
    Location
    The Netherlands - Eindhoven
    Posts
    1,767
    Quote Originally Posted by EdP View Post
    Ýou're very welcome. It's not much different from sh, ksh, even pretty similar to csh and tcsh which were popular back in the day
    I don't even know those
    I program things like c and c++
    bash does look a bit like qbasic, which I used when I was little

  13. #13
    Join Date
    Dec 2008
    Location
    Netherlands
    Posts
    74
    Qbasic *cough* *cough*

    Be careful, or you'll sound like a barbarian
    Tcsh should be much to your liking then. OK back on topic I guess ...

  14. #14
    Join Date
    Dec 2007
    Location
    The Netherlands - Eindhoven
    Posts
    1,767
    Quote Originally Posted by EdP View Post
    Qbasic *cough* *cough*

    Be careful, or you'll sound like a barbarian
    Tcsh should be much to your liking then. OK back on topic I guess ...
    hey don't underestimate the sheer power of qbasic

    anyway, this is the latest version of the script, which gives a harddrive time to spin down by temporary storing the files in /tmp/imag

    I tested it, and it worked great
    here it is:
    Code:
    #!/bin/sh
    #Seconds of sleep before doing another copy
    SLEEP=15
    #Source JPG file that needs to be copied.
    SOURCEJPG=/var/tmp/display.jpg
    #Output folder which will contain all the JPG files
    OUTPUT=/mnt/webcamimages
    #Choose between a counting name or date(not working yet)
    #COUNTING   or    DATE
    MODE=COUNTING
    
    #Optimize for Harddrive spindown? (TRUE or FALSE)
    OPTIMIZE=TRUE
    #Save files up to ... in flash
    #The max size of an jpeg file is about 65KB so 65*150=9,75MB wich leaves enough of the ~14,5MB flash.
    #And if the images are taken every 15sec you will leave the hdd untouched for 37min!
    #Please keep in mind that if you set it too high there won't be memory left in /tmp
    FLASHSAVE=150
    #Flash directory to save in
    FLASHDIR=/tmp/imag
    
    
    
    COUNT=0
    if [ $OPTIMIZE="TRUE" ]; then
    	if ( [ ! -d $FLASHDIR ] ); then
    		/bin/mkdir $FLASHDIR
    		fi
    	/bin/rm $FLASHDIR/*
    	if [ $MODE="COUNTING" ]; then
    			while /bin/true; do
    				for i in $(seq 1 $FLASHSAVE); do
    					/bin/cp $SOURCEJPG $FLASHDIR/$COUNT.jpg
    					COUNT=$(($COUNT + 1))
    					/bin/sleep $SLEEP
    				done
    				/bin/cp $FLASHDIR/* $OUTPUT/
    				/bin/rm $FLASHDIR/*
    			done
    		fi
    	else
    		if [ $MODE="DATE" ]; then
    			while /bin/true; do
    			for i in $(seq 1 $FLASHSAVE); do
    				/bin/cp $SOURCEJPG $FLASHDIR/img\_$(/bin/date '+%Y%m%d_%H%M%S').jpg
    				/bin/sleep $SLEEP
    			done
    			/bin/cp $FLASHDIR/* $OUTPUT/
    			/bin/rm $FLASHDIR/*
    			done
    		fi
    fi
    else
    	if [ $OPTIMIZE="FALSE" ]; then
    		if [ $MODE="COUNTING" ]; then
    			while /bin/true; do
    				/bin/cp $SOURCEJPG $OUTPUT/$COUNT.jpg
    				COUNT=$(($COUNT + 1))
    				/bin/sleep $SLEEP
    			done
    		fi
    		else
    		if [ $MODE="DATE" ]; then
    			while /bin/true; do
    			/bin/cp $SOURCEJPG $OUTPUT/img\_$(/bin/date '+%Y%m%d_%H%M%S').jpg
    			/bin/sleep $SLEEP
    			done
    		fi
    	fi
    another example of the script result:
    http://www.youtube.com/watch?v=5LW9RsETEBk

  15. #15
    Thanks wpte & Edp -

    This is great, I spent some time trying the rcamd commands but with no luck...

    what does the -r setting do?

    Code:
    rcamd -p 7777 -s 4 -z MET-1METDST,M3.5.0/2,M10.5.0/3 -a 0 -t 0 -r 0 -f 640x480 -m 100 -c 100 &
    and why does it record 6 files - record0.jpg - record5.jpg?

    Really appreciate this, as there was no chance of me solving this in such an elegant way

    Velcrow
    Last edited by velcrow; 25-07-2009 at 19:48.

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 10
    Last Post: 21-12-2012, 08:55
  2. [How to] rtorrent & ntorrent
    By mancub in forum WL-500gP Tutorials
    Replies: 101
    Last Post: 18-12-2008, 07:21
  3. [How To] 2 zusätzliche interne USB Ports am WL500gP nutzbar machen
    By rj.2001 in forum German Discussion - Deutsch (DE)
    Replies: 6
    Last Post: 02-10-2008, 11:32
  4. [HOW TO] Bluetooth in wl500g
    By TIk in forum WL-500g/WL-500gx Tutorials
    Replies: 1
    Last Post: 17-09-2008, 21:38
  5. [HOW TO] Timeouts beim Laden von bestimmten Seiten beheben - MTU Problem
    By modnet25 in forum German Discussion - Deutsch (DE)
    Replies: 3
    Last Post: 03-09-2006, 10:55

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
  •