NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
highintensity
May 14, 2012Tutor
Support for Foscam FI8918W IP Camera
I have a few of theses and would like to add them. The Panasonics work very well so far. B
tiranor
Aug 28, 2014Aspirant
For the interested people out there, below is all the setuop i did to make this work :
DISCLAIMER :
-I'm an amateur with limited knowledge of linux, things could be more optimised, but it works for me, so who cares :)
-You need root ssh access, and you need to know what you are doing, i'm not responsible if you screw something because you didn't know what you were doing while being root.
-Before trying anything, you have to understand what each command does exactly, it's mandatory as you may have to tweak some commands to suit your NAS and needs.
1- This is my crontab, comments are below :
-recordfoscam.sh is my record command file, executed every 5 minutes (it records the videostreams, and stop the recording after 5 minutes)
-trifoscam.sh is the command file which sorts the video files (moves videos associated to snapshots, and join the snapshots), executed every 6 hours
-transferforscam.sh moves the rest of the videos to a short save directory, executed 50 minutes after trifoscam.
-nettoyagefoscam.sh deletes the oldest videos and snapshots, everyday at 3am.
-last command is the launch of skifta at startup (the skifta addon doesn't work, i had to install the linux version, for more info, see the skifta official forum)
2-recordfoscam.sh (i have 2 cameras, one in my garage, one in my appartment)
As you can see :
-i record in my USB stick in 2 separate folders.
-the XXX have to be replaced with your camera IP adress and port
-the XXXX have to be replaced with your camera login and password
-the curl command records exactly 301 seconds of video from each camera
-The url was changed when i updated the camera firmware, befor it was something like http://login:pass@ip:port/videostream.asf
-the video files names are something like : garage28.08.14-hour12-05 (variables NEW_NAME and NEW_SAME)
3-trifoscam.sh :
As you can see :
-the snapshots orignial name length is too long, i have to rename them before issuing the comparison command, it's a bit bothersome, but i hadn't found a way around.
-in this example, i keep all videos which timestamp is within 700 seconds of the snapshots (as i have the video recording, my camera setting is one snapshot every 150 seconds when there is movement, to reduce the numbers of snapshots)
4-tranfertfoscam.sh :
As you can see :
-There is another timestamp comparison (this time only the file age, greater than 1 hour), this is to process only the file that have been processed by the previous commands (remember this cronjob is executed 50 minutes after the sorting)
-I merely move those file to another folder, but if you don't want to keep them at all, you can just delete them.
5-nettoyagefoscam.sh :
-First block is the generic video streams kept 5 days (432000 seconds)
-Second block is the interesting videos kept 25 days (2160000 seconds)
-WARNING : make sure that you're in the good folder before using rm -f (the other remove commands prompt for a confirmation when deleting several files in a loop, so only rm -f seemed to work for me, but i made sure i was in the videos folder before using the loop full power)
If you have questions, feel free to ask.
DISCLAIMER :
-I'm an amateur with limited knowledge of linux, things could be more optimised, but it works for me, so who cares :)
-You need root ssh access, and you need to know what you are doing, i'm not responsible if you screw something because you didn't know what you were doing while being root.
-Before trying anything, you have to understand what each command does exactly, it's mandatory as you may have to tweak some commands to suit your NAS and needs.
1- This is my crontab, comments are below :
#! /bin/bash
*/5 * * * * /opt/recordfoscam.sh
0 */6 * * * /opt/trifoscam.sh
50 */6 * * * /opt/transfertfoscam.sh
0 3 * * * /opt/nettoyagefoscam.sh
@reboot /usr/bin/nohup /usr/bin/java -jar /opt/Skifta/Skifta.jar -start & > /dev/null
-recordfoscam.sh is my record command file, executed every 5 minutes (it records the videostreams, and stop the recording after 5 minutes)
-trifoscam.sh is the command file which sorts the video files (moves videos associated to snapshots, and join the snapshots), executed every 6 hours
-transferforscam.sh moves the rest of the videos to a short save directory, executed 50 minutes after trifoscam.
-nettoyagefoscam.sh deletes the oldest videos and snapshots, everyday at 3am.
-last command is the launch of skifta at startup (the skifta addon doesn't work, i had to install the linux version, for more info, see the skifta official forum)
2-recordfoscam.sh (i have 2 cameras, one in my garage, one in my appartment)
#!/bin/bash
DOSS1="/USB/USB_FLASH_1/appart/"
NEW_NAME="appart"$(date +%d)"."$(date +%m)"."$(date +%y)"-hour"$(date +%H)"-"$(date +%M)".avi"
/usr/local/bin/curl -s -m 301 -o $DOSS1$NEW_NAME http://192.168.XXX.XXX:XXX/videostream.asf?user=XXXX\&pwd=XXXX & sleep 1
DOSS2="/USB/USB_FLASH_1/garage/"
NEW_SAME="garage"$(date +%d)"."$(date +%m)"."$(date +%y)"-hour"$(date +%H)"-"$(date +%M)".avi"
/usr/local/bin/curl -s -m 301 -o $DOSS2$NEW_SAME http://192.168.XXX.XXX:XXX/videostream.asf?user=XXXX\&pwd=XXXX & sleep 1
As you can see :
-i record in my USB stick in 2 separate folders.
-the XXX have to be replaced with your camera IP adress and port
-the XXXX have to be replaced with your camera login and password
-the curl command records exactly 301 seconds of video from each camera
-The url was changed when i updated the camera firmware, befor it was something like http://login:pass@ip:port/videostream.asf
-the video files names are something like : garage28.08.14-hour12-05 (variables NEW_NAME and NEW_SAME)
3-trifoscam.sh :
#!/bin/bash
DOSS10="/USB/USB_FLASH_1/garage/"
DOSS20="/c/Foscam/garage-tri/"
DOSS30="/c/Foscam/8910garage/"
NUMPIC=0
cd "$DOSS30" ; for y in *.* ; do NUMPIC=$((NUMPIC+1)) ; mv "$y" "$NUMPIC".jpg ; done
for y in *.* ; do mv "$y" "$y"-8910.jpg ; done
for x in "$DOSS10"*.* ; do temps1=$(stat -c %Y $x) ; for y in "$DOSS30"*.* ; do temps2=$(stat -c %Y $y) ; age=$((temps2-temps1)) ; age=${age#-} ; if [ $age -lt 700 ] ; then mv $x "$DOSS20" ; break ; fi ; done ; done
DOSS10="/USB/USB_FLASH_1/appart/"
DOSS20="/c/Foscam/appart-tri/"
DOSS30="/c/Foscam/8916appart/"
NUMPIC=0
cd "$DOSS30" ; for y in *.* ; do NUMPIC=$((NUMPIC+1)) ; mv "$y" "$NUMPIC".jpg ; done
for y in *.* ; do mv "$y" "$y"-8916.jpg ; done
for x in "$DOSS10"*.* ; do temps1=$(stat -c %Y $x) ; for y in "$DOSS30"*.* ; do temps2=$(stat -c %Y $y) ; age=$((temps2-temps1)) ; age=${age#-} ; if [ $age -lt 700 ] ; then mv $x "$DOSS20" ; break ; fi ; done ; done
As you can see :
-the snapshots orignial name length is too long, i have to rename them before issuing the comparison command, it's a bit bothersome, but i hadn't found a way around.
-in this example, i keep all videos which timestamp is within 700 seconds of the snapshots (as i have the video recording, my camera setting is one snapshot every 150 seconds when there is movement, to reduce the numbers of snapshots)
4-tranfertfoscam.sh :
#!/bin/bash
DOSS11="/USB/USB_FLASH_1/garage/"
DOSS21="/c/Foscam/garage/"
for x in "$DOSS11"*.* ; do temps1=$(stat -c %Y $x) ; temps2=$(date +%s) ; age=$((temps2-temps1)) ; if [ $age -gt 3600 ] ; then mv $x "$DOSS21" ; fi ; done
DOSS11="/USB/USB_FLASH_1/appart/"
DOSS21="/c/Foscam/appart/"
for x in "$DOSS11"*.* ; do temps1=$(stat -c %Y $x) ; temps2=$(date +%s) ; age=$((temps2-temps1)) ; if [ $age -gt 3600 ] ; then mv $x "$DOSS21" ; fi ; done
As you can see :
-There is another timestamp comparison (this time only the file age, greater than 1 hour), this is to process only the file that have been processed by the previous commands (remember this cronjob is executed 50 minutes after the sorting)
-I merely move those file to another folder, but if you don't want to keep them at all, you can just delete them.
5-nettoyagefoscam.sh :
#!/bin/bash
cd /c/Foscam/
DOSS111="/c/Foscam/appart/"
DOSS121="/c/Foscam/garage/"
cd "$DOSS111" ; for x in *.* ; do temps1=$(stat -c %Y $x) ; temps2=$(date +%s) ; age=$((temps2-temps1)) ; if [ $age -gt 432000 ] ; then rm -f $x ; fi ; done
cd "$DOSS121" ; for x in *.* ; do temps1=$(stat -c %Y $x) ; temps2=$(date +%s) ; age=$((temps2-temps1)) ; if [ $age -gt 432000 ] ; then rm -f $x ; fi ; done
DOSS111="/c/Foscam/appart-tri/"
DOSS121="/c/Foscam/garage-tri/"
DOSS131="/c/Foscam/8916appart/"
DOSS141="/c/Foscam/8910garage/"
cd "$DOSS111" ; for x in *.* ; do temps1=$(stat -c %Y $x) ; temps2=$(date +%s) ; age=$((temps2-temps1)) ; if [ $age -gt 2160000 ] ; then rm -f $x ; fi ; done
cd "$DOSS121" ; for x in *.* ; do temps1=$(stat -c %Y $x) ; temps2=$(date +%s) ; age=$((temps2-temps1)) ; if [ $age -gt 2160000 ] ; then rm -f $x ; fi ; done
cd "$DOSS131" ; for x in *.* ; do temps1=$(stat -c %Y $x) ; temps2=$(date +%s) ; age=$((temps2-temps1)) ; if [ $age -gt 2160000 ] ; then rm -f $x ; fi ; done
cd "$DOSS141" ; for x in *.* ; do temps1=$(stat -c %Y $x) ; temps2=$(date +%s) ; age=$((temps2-temps1)) ; if [ $age -gt 2160000 ] ; then rm -f $x ; fi ; done
-First block is the generic video streams kept 5 days (432000 seconds)
-Second block is the interesting videos kept 25 days (2160000 seconds)
-WARNING : make sure that you're in the good folder before using rm -f (the other remove commands prompt for a confirmation when deleting several files in a loop, so only rm -f seemed to work for me, but i made sure i was in the videos folder before using the loop full power)
If you have questions, feel free to ask.
- chrispeacheyJul 24, 2015Aspirant
need some support for this? so many other no-name cameras supported but not foscam? bit confused.
- jjames1Sep 17, 2015Tutor
was trying the 30 days free, looks like no support for Foscam , means mays as well uninstall.....
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!