<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.staging.zoneminder.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Q3ok</id>
	<title>ZoneMinder Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.staging.zoneminder.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Q3ok"/>
	<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/Special:Contributions/Q3ok"/>
	<updated>2026-04-19T21:52:08Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6954</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6954"/>
		<updated>2015-08-23T20:05:31Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: /* Auto reboot camera when it fails */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
:System Firmware Version 	1.5.1.11&lt;br /&gt;
:Application Firmware Version 	2.22.1.143&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provided above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY FOR YOUR NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN_LOGIN&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;ADMIN_PASSWORD&amp;#039;);&lt;br /&gt;
define(&amp;#039;RESTARTER_DIR&amp;#039;, &amp;#039;/var/foscam_restarter/&amp;#039;);&lt;br /&gt;
define(&amp;#039;R_TIMEZONE&amp;#039;, &amp;#039;Europe/Warsaw&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* DONT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU ARE DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* lock file, only one instance of this script can be run */&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
class FoscamCamera {&lt;br /&gt;
   private $ip;&lt;br /&gt;
   private $port;&lt;br /&gt;
   private $login;&lt;br /&gt;
   private $password;&lt;br /&gt;
&lt;br /&gt;
   public function __construct( $ip, $port, $login, $password ) {&lt;br /&gt;
      $this-&amp;gt;ip = $ip;&lt;br /&gt;
      $this-&amp;gt;port = $port;&lt;br /&gt;
      $this-&amp;gt;login = $login;&lt;br /&gt;
      $this-&amp;gt;password = $password;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   public function restart() {&lt;br /&gt;
      $return = $this-&amp;gt;doCommand(&amp;#039;rebootSystem&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
      if ( str_replace(&amp;#039;&amp;lt;result&amp;gt;0&amp;lt;/result&amp;gt;&amp;#039;, &amp;#039;&amp;#039;, $return) != $return) {&lt;br /&gt;
         return true;&lt;br /&gt;
      }&lt;br /&gt;
      return false;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   private function doCommand( $command, $params = array() ) {&lt;br /&gt;
   &lt;br /&gt;
      $url = $this-&amp;gt;getCgiUrl();&lt;br /&gt;
      $url.= &amp;#039;?cmd=&amp;#039; . $command;&lt;br /&gt;
      $url.= &amp;#039;&amp;amp;usr=&amp;#039; . $this-&amp;gt;login . &amp;#039;&amp;amp;pwd=&amp;#039; . $this-&amp;gt;password;&lt;br /&gt;
&lt;br /&gt;
      foreach ($params as $param_key =&amp;gt; $param_val) {&lt;br /&gt;
         $url.=&amp;#039;&amp;amp;&amp;#039; . $param_key . &amp;#039;=&amp;#039; . $param_val;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      return shell_exec(&amp;#039;curl -s &amp;quot;&amp;#039; . $url . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   private function getCgiUrl() {&lt;br /&gt;
      return &amp;#039;http://&amp;#039; . $this-&amp;gt;ip . &amp;#039;:&amp;#039; . $this-&amp;gt;port . &amp;#039;/cgi-bin/CGIProxy.fcgi&amp;#039;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function endscript( $success = true ) {&lt;br /&gt;
   if ( $success ) {&lt;br /&gt;
      file_put_contents( RESTARTER_DIR . &amp;#039;info_file&amp;#039;, time() );&lt;br /&gt;
   }&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript( false );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
system(&amp;#039;mkdir -p &amp;#039; . RESTARTER_DIR);&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( RESTARTER_DIR . &amp;#039;info_file&amp;#039; ) ) {&lt;br /&gt;
   /* first run, save run time and wait for next check */&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; &amp;#039; . RESTARTER_DIR . &amp;#039;cat001&amp;#039;);&lt;br /&gt;
$error_lines = file( RESTARTER_DIR . &amp;#039;cat001&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
if ( count($error_lines) &amp;lt; 2 ) {&lt;br /&gt;
   // no action needed&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
$error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
$last_fail = new DateTime( trim( substr($error_lines[0], 0, 15) ), new DateTimeZone(R_TIMEZONE) );&lt;br /&gt;
$last_fail2 = new DateTime( trim( substr($error_lines[1], 0, 15) ), new DateTimeZone(R_TIMEZONE) );&lt;br /&gt;
&lt;br /&gt;
$last_check_pure = file_get_contents( RESTARTER_DIR . &amp;#039;info_file&amp;#039; );&lt;br /&gt;
$last_check = new DateTime();&lt;br /&gt;
$last_check-&amp;gt;setTimezone( new DateTimeZone(R_TIMEZONE) );&lt;br /&gt;
$last_check-&amp;gt;setTimestamp( $last_check_pure );&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced restart!&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( in_array(&amp;#039;force&amp;#039;,$argv) || ( $last_fail &amp;gt; $last_check &amp;amp;&amp;amp; $last_fail2 &amp;gt; $last_check ) ) {&lt;br /&gt;
   echo date(&amp;#039;d-m-Y H:i.s&amp;#039;) . &amp;#039; - fails detected restarting!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $foscam = new FoscamCamera( FOSCAM_IP, FOSCAM_PORT, FOSCAM_LOGIN, FOSCAM_PASS );&lt;br /&gt;
   if ( $foscam-&amp;gt;restart() ) {&lt;br /&gt;
      echo &amp;#039;Restarted. Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
      sleep( SLEEP_TIME );&lt;br /&gt;
      echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
      echo &amp;#039;Cannot restart camera, check camera IP, PORT, LOGIN and PASSWORD. Provided user must have rights to reboot camera.&amp;#039; . PHP_EOL;&lt;br /&gt;
      endscript(false);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
endscript();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * root /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. If You have logrotate on zoneminder logs, modify logrotate script - add cleanup of /tmp/foscam_restarter/info_file (defined as INFO_FILE)&lt;br /&gt;
For example, script for logrotate with restarter support:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/zm/*.log {&lt;br /&gt;
        daily&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 31&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                /usr/bin/zmpkg.pl logrot 2&amp;gt; /dev/null &amp;gt; /dev/null || true&lt;br /&gt;
                /bin/rm -f /tmp/foscam_restarter/info_file&lt;br /&gt;
        endscript&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Probably its done, unless You have other custom modifications.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6953</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6953"/>
		<updated>2015-08-23T20:04:59Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: /* Auto reboot camera when it fails */ new script version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
:System Firmware Version 	1.5.1.11&lt;br /&gt;
:Application Firmware Version 	2.22.1.143&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provided above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY FOR YOUR NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;10.0.0.11&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;88&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;adm&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;admin123&amp;#039;);&lt;br /&gt;
define(&amp;#039;RESTARTER_DIR&amp;#039;, &amp;#039;/var/foscam_restarter/&amp;#039;);&lt;br /&gt;
define(&amp;#039;R_TIMEZONE&amp;#039;, &amp;#039;Europe/Warsaw&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* DONT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU ARE DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* lock file, only one instance of this script can be run */&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
class FoscamCamera {&lt;br /&gt;
   private $ip;&lt;br /&gt;
   private $port;&lt;br /&gt;
   private $login;&lt;br /&gt;
   private $password;&lt;br /&gt;
&lt;br /&gt;
   public function __construct( $ip, $port, $login, $password ) {&lt;br /&gt;
      $this-&amp;gt;ip = $ip;&lt;br /&gt;
      $this-&amp;gt;port = $port;&lt;br /&gt;
      $this-&amp;gt;login = $login;&lt;br /&gt;
      $this-&amp;gt;password = $password;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   public function restart() {&lt;br /&gt;
      $return = $this-&amp;gt;doCommand(&amp;#039;rebootSystem&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
      if ( str_replace(&amp;#039;&amp;lt;result&amp;gt;0&amp;lt;/result&amp;gt;&amp;#039;, &amp;#039;&amp;#039;, $return) != $return) {&lt;br /&gt;
         return true;&lt;br /&gt;
      }&lt;br /&gt;
      return false;&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   private function doCommand( $command, $params = array() ) {&lt;br /&gt;
   &lt;br /&gt;
      $url = $this-&amp;gt;getCgiUrl();&lt;br /&gt;
      $url.= &amp;#039;?cmd=&amp;#039; . $command;&lt;br /&gt;
      $url.= &amp;#039;&amp;amp;usr=&amp;#039; . $this-&amp;gt;login . &amp;#039;&amp;amp;pwd=&amp;#039; . $this-&amp;gt;password;&lt;br /&gt;
&lt;br /&gt;
      foreach ($params as $param_key =&amp;gt; $param_val) {&lt;br /&gt;
         $url.=&amp;#039;&amp;amp;&amp;#039; . $param_key . &amp;#039;=&amp;#039; . $param_val;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
      return shell_exec(&amp;#039;curl -s &amp;quot;&amp;#039; . $url . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   private function getCgiUrl() {&lt;br /&gt;
      return &amp;#039;http://&amp;#039; . $this-&amp;gt;ip . &amp;#039;:&amp;#039; . $this-&amp;gt;port . &amp;#039;/cgi-bin/CGIProxy.fcgi&amp;#039;;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function endscript( $success = true ) {&lt;br /&gt;
   if ( $success ) {&lt;br /&gt;
      file_put_contents( RESTARTER_DIR . &amp;#039;info_file&amp;#039;, time() );&lt;br /&gt;
   }&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript( false );&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
system(&amp;#039;mkdir -p &amp;#039; . RESTARTER_DIR);&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( RESTARTER_DIR . &amp;#039;info_file&amp;#039; ) ) {&lt;br /&gt;
   /* first run, save run time and wait for next check */&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; &amp;#039; . RESTARTER_DIR . &amp;#039;cat001&amp;#039;);&lt;br /&gt;
$error_lines = file( RESTARTER_DIR . &amp;#039;cat001&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
if ( count($error_lines) &amp;lt; 2 ) {&lt;br /&gt;
   // no action needed&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
$error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
$last_fail = new DateTime( trim( substr($error_lines[0], 0, 15) ), new DateTimeZone(R_TIMEZONE) );&lt;br /&gt;
$last_fail2 = new DateTime( trim( substr($error_lines[1], 0, 15) ), new DateTimeZone(R_TIMEZONE) );&lt;br /&gt;
&lt;br /&gt;
$last_check_pure = file_get_contents( RESTARTER_DIR . &amp;#039;info_file&amp;#039; );&lt;br /&gt;
$last_check = new DateTime();&lt;br /&gt;
$last_check-&amp;gt;setTimezone( new DateTimeZone(R_TIMEZONE) );&lt;br /&gt;
$last_check-&amp;gt;setTimestamp( $last_check_pure );&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced restart!&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( in_array(&amp;#039;force&amp;#039;,$argv) || ( $last_fail &amp;gt; $last_check &amp;amp;&amp;amp; $last_fail2 &amp;gt; $last_check ) ) {&lt;br /&gt;
   echo date(&amp;#039;d-m-Y H:i.s&amp;#039;) . &amp;#039; - fails detected restarting!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $foscam = new FoscamCamera( FOSCAM_IP, FOSCAM_PORT, FOSCAM_LOGIN, FOSCAM_PASS );&lt;br /&gt;
   if ( $foscam-&amp;gt;restart() ) {&lt;br /&gt;
      echo &amp;#039;Restarted. Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
      sleep( SLEEP_TIME );&lt;br /&gt;
      echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
&lt;br /&gt;
   } else {&lt;br /&gt;
      echo &amp;#039;Cannot restart camera, check camera IP, PORT, LOGIN and PASSWORD. Provided user must have rights to reboot camera.&amp;#039; . PHP_EOL;&lt;br /&gt;
      endscript(false);&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
endscript();&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * root /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. If You have logrotate on zoneminder logs, modify logrotate script - add cleanup of /tmp/foscam_restarter/info_file (defined as INFO_FILE)&lt;br /&gt;
For example, script for logrotate with restarter support:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/zm/*.log {&lt;br /&gt;
        daily&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 31&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                /usr/bin/zmpkg.pl logrot 2&amp;gt; /dev/null &amp;gt; /dev/null || true&lt;br /&gt;
                /bin/rm -f /tmp/foscam_restarter/info_file&lt;br /&gt;
        endscript&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Probably its done, unless You have other custom modifications.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6952</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6952"/>
		<updated>2015-08-22T21:57:18Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: /* Auto reboot camera when it fails */ unharmful wrong date (I instead of i)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
:System Firmware Version 	1.5.1.11&lt;br /&gt;
:Application Firmware Version 	2.22.1.143&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provided above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:i.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * root /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. If You have logrotate on zoneminder logs, modify logrotate script - add cleanup of /tmp/foscam_restarter/info_file (defined as INFO_FILE)&lt;br /&gt;
For example, script for logrotate with restarter support:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/zm/*.log {&lt;br /&gt;
        daily&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 31&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                /usr/bin/zmpkg.pl logrot 2&amp;gt; /dev/null &amp;gt; /dev/null || true&lt;br /&gt;
                /bin/rm -f /tmp/foscam_restarter/info_file&lt;br /&gt;
        endscript&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Probably its done, unless You have other custom modifications.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6951</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6951"/>
		<updated>2015-08-22T21:55:23Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: /* Auto reboot camera when it fails */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
:System Firmware Version 	1.5.1.11&lt;br /&gt;
:Application Firmware Version 	2.22.1.143&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provided above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * root /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. If You have logrotate on zoneminder logs, modify logrotate script - add cleanup of /tmp/foscam_restarter/info_file (defined as INFO_FILE)&lt;br /&gt;
For example, script for logrotate with restarter support:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/zm/*.log {&lt;br /&gt;
        daily&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 31&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                /usr/bin/zmpkg.pl logrot 2&amp;gt; /dev/null &amp;gt; /dev/null || true&lt;br /&gt;
                /bin/rm -f /tmp/foscam_restarter/info_file&lt;br /&gt;
        endscript&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Probably its done, unless You have other custom modifications.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6950</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6950"/>
		<updated>2015-08-22T18:13:55Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
:System Firmware Version 	1.5.1.11&lt;br /&gt;
:Application Firmware Version 	2.22.1.143&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provided above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. If You have logrotate on zoneminder logs, modify logrotate script - add cleanup of /tmp/foscam_restarter/info_file (defined as INFO_FILE)&lt;br /&gt;
For example, script for logrotate with restarter support:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/zm/*.log {&lt;br /&gt;
        daily&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 31&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                /usr/bin/zmpkg.pl logrot 2&amp;gt; /dev/null &amp;gt; /dev/null || true&lt;br /&gt;
                /bin/rm -f /tmp/foscam_restarter/info_file&lt;br /&gt;
        endscript&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Probably its done, unless You have other custom modifications.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6949</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6949"/>
		<updated>2015-08-21T19:43:49Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
:System Firmware Version 	1.5.1.11&lt;br /&gt;
:Application Firmware Version 	2.22.1.143&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. If You have logrotate on zoneminder logs, modify logrotate script - add cleanup of /tmp/foscam_restarter/info_file (defined as INFO_FILE)&lt;br /&gt;
For example, script for logrotate with restarter support:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/zm/*.log {&lt;br /&gt;
        daily&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 31&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                /usr/bin/zmpkg.pl logrot 2&amp;gt; /dev/null &amp;gt; /dev/null || true&lt;br /&gt;
                /bin/rm -f /tmp/foscam_restarter/info_file&lt;br /&gt;
        endscript&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Probably its done, unless You have other custom modifications.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6948</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6948"/>
		<updated>2015-08-21T19:43:18Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
System Firmware Version 	1.5.1.11&lt;br /&gt;
&lt;br /&gt;
Application Firmware Version 	2.22.1.143&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. If You have logrotate on zoneminder logs, modify logrotate script - add cleanup of /tmp/foscam_restarter/info_file (defined as INFO_FILE)&lt;br /&gt;
For example, script for logrotate with restarter support:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/zm/*.log {&lt;br /&gt;
        daily&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 31&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                /usr/bin/zmpkg.pl logrot 2&amp;gt; /dev/null &amp;gt; /dev/null || true&lt;br /&gt;
                /bin/rm -f /tmp/foscam_restarter/info_file&lt;br /&gt;
        endscript&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Probably its done, unless You have other custom modifications.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6947</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6947"/>
		<updated>2015-08-21T19:43:05Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
System Firmware Version 	1.5.1.11&lt;br /&gt;
Application Firmware Version 	2.22.1.143&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. If You have logrotate on zoneminder logs, modify logrotate script - add cleanup of /tmp/foscam_restarter/info_file (defined as INFO_FILE)&lt;br /&gt;
For example, script for logrotate with restarter support:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/zm/*.log {&lt;br /&gt;
        daily&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 31&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                /usr/bin/zmpkg.pl logrot 2&amp;gt; /dev/null &amp;gt; /dev/null || true&lt;br /&gt;
                /bin/rm -f /tmp/foscam_restarter/info_file&lt;br /&gt;
        endscript&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Probably its done, unless You have other custom modifications.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6946</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6946"/>
		<updated>2015-08-21T19:40:44Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: /* Auto reboot camera when it fails */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. If You have logrotate on zoneminder logs, modify logrotate script - add cleanup of /tmp/foscam_restarter/info_file (defined as INFO_FILE)&lt;br /&gt;
For example, script for logrotate with restarter support:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/zm/*.log {&lt;br /&gt;
        daily&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 31&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                /usr/bin/zmpkg.pl logrot 2&amp;gt; /dev/null &amp;gt; /dev/null || true&lt;br /&gt;
                /bin/rm -f /tmp/foscam_restarter/info_file&lt;br /&gt;
        endscript&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Probably its done, unless You have other custom modifications.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6945</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6945"/>
		<updated>2015-08-21T19:37:46Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. If You have logrotate on zoneminder logs, modify logrotate script - add cleanup of /tmp/foscam_restarter/info_file (defined as INFO_FILE)&lt;br /&gt;
For example, script for logrotate with restarter support:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/var/log/zm/*.log {&lt;br /&gt;
        daily&lt;br /&gt;
        missingok&lt;br /&gt;
        rotate 31&lt;br /&gt;
        compress&lt;br /&gt;
        delaycompress&lt;br /&gt;
        sharedscripts&lt;br /&gt;
        postrotate&lt;br /&gt;
                /usr/bin/zmpkg.pl logrot 2&amp;gt; /dev/null &amp;gt; /dev/null || true&lt;br /&gt;
                /bin/rm -f /tmp/foscam_restarter/info_file&lt;br /&gt;
                /bin/touch /tmp/foscam_restarter/info_file&lt;br /&gt;
        endscript&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
9. Probably its done, unless You have other custom modifications.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam&amp;diff=6944</id>
		<title>Foscam</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam&amp;diff=6944"/>
		<updated>2015-08-21T19:26:10Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Model specific wikis==&lt;br /&gt;
&lt;br /&gt;
[[Foscam_FI9831W|Foscam FI9831W Pan/Tilt Camera]]&lt;br /&gt;
&lt;br /&gt;
[[Foscam_FI8918W|Foscam FI8918W Pan/Tilt Camera]]&lt;br /&gt;
&lt;br /&gt;
[[Foscam_FI8910W|Foscam FI8910W Pan/Tilt Camera]]&lt;br /&gt;
&lt;br /&gt;
[[Foscam FI8904W|Foscam FI8904W Outdoor IP camera]]&lt;br /&gt;
&lt;br /&gt;
[[Foscam FI8905W|Foscam FI8905W Outdoor IP camera]]&lt;br /&gt;
&lt;br /&gt;
[[Foscam FI8602W|Foscam FI8602W Outdoor IP camera]]&lt;br /&gt;
&lt;br /&gt;
[[Foscam_FI9801/2W|Foscam FI9801/2W Outdoor IP camera]]&lt;br /&gt;
&lt;br /&gt;
[[Foscam_FI9805W|Foscam FI9805W Megapixel Outdoor IP camera]]&lt;br /&gt;
&lt;br /&gt;
[[Foscam_FI9803EP|Foscam FI9803EP POE Outdoor IP Camera]]&lt;br /&gt;
&lt;br /&gt;
[[Foscam FI8921P|Foscam FI8921P Pan/Tilt Camera]]&lt;br /&gt;
&lt;br /&gt;
[[Foscam Clones]]&lt;br /&gt;
&lt;br /&gt;
[[Wanscam|Wanscam FR4020A2 (Foscam clone)]]&lt;br /&gt;
&lt;br /&gt;
==General Foscam directions==&lt;br /&gt;
&lt;br /&gt;
(This was very helpful for me, but instead of &amp;#039;videostream&amp;#039; below I believe &lt;br /&gt;
it should be &amp;#039;snapshot&amp;#039;.  Using videostream my wifi, using iptraf to monitor&lt;br /&gt;
it, was fluctuating wildly from zero to 5 mbps and lots of events were missed.&lt;br /&gt;
Now that I&amp;#039;m using the snapshot cgi (/snapshot.cgi?user=mine&amp;amp;pwd=mine) &lt;br /&gt;
iptraf shows a steady stream that behaves as expected, jumps up when alarmed,&lt;br /&gt;
am getting the performance from zoneminder other are, where using the&lt;br /&gt;
videostream as below got nothing but furstration...   Best to y&amp;#039;all, gsx)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Foscam FI8908W IP Camera with PT (no Z) Working in ZM 1.24.2&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Firmware 11_14_2_28 with presets working. --[[User:Lowbayer|Lowbayer]] 21:39, 12 March 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
(This also works with the Foscam FI8918W camera.  No sound though.)&lt;br /&gt;
&lt;br /&gt;
See here for detail on [[Foscam_FI8918W]] with presets working. [[User:Hdurdle|Hdurdle]] 23:18, 26 February 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Just thought this might be useful for anybody using the Foscam IP FI8908W Cameras.&lt;br /&gt;
&lt;br /&gt;
They can be bought on eBay for around £50 and for that money they are a great buy. (Beware of fakes, see here: http://www.gadgetvictims.com/2009/09/yet-another-firmware-for-foscam-fi8908w.html)&lt;br /&gt;
&lt;br /&gt;
A firmware upgrade can be performed to allow Server Push Mode, for FireFox etc.&lt;br /&gt;
&lt;br /&gt;
See here for a instructions and a link to the firmware file:&lt;br /&gt;
http://www.gadgetvictims.com/2009/07/foscam-ip-camera-part-two.html&lt;br /&gt;
&lt;br /&gt;
I recommend firmware V11.14.1.42 and Web UI V2.4.8.11&lt;br /&gt;
&lt;br /&gt;
Once that is done you can proceed to add the camera into ZoneMinder with the following settings:&lt;br /&gt;
&lt;br /&gt;
;General:&lt;br /&gt;
:Name: x&lt;br /&gt;
:Source Type: Remote&lt;br /&gt;
:Function: Modect (up to you though)&lt;br /&gt;
:Enabled: Tick&lt;br /&gt;
:Maximum FPS: Empty (I had some issues with it lagging when I used values here)&lt;br /&gt;
:Alarm Maximum FPS: Empty&lt;br /&gt;
;Source&lt;br /&gt;
:Remote Protocol: HTTP&lt;br /&gt;
:Remote Method: Simple&lt;br /&gt;
:Remote Host Name: x.x.x.x (The IP of the camera)&lt;br /&gt;
:Remote Host Port: 80&lt;br /&gt;
:Remote Host Path: /videostream.cgi?user=admin&amp;amp;pwd= (assuming you have an admin user on the cam with no password)&lt;br /&gt;
:Remote Image Colours: 24 bit colour&lt;br /&gt;
:Capture Width: 320 (You could use 640 x 480, I found 320 to be better)&lt;br /&gt;
:Capture Height: 240&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
{|border=&amp;quot;1&amp;quot;&lt;br /&gt;
|Video Stream Url and Parameter&lt;br /&gt;
|-&lt;br /&gt;
|http://&amp;lt;IP-CAM&amp;gt;/||videostream.cgi?||user=A&amp;amp;||pwd=B&amp;amp;||resolution=C||&amp;amp;rate=D&lt;br /&gt;
|-&lt;br /&gt;
| || || User || Password || 8 =&amp;gt; 320x240|| 0 =&amp;gt; maxframe&lt;br /&gt;
|-&lt;br /&gt;
| || || || || 32 =&amp;gt; 640x480|| 1 =&amp;gt; 20 fps&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 3 =&amp;gt; 15 fps&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 6 =&amp;gt; 10 fps&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 11 =&amp;gt; 5 fps&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 12 =&amp;gt; 4 fps&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 15 =&amp;gt; 3 fps&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 14 =&amp;gt; 2 fps&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 15 =&amp;gt; 1 fps&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 17 =&amp;gt; 1 fps/2s&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 19 =&amp;gt; 1 fps/3s&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 21 =&amp;gt; 1 fps/4s&lt;br /&gt;
|-&lt;br /&gt;
| || || || || || 23 =&amp;gt; 1 fps/5s&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
;Example&lt;br /&gt;
:http://&amp;lt;ip-webcam&amp;gt;/videostream.cgi?user=admin&amp;amp;pwd=geheim&amp;amp;resolution=32&amp;amp;rate=6  &lt;br /&gt;
--[[User:Lowbayer|Lowbayer]] 08:05, 11 April 2011 (UTC)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The other settings are for personal preference only – so I haven’t listed them.&lt;br /&gt;
&lt;br /&gt;
I modified an existing camera control file to create this file which will allow you to pan and tilt the camera from the web interface (working in ZM V1.24.2)&lt;br /&gt;
&lt;br /&gt;
Save the following in the same location as the other .pm files. You can search for “PanasonicIP.pm” on your machine and see where that is. In my case it is:&lt;br /&gt;
&lt;br /&gt;
/usr/share/perl/5.10/ZoneMinder/Control&lt;br /&gt;
&lt;br /&gt;
From a terminal window run:&lt;br /&gt;
&lt;br /&gt;
 sudo gedit&lt;br /&gt;
&lt;br /&gt;
Which will open up your text editor in admin mode. Then paste the following between the +++ (excluding the +++) into the text editor:&lt;br /&gt;
&lt;br /&gt;
 +++&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 # ==========================================================================&lt;br /&gt;
 #&lt;br /&gt;
 # ZoneMinder Foscam FI8908W IP Control Protocol Module, $Date: 2009-11-25 09:20:00 +0000 (Wed, 04 Nov 2009) $, $Revision: 0001 $&lt;br /&gt;
 # Copyright (C) 2001-2008 Philip Coombes&lt;br /&gt;
 # Modified for use with Foscam FI8908W IP Camera by Dave Harris&lt;br /&gt;
 #&lt;br /&gt;
 # This program is free software; you can redistribute it and/or&lt;br /&gt;
 # modify it under the terms of the GNU General Public License&lt;br /&gt;
 # as published by the Free Software Foundation; either version 2&lt;br /&gt;
 # of the License, or (at your option) any later version.&lt;br /&gt;
 #&lt;br /&gt;
 # This program is distributed in the hope that it will be useful,&lt;br /&gt;
 # but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&lt;br /&gt;
 # GNU General Public License for more details.&lt;br /&gt;
 #&lt;br /&gt;
 # You should have received a copy of the GNU General Public License&lt;br /&gt;
 # along with this program; if not, write to the Free Software&lt;br /&gt;
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.&lt;br /&gt;
 #&lt;br /&gt;
 # ==========================================================================&lt;br /&gt;
 #&lt;br /&gt;
 # This module contains the implementation of the Foscam FI8908W IP camera control&lt;br /&gt;
 # protocol&lt;br /&gt;
 #&lt;br /&gt;
 package ZoneMinder::Control::FoscamFI8908W;&lt;br /&gt;
 &lt;br /&gt;
 use 5.006;&lt;br /&gt;
 use strict;&lt;br /&gt;
 use warnings;&lt;br /&gt;
 &lt;br /&gt;
 require ZoneMinder::Base;&lt;br /&gt;
 require ZoneMinder::Control;&lt;br /&gt;
 &lt;br /&gt;
 our @ISA = qw(ZoneMinder::Control);&lt;br /&gt;
 &lt;br /&gt;
 our $VERSION = $ZoneMinder::Base::VERSION;&lt;br /&gt;
 &lt;br /&gt;
 # ==========================================================================&lt;br /&gt;
 #&lt;br /&gt;
 # Foscam FI8908W IP Control Protocol&lt;br /&gt;
 #&lt;br /&gt;
 # ==========================================================================&lt;br /&gt;
 &lt;br /&gt;
 use ZoneMinder::Debug qw(:all);&lt;br /&gt;
 use ZoneMinder::Config qw(:all);&lt;br /&gt;
 &lt;br /&gt;
  use Time::HiRes qw( usleep );&lt;br /&gt;
 &lt;br /&gt;
 sub new&lt;br /&gt;
 { &lt;br /&gt;
 &lt;br /&gt;
 my $class = shift;&lt;br /&gt;
 my $id = shift;&lt;br /&gt;
 my $self = ZoneMinder::Control-&amp;gt;new( $id );&lt;br /&gt;
 my $logindetails = &amp;quot;&amp;quot;;&lt;br /&gt;
 bless( $self, $class );&lt;br /&gt;
 srand( time() );&lt;br /&gt;
 return $self;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 our $AUTOLOAD;&lt;br /&gt;
 &lt;br /&gt;
 sub AUTOLOAD&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 my $class = ref($self) || croak( &amp;quot;$self not object&amp;quot; );&lt;br /&gt;
 my $name = $AUTOLOAD;&lt;br /&gt;
 $name =~ s/.*://;&lt;br /&gt;
 if ( exists($self-&amp;gt;{$name}) )&lt;br /&gt;
 {&lt;br /&gt;
 return( $self-&amp;gt;{$name} );&lt;br /&gt;
 }&lt;br /&gt;
 Fatal( &amp;quot;Can&amp;#039;t access $name member of object of class $class&amp;quot; );&lt;br /&gt;
 }&lt;br /&gt;
 our $stop_command;&lt;br /&gt;
 &lt;br /&gt;
 sub open&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 &lt;br /&gt;
 $self-&amp;gt;loadMonitor();&lt;br /&gt;
 &lt;br /&gt;
 use LWP::UserAgent;&lt;br /&gt;
 $self-&amp;gt;{ua} = LWP::UserAgent-&amp;gt;new;&lt;br /&gt;
 $self-&amp;gt;{ua}-&amp;gt;agent( &amp;quot;ZoneMinder Control Agent/&amp;quot;.ZM_VERSION );&lt;br /&gt;
 &lt;br /&gt;
 $self-&amp;gt;{state} = &amp;#039;open&amp;#039;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 sub close&lt;br /&gt;
 { &lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 $self-&amp;gt;{state} = &amp;#039;closed&amp;#039;;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 sub printMsg&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 my $msg = shift;&lt;br /&gt;
 my $msg_len = length($msg);&lt;br /&gt;
 &lt;br /&gt;
 Debug( $msg.&amp;quot;[&amp;quot;.$msg_len.&amp;quot;]&amp;quot; );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 sub sendCmd&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 my $cmd = shift;&lt;br /&gt;
 my $result = undef;&lt;br /&gt;
 printMsg( $cmd, &amp;quot;Tx&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 my $req = HTTP::Request-&amp;gt;new( GET=&amp;gt;&amp;quot;http://&amp;quot;.$self-&amp;gt;{Monitor}-&amp;gt;{ControlAddress}.&amp;quot;/$cmd&amp;quot; );&lt;br /&gt;
 my $res = $self-&amp;gt;{ua}-&amp;gt;request($req);&lt;br /&gt;
 &lt;br /&gt;
 if ( $res-&amp;gt;is_success )&lt;br /&gt;
 {&lt;br /&gt;
 $result = !undef;&lt;br /&gt;
 }&lt;br /&gt;
 else&lt;br /&gt;
 {&lt;br /&gt;
 Error( &amp;quot;Error check failed:&amp;#039;&amp;quot;.$res-&amp;gt;status_line().&amp;quot;&amp;#039;&amp;quot; );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 return( $result );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 sub reset&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 Debug( &amp;quot;Camera Reset&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;reboot.cgi?user=admin&amp;amp;pwd=&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 #Up Arrow&lt;br /&gt;
 sub moveConUp&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 $stop_command = &amp;quot;1&amp;quot;;&lt;br /&gt;
 Debug( &amp;quot;Move Up&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;decoder_control.cgi?command=0&amp;amp;user=admin&amp;amp;pwd=&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 #Down Arrow&lt;br /&gt;
 sub moveConDown&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 $stop_command = &amp;quot;1&amp;quot;;&lt;br /&gt;
 Debug( &amp;quot;Move Down&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;decoder_control.cgi?command=2&amp;amp;user=admin&amp;amp;pwd=&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 #Left Arrow&lt;br /&gt;
 sub moveConLeft&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 $stop_command = &amp;quot;1&amp;quot;;&lt;br /&gt;
 Debug( &amp;quot;Move Left&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;decoder_control.cgi?command=4&amp;amp;user=admin&amp;amp;pwd=&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 #Right Arrow&lt;br /&gt;
 sub moveConRight&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 $stop_command = &amp;quot;1&amp;quot;;&lt;br /&gt;
 Debug( &amp;quot;Move Right&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;decoder_control.cgi?command=6&amp;amp;user=admin&amp;amp;pwd=&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 #Diagonally Up Right Arrow&lt;br /&gt;
 sub moveConUpRight&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 $stop_command = &amp;quot;1&amp;quot;;&lt;br /&gt;
 Debug( &amp;quot;Move Diagonally Up Right&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;decoder_control.cgi?command=91&amp;amp;user=admin&amp;amp;pwd=&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 #Diagonally Down Right Arrow&lt;br /&gt;
 sub moveConDownRight&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 $stop_command = &amp;quot;1&amp;quot;;&lt;br /&gt;
 Debug( &amp;quot;Move Diagonally Down Right&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;decoder_control.cgi?command=93&amp;amp;user=admin&amp;amp;pwd=&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 #Diagonally Up Left Arrow&lt;br /&gt;
 sub moveConUpLeft&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 $stop_command = &amp;quot;1&amp;quot;;&lt;br /&gt;
 Debug( &amp;quot;Move Diagonally Up Left&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;decoder_control.cgi?command=90&amp;amp;user=admin&amp;amp;pwd=&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 #Diagonally Down Left Arrow&lt;br /&gt;
 sub moveConDownLeft&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 $stop_command = &amp;quot;1&amp;quot;;&lt;br /&gt;
 Debug( &amp;quot;Move Diagonally Down Left&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;decoder_control.cgi?command=92&amp;amp;user=admin&amp;amp;pwd=&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 #Stop&lt;br /&gt;
 sub moveStop&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 Debug( &amp;quot;Move Stop&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;decoder_control.cgi?user=admin&amp;amp;pwd=&amp;amp;command=1&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 #Move Camera to Home Position&lt;br /&gt;
 sub presetHome&lt;br /&gt;
 {&lt;br /&gt;
 my $self = shift;&lt;br /&gt;
 Debug( &amp;quot;Home Preset&amp;quot; );&lt;br /&gt;
 my $cmd = &amp;quot;decoder_control.cgi?command=25&amp;amp;user=admin&amp;amp;pwd=&amp;quot;;&lt;br /&gt;
 $self-&amp;gt;sendCmd( $cmd );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 1;&lt;br /&gt;
 &lt;br /&gt;
 +++&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Now save that as ‘FoscamFI8908W.pm’ in the same location where you found the PanasonicIP.pm file.&lt;br /&gt;
&lt;br /&gt;
(This file also assumes there is a user with the name admin and no password. If your setup is different, you will need to change this file). This is a first draft working version, I’ll tidy it up once ive learnt a bit more about perl &lt;br /&gt;
&lt;br /&gt;
Next you need to add the Control Type.&lt;br /&gt;
&lt;br /&gt;
Click on edit and add a new control with these details:&lt;br /&gt;
&lt;br /&gt;
Main:&lt;br /&gt;
Name: Foscam FI8908W&lt;br /&gt;
Type: Remote&lt;br /&gt;
Protocol: FoscamFI8908W (No space in there)&lt;br /&gt;
Move:&lt;br /&gt;
Can Move: Tick&lt;br /&gt;
Can Move Diagonally: Tick&lt;br /&gt;
Can Move Continuous: Tick&lt;br /&gt;
Pan:&lt;br /&gt;
Can Pan: Tick&lt;br /&gt;
Tilt:&lt;br /&gt;
Can Tilt: Tick&lt;br /&gt;
Presets:&lt;br /&gt;
Has Presets: Tick&lt;br /&gt;
Num Presets: 0&lt;br /&gt;
Has Home Presets: Tick&lt;br /&gt;
&lt;br /&gt;
Add the IP address of the camera to the &amp;#039;&amp;#039;&amp;#039;Control Address&amp;#039;&amp;#039;&amp;#039; field in the &amp;#039;&amp;#039;&amp;#039;Control&amp;#039;&amp;#039;&amp;#039; tab of camera settings&lt;br /&gt;
&lt;br /&gt;
Save all that and you should be up and running.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
;Here a list of more feature from decoder_control.cgi with the Firmware 11.14.2.28 (found: http://www.gadgetvictims.com/2010/10/fi8908w-old-and-new.html) --[[User:Lowbayer|Lowbayer]] 21:39, 12 March 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
Example: http://&amp;lt;IP_CAM&amp;gt;/decoder_control.cgi?command=30&amp;amp;user=&amp;lt;user&amp;gt;&amp;amp;pwd=&amp;lt;pass&amp;gt; = Set the preset 0&lt;br /&gt;
&lt;br /&gt;
Parameters value&lt;br /&gt;
&lt;br /&gt;
:0 up&lt;br /&gt;
:1 Stop up&lt;br /&gt;
:2 down&lt;br /&gt;
:3 Stop down&lt;br /&gt;
:4 left&lt;br /&gt;
:5 Stop left&lt;br /&gt;
:6 right&lt;br /&gt;
:7 Stop right&lt;br /&gt;
: ... Reserved&lt;br /&gt;
:25 center&lt;br /&gt;
:26 Vertical patrol&lt;br /&gt;
:27 Stop vertical patrol&lt;br /&gt;
:28 Horizon patrol&lt;br /&gt;
:29 Stop horizon patrol&lt;br /&gt;
:30  Set preset 0&lt;br /&gt;
:31  Go preset 0&lt;br /&gt;
:32  Set preset 1&lt;br /&gt;
:33  Go preset 1&lt;br /&gt;
:34  Set preset 2&lt;br /&gt;
:35  Go preset 2&lt;br /&gt;
:  ....&lt;br /&gt;
:62  Set preset 16&lt;br /&gt;
:63  Go preset 16&lt;br /&gt;
:And the list goes further until preset 16&lt;br /&gt;
:94 IO output high&lt;br /&gt;
:95 IO output low &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
A few more notes that I found useful:&lt;br /&gt;
&lt;br /&gt;
Turning off the annoying green LED: (where x.x.x.x is the IP of your camera)&lt;br /&gt;
&lt;br /&gt;
http://x.x.x.x/set_misc.cgi?led_mode=2&amp;amp;user=admin&amp;amp;pwd=&lt;br /&gt;
&lt;br /&gt;
:led_mode=0 - the green led blinks only once connected.&lt;br /&gt;
:led_mode=1 - the green led blinks while searching for a connection and when connected.&lt;br /&gt;
:led_mode=2 - the green led is always off.&lt;br /&gt;
&lt;br /&gt;
Stop the camera moving around when you reboot it:&lt;br /&gt;
&lt;br /&gt;
http://x.x.x.x/set_misc.cgi?ptz_center_onstart=0&amp;amp;user=admin&amp;amp;pwd=&lt;br /&gt;
&lt;br /&gt;
I initially had some issues with no images displaying in ZM. I found this to be a shared memory issue, see here:&lt;br /&gt;
&lt;br /&gt;
http://www.zoneminder.com/wiki/index.php -&amp;gt;  FAQ#What_does_a_.27Can.27t_shmget:_Invalid_argument.27_error_in_my_logs_mean.3F_and_my_cameras_won.27t_display_video_at_higher_resolutions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Here a list of interesting feature: --[[User:Lowbayer|Lowbayer]] 21:39, 12 March 2011 (UTC)&lt;br /&gt;
&lt;br /&gt;
http://[ipcam]/get_misc.cgi -&amp;gt;Returns all the current values for the functions above.&lt;br /&gt;
&lt;br /&gt;
http://[ipcam]/get_log.cgi -&amp;gt; Displays the visits log&lt;br /&gt;
&lt;br /&gt;
http://[ipcam]/get_params.cgi -&amp;gt;Returns the complete configuration of the camera.&lt;br /&gt;
&lt;br /&gt;
https://docs.google.com/fileview?id=0B-yhhBvC0DSlNWExZDU0NTQtMDlmZi00YzkzLWFkNDAtMGU4MTA1MDg2YjMz&amp;amp;hl=en&lt;br /&gt;
&lt;br /&gt;
The feature list from the IPCAM CGI SDK V1.7&lt;br /&gt;
&lt;br /&gt;
http://www.notesco.net/download/ipcamcgisdk21.pdf&lt;br /&gt;
&lt;br /&gt;
The feature list from the IPCAM CGI SDK V2.1&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I found this guide useful for getting ZM 1.24.2 installed in the first place on my ubuntu box:&lt;br /&gt;
&lt;br /&gt;
http://www.howtoforge.com/video_surveillance_zoneminder_ubuntu&lt;br /&gt;
&lt;br /&gt;
I replaced:&lt;br /&gt;
&lt;br /&gt;
ftp://www.northern-ridge.com.au/zoneminder/ubuntu/dapper/zoneminder_1.22.3-8_i386.deb&lt;br /&gt;
&lt;br /&gt;
with&lt;br /&gt;
&lt;br /&gt;
ftp://www.northern-ridge.com.au/zoneminder/1.24/ubuntu/jaunty/zoneminder_1.24.2-1_i386.deb&lt;br /&gt;
&lt;br /&gt;
I have also heard of people replacing the existing lens in the Foscam Camera (it simply unscrews) with a 160° Wide Angle lens to give a better view. (Search eBay for ‘2.1mm CCTV Lens’). I haven’t tried this myself yet, but will at some point in the future.&lt;br /&gt;
&lt;br /&gt;
On more thing to add. Since upgrading to 1.24.2 (I was originally on 1.23) I have had a few issues with apache locking up. I followed the recommended fix in this thread:&lt;br /&gt;
&lt;br /&gt;
http://www.zoneminder.com/forums/viewtopic.php?p=51045&lt;br /&gt;
&lt;br /&gt;
Which has helped a little but I’m still having a few issues. I have to run this command:&lt;br /&gt;
&lt;br /&gt;
sudo apache2ctl restart&lt;br /&gt;
&lt;br /&gt;
every now and then on the box (which I VNC into from my windows box) to restart apache.&lt;br /&gt;
&lt;br /&gt;
Hope this is useful to some people.&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
&lt;br /&gt;
DAVE.&lt;br /&gt;
&lt;br /&gt;
PS - As I&amp;#039;m not always on the forum, I tend to update my blog first (and the forum later - sorry!), it&amp;#039;s here: http://dave.harris.net/foscam-fi8908w-ip-camera-with-pt-no-z-working-in-zoneminder/ :)&lt;br /&gt;
&lt;br /&gt;
;Wireless Setup&lt;br /&gt;
How to setup IP camera wirelessly&lt;br /&gt;
http://foscam.us/forum/post15934.html#p15934&lt;br /&gt;
&lt;br /&gt;
;Test and Tweak IP Camera Setup and Configuration&lt;br /&gt;
Make sure your IP Camera is functioning at peak ability&lt;br /&gt;
http://foscam.us/forum/post34164.html#p34164&lt;br /&gt;
&lt;br /&gt;
;Links;&lt;br /&gt;
* http://www.foscam.com&lt;br /&gt;
* [http://foscam.us/forum/free-generic-browser-interface-for-foscam-ip-mjpeg-cameras-t2522.html#p10970 MJPEG Based Foscam Camera Generic Browser Based Interface Example]&lt;br /&gt;
* [http://foscam.us/forum/free-generic-browser-interface-for-foscam-fi9821w-cameras-t4341.html#p20338 H.264 Based Foscam Camera Generic Browser Based Interface Example]&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6943</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6943"/>
		<updated>2015-08-21T19:22:29Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Check also informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Its done :)&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6942</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6942"/>
		<updated>2015-08-21T19:22:21Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Follow informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Its done :)&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6941</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6941"/>
		<updated>2015-08-21T19:21:37Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Follow informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
Currently i am using this camera settings:&lt;br /&gt;
Off Enhanced Vision (it always slow down when IR ON to 5fps)&lt;br /&gt;
User-defined&lt;br /&gt;
Resolution 720P&lt;br /&gt;
Bit Rate 4M&lt;br /&gt;
Frame rate 15&lt;br /&gt;
Key Frame Interval 10&lt;br /&gt;
Variable bitrate Yes&lt;br /&gt;
&lt;br /&gt;
And Zoneminder settings:&lt;br /&gt;
Source type: FFmpeg&lt;br /&gt;
Source: rtsp://[LOGIN]:[PASSWORD]@10.0.0.11:88/videoMain&lt;br /&gt;
Remote method: RTP/RTSP&lt;br /&gt;
Capture width: 800&lt;br /&gt;
Capture height: 450&lt;br /&gt;
&lt;br /&gt;
I think 720P resolution for this camera is interpolated, so i decided to decrease capture width &amp;amp; height to 800x450.&lt;br /&gt;
If you dont care about image size (and quality...) use capture width/height 1280 / 720.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine.&lt;br /&gt;
You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Its done :)&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6940</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6940"/>
		<updated>2015-08-21T19:14:17Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Follow informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine. You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
8. Its done :)&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6939</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6939"/>
		<updated>2015-08-21T19:13:43Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Follow informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine. You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.log&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6938</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6938"/>
		<updated>2015-08-21T19:11:56Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Follow informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine. You can reboot camera by using URL provider above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Auto reboot camera when it fails ==&lt;br /&gt;
Script is written in PHP (i assume You have PHP installed on Your server)&lt;br /&gt;
Tested on Ubuntu 14.04.3 LTS&lt;br /&gt;
&lt;br /&gt;
1. Paste script in /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/php&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
set_time_limit(0);&lt;br /&gt;
/* MODIFY THIS PARAMETERS TO FIT YOU NEEDS */&lt;br /&gt;
define(&amp;#039;ZM_LOG_FILE&amp;#039;, &amp;#039;/var/log/zm/zm.log&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_IP&amp;#039;, &amp;#039;CAMERA_IP&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PORT&amp;#039;, &amp;#039;CAMERA_PORT&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_LOGIN&amp;#039;, &amp;#039;ADMIN RIGHTS USER&amp;#039;);&lt;br /&gt;
define(&amp;#039;FOSCAM_PASS&amp;#039;, &amp;#039;PASSWORD&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
/* ITS NOT NEEDED TO MODIFY THIS LINES UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
define(&amp;#039;LOCK_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/lock&amp;#039;);&lt;br /&gt;
define(&amp;#039;INFO_FILE&amp;#039;, &amp;#039;/tmp/foscam_restarter/info_file&amp;#039;);&lt;br /&gt;
define(&amp;#039;SLEEP_TIME&amp;#039;, &amp;#039;120&amp;#039;); // sleep time in seconds&lt;br /&gt;
&lt;br /&gt;
/* DO NOT MODIFY BELOW THIS LINE UNLESS YOU KNOW WHAT ARE YOU DOING */&lt;br /&gt;
function endscript() {&lt;br /&gt;
   unlink( LOCK_FILE );&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function restartCamera() {&lt;br /&gt;
   echo &amp;#039;Sending restart command...&amp;#039;;&lt;br /&gt;
   system(&amp;#039;curl -s &amp;quot;http://&amp;#039; . FOSCAM_IP . &amp;#039;:&amp;#039; . FOSCAM_PORT . &amp;#039;/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=&amp;#039; . FOSCAM_LOGIN . &amp;#039;&amp;amp;pwd=&amp;#039; . FOSCAM_PASS . &amp;#039;&amp;quot;&amp;#039;);&lt;br /&gt;
   echo &amp;#039;Sleeping for &amp;#039; . SLEEP_TIME . &amp;#039; seconds...&amp;#039;;&lt;br /&gt;
   sleep( SLEEP_TIME );&lt;br /&gt;
   echo &amp;#039;OK&amp;#039; . PHP_EOL;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function getLastFail() {&lt;br /&gt;
   $last_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
   system(&amp;#039;mkdir -p /tmp/foscam_restarter&amp;#039;);&lt;br /&gt;
   system(&amp;#039;cat &amp;#039; . ZM_LOG_FILE . &amp;#039; | grep &amp;#039; . FOSCAM_IP . &amp;#039; | grep ERR | grep &amp;quot;Unable to open input&amp;quot; &amp;gt; /tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   $error_lines = file(&amp;#039;/tmp/foscam_restarter/cat001&amp;#039;);&lt;br /&gt;
   if ( count($error_lines) == 0 ) {&lt;br /&gt;
      return $last_fail;&lt;br /&gt;
   }&lt;br /&gt;
   $error_lines = array_reverse( array_filter( $error_lines, &amp;#039;trim&amp;#039; ) );&lt;br /&gt;
   $last_fail = trim(substr($error_lines[0], 0, 15));&lt;br /&gt;
   return $last_fail;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( is_file( LOCK_FILE ) ) {&lt;br /&gt;
   exit();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
touch( LOCK_FILE );&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( ZM_LOG_FILE ) ) {&lt;br /&gt;
   echo(&amp;#039;Cannot find ZoneMinder Log File!!&amp;#039;);&lt;br /&gt;
   endscript();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$last_fail = getLastFail();&lt;br /&gt;
&lt;br /&gt;
if ( !is_file( INFO_FILE ) ) {&lt;br /&gt;
   file_put_contents( INFO_FILE, &amp;#039;XXX&amp;#039; );&lt;br /&gt;
   $loaded_fail = &amp;#039;XXX&amp;#039;;&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
   $loaded_fail = file_get_contents( INFO_FILE );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if (in_array(&amp;#039;force&amp;#039;,$argv)) {&lt;br /&gt;
   echo &amp;#039;Forced camera reset by force fail!&amp;#039; . PHP_EOL;&lt;br /&gt;
   $loaded_fail = &amp;#039;YYY&amp;#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
if ( $loaded_fail != $last_fail ) {&lt;br /&gt;
   echo date(&amp;#039;d-M-Y H:I.s&amp;#039;) . PHP_EOL;&lt;br /&gt;
   echo &amp;#039;Camera fail detected (&amp;#039; . $last_fail . &amp;#039;), restarting camera...&amp;#039; . PHP_EOL;&lt;br /&gt;
   restartCamera();&lt;br /&gt;
   $last_fail = getLastFail();&lt;br /&gt;
   file_put_contents( INFO_FILE, $last_fail );&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
endscript();&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. Modify first five params to fit Your needs, and save file&lt;br /&gt;
&lt;br /&gt;
3. Make it executable&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# chmod +x /bin/foscam_restarter.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. OPTIONAL You can check if its working properly with (it will restart your camera!!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# foscam_restarter.php force&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Make log file for restarter&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# touch /var/log/foscam_restarter.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. Add script to crontab&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo &amp;quot;*/1 * * * * /bin/foscam_restarter.php &amp;gt;&amp;gt; /var/log/foscam_restarter.php&amp;quot; &amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
# echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; /etc/cron.d/foscam_restarter&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
7. Restart cron&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# service cron restart&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6937</id>
		<title>Foscam FI9803EP</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Foscam_FI9803EP&amp;diff=6937"/>
		<updated>2015-08-21T13:16:14Z</updated>

		<summary type="html">&lt;p&gt;Q3ok: Created page with &amp;quot;Follow informations made for Foscam_FI9805W  Support only Windows while configuring - camera software need plugin which is provided as exe installer.  &amp;#039;&amp;#039;&amp;#039;Differences betwe...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Follow informations made for [[Foscam_FI9805W]]&lt;br /&gt;
&lt;br /&gt;
Support only Windows while configuring - camera software need plugin which is provided as exe installer.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Differences between FI9805W&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Issues with RTSP stream also is here.&lt;br /&gt;
There is no option 920P for this camera, use 720P while configuring via camera menu.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Commands&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
# Rebooting VIA Command line&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://[CAMERA_IP]:[CAMERA_PORT]/cgi-bin/CGIProxy.fcgi?cmd=rebootSystem&amp;amp;usr=[USERNAME]&amp;amp;pwd=[PASSWORD]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
RTSP stream can hang, but API will still work fine. You can reboot camera by using URL provider above.&lt;/div&gt;</summary>
		<author><name>Q3ok</name></author>
	</entry>
</feed>