Foscam FI8908W IP Camera with PT (no Z) Working in ZM 1.24.2

Post here to indicate any hardware you have used and which is known to work with ZoneMinder. Not for questions.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

I am still locking up the camera with ZM (after a number of hours) and now found out that I can lock it using various cgi commands rapidly in succession. (IE: if I make the camera work a bit).

So for the time being its really a no go on this camera. If you watch it boot up via the JTAG cable you'll see numerous errors related to an incomplete / untested OS / HW / GUI. (unbaked OS)

I may give the newest version of the cam a try to see if its any better than this one.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

I ended up reloading the binaries (provided by Foscam). Doing that the camera stayed in an endless loop.

I did purchase the new revision of the camera. (8918)

Some nice new features.

I am testing this one also with ZM. Its locking the same with ZM as the previous model. Its set to a 640X480 picture at about 5 FPS.
BrianB
Posts: 8
Joined: Thu Sep 09, 2010 10:40 am

Post by BrianB »

daveharris wrote:Just one more thing that might be useful to somebody.

I had an issue that on the replay of an event the first frame would show then a black screen with

"time to next event = 1 seconds"

would appear and i wouldnt be able to use the buttons.

I found i had set the Image Buffer Size and the Pre Event Image count both to 40. Once i lowered the Pre Event Image Count to 30, it all worked.

Cheers,

DAVE.
THANK YOU, three days of trying to sort out this problem and this was the solution.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

The new Foscam exhibits much of the same behavior as the older model. I can get streaming video at 320X240 without the Foscam locking up. At 640X480 it locks up as before after a period of time.

Instead now doing a snapshot.cgi at 640X480 and it doesn't lock up but its a bit limiting using ZM with the Foscam in this manner. I had previously tried changing the buffer values as documented - and a bit more to see if it changed anything)

I locked up the camera trying something else today. As light changed from inside to outdoor light (sunny day) making adjustments to the brightness setting locked it. Initially saw that I couldn't change brightness. After a bit with no reponse camera went to the endless reboot sequence. Personally I don't believe its relating to the HW rather its related to the software in the camera.

The new Foscam though with the added LEDs works much better in the dark (garage is my test environment).

The old Foscam continues to just reboot with whatever has been provided by Foscam relating to binaries. Some "revised" binaries have been posted stating that they should work with the two versions of the older Foscam. They do not for my Foscam. Support has been great but when I asked them about returning the Foscam to Foscam USA; even suggesting that I would pay to fix it; Foscam support stated they did not have that service available.
arymar
Posts: 13
Joined: Tue Dec 14, 2010 3:53 pm
Location: France

What about Fedora 14 ?

Post by arymar »

Hi,
First of all many thanks for this post.
Nevertheless, i am facing a static PT FI8908W even if i followed up very carefully your explanations.
I am using Fedora 14 and there might be some differences that leads my FI8908W not to be controlable wioth this script.

1/ if I issue the command from a web browser, no issue, it works
eg: http://IP@/decoder_control.cgi?command=2&user=ZoneMinder&pwd=alain
It moves down as expected.

2/ The Zonemimder installation on Fedora places the Control directory and files here:
/usr/share/perl5/ZoneMinder/Control.
So the FoscamFI8908W.pm file has been placed here as all other pm files.

3/ The zmcontrol.pl script file refers to the wrong lib path so I changed it to:
use lib '/usr/share/perl5'; # Include custom perl install path instead of
use lib '/usr/local/share/perl5'; # Include custom perl install path

4/ while looking at the zmcontrol.log file, here is what i get:
12/14/10 16:36:45.313779 zmcontrol[2457].DBG [--autostop --command=moveConDownRight --id=2]
12/14/10 16:36:45.336903 zmcontrol[2457].INF [Starting control server 2/FoscamFI8908W]
12/14/10 16:36:45.343125 zmcontrol[2461].INF [Control server 2/FoscamFI8908W starting at 10/12/14 16:36:45]
12/14/10 16:36:55.340688 zmcontrol[2457].FAT [Can't connect: No such file or directory]

5/ I added some perl commands in the "new" sub from the FoscamFI8908W.pm file so that it adds a line in a log file, but nothing happens.

6/ Additionnal checks:
- Camera monitor is setup as Controllable "ticked"
- Control Type Foscam FI8908W mapping to protocol FoscamFI8908W
- in Options, OPT_CONTROL is "itcked"

I feel that I have an overall path definition issue as it looks that I can not call the right FoscamFI8908W.pm file according to the log.

Any idea or guideline on hoy I could troubleshoot this ?


############## Found my Issue !###############
While trying to debug, I was still stuck et the zmcontrol.pl manual command and the "Can't Connect" message.
Command is: # /usr/bin/zmcontrol.pl --id=2 --command= moveConUp
(2 is my Monitor ID)
I digged into the FoscamFI8908W.pm code and execute it from the command line:
#perl FoscamFI8908FW.pm
and at this point, I was always having an error linked to a $class definition that was global in the script and should have been local in the "sub New" section of the code.
By just adding a local declaration instead : #my $class = ...
then I got rid of the error while executing the FoscamFI8908W.pm script. Then right after, testing the PT from the web interface has been a success.

My 2cts...
Last edited by arymar on Wed Dec 29, 2010 6:28 am, edited 1 time in total.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

I'll let you know in a couple of days.

I just moved the ZM server to 1.2.4.2/Ubuntu 10.10 and haven't configured the two IP cams yet.

I'm having problems with running the Xap piece right now.

I "was" using 1.23.3 of ZM and it worked fine.
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

I was able to set up both the Panasonic and Foscam PT cameras in ZM. I didn't really have any issues except for one. I edited the file and the name of the control file for the updated PT Foscam that I am using. I do not see a reference to the perl path that you write about in the control script?

I didn't change my zmcontrol.pl file to get the Foscam to work.

Code: Select all

#!/usr/bin/perl -wT
#
# ==========================================================================
#
# ZoneMinder Control Script, $Date: 2009-06-08 10:11:56 +0100 (Mon, 08 Jun 2009) $, $Revision: 2908 $
# Copyright (C) 2001-2008 Philip Coombes
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# ==========================================================================
#
# This script continuously monitors the recorded events for the given
# monitor and applies any filters which would delete and/or upload 
# matching events
#
use strict;

# ==========================================================================
#
# These are the elements you can edit to suit your installation
#
# ==========================================================================

use constant DBG_ID => "zmcontrol"; # Tag that appears in debug to identify source
use constant DBG_LEVEL => 0; # 0 is errors, warnings and info only, > 0 for debug

# ==========================================================================

# Include from system perl paths only
use ZoneMinder;
use Getopt::Long;
use POSIX qw/strftime EPIPE/;
use Socket;
use Data::Dumper;
use Module::Load;
use PHP::Serialization qw(serialize unserialize);

use constant MAX_CONNECT_DELAY => 10;
use constant MAX_COMMAND_WAIT => 1800;

$| = 1;

$ENV{PATH}  = '/bin:/usr/bin';
$ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};

sub Usage
{
    print( "
Usage: zmcontrol.pl --id <monitor_id> --command=<command> <various>
");
    exit( -1 );
}

zmDbgInit( DBG_ID, level=>DBG_LEVEL );

my $arg_string = join( " ", @ARGV );

my $id;
my %options;

if ( !GetOptions(
    'id=i'=>\$id,
    'command=s'=>\$options{command},
    'xcoord=i'=>\$options{xcoord},
    'ycoord=i'=>\$options{ycoord},
    'speed=i'=>\$options{speed},
    'step=i'=>\$options{step},
    'panspeed=i'=>\$options{panspeed},
    'tiltspeed=i'=>\$options{tiltspeed},
    'panstep=i'=>\$options{panstep},
    'tiltstep=i'=>\$options{tiltstep},
    'preset=i'=>\$options{preset},
    'autostop'=>\$options{autostop},
    )
)
{
    Usage();
}

if ( !$id || !$options{command} )
{
    print( STDERR "Please give a valid monitor id and command\n" );
    Usage();
}

( $id ) = $id =~ /^(\w+)$/;

Debug( $arg_string );

my $sock_file = ZM_PATH_SOCKS.'/zmcontrol-'.$id.'.sock';

socket( CLIENT, PF_UNIX, SOCK_STREAM, 0 ) or Fatal( "Can't open socket: $!" );

my $saddr = sockaddr_un( $sock_file );
my $server_up = connect( CLIENT, $saddr );
if ( !$server_up )
{
    # The server isn't there 
    my $monitor = zmDbGetMonitorAndControl( $id );
    if ( !$monitor )
    {
        Fatal( "Unable to load control data for monitor $id" );
    }
    my $protocol = $monitor->{Protocol};

    if ( -x $protocol )
    {
        # Protocol is actually a script!
        # Holdover from previous versions
        my $command .= $protocol.' '.$arg_string;
        Debug( $command."\n" );

        my $output = qx($command);
        my $status = $? >> 8;
        if ( $status || DBG_LEVEL > 0 )
        {
            chomp( $output );
            Debug( "Output: $output\n" );
        }
        if ( $status )
        {
            Error( "Command '$command' exited with status: $status\n" );
            exit( $status );
        }
        exit( 0 );
    }

    Info( "Starting control server $id/$protocol" );
    close( CLIENT );

    if ( my $cpid = fork() )
    {
        zmDbgInit( DBG_ID, level=>DBG_LEVEL );

        # Parent process just sleep and fall through
        socket( CLIENT, PF_UNIX, SOCK_STREAM, 0 ) or die( "Can't open socket: $!" );
        my $attempts = 0;
        while (!connect( CLIENT, $saddr ))
        {
            $attempts++;
            Fatal( "Can't connect: $!" ) if ($attempts > MAX_CONNECT_DELAY);
            sleep(1);
        }
    }
    elsif ( defined($cpid) )
    {
        close( STDOUT );
        close( STDERR );

        setpgrp();

        zmDbgInit( DBG_ID, level=>DBG_LEVEL );

        Info( "Control server $id/$protocol starting at ".strftime( '%y/%m/%d %H:%M:%S', localtime() ) );

        $0 = $0." --id $id";

        load "ZoneMinder::Control::$protocol";

        my $control = "ZoneMinder::Control::$protocol"->new( $id );
        my $control_key = $control->getKey();
        $control->loadMonitor();

        $control->open();

        socket( SERVER, PF_UNIX, SOCK_STREAM, 0 ) or Fatal( "Can't open socket: $!" );
        unlink( $sock_file );
        bind( SERVER, $saddr ) or Fatal( "Can't bind: $!" );
        listen( SERVER, SOMAXCONN ) or Fatal( "Can't listen: $!" );

        my $rin = '';
        vec( $rin, fileno(SERVER), 1 ) = 1;
        my $win = $rin;
        my $ein = $win;
        my $timeout = MAX_COMMAND_WAIT;
        while( 1 )
        {
            my $nfound = select( my $rout = $rin, undef, undef, $timeout );
            if ( $nfound > 0 )
            {
                if ( vec( $rout, fileno(SERVER), 1 ) )
                {
                    my $paddr = accept( CLIENT, SERVER );
                    my $message = <CLIENT>;

                    next if ( !$message );

                    my $params = unserialize( $message );
                    #Debug( Dumper( $params ) );

                    my $command = $params->{command};
                    $control->$command( $params );
                    close( CLIENT );
                }
                else
                {
                    Fatal( "Bogus descriptor" );
                }
            }
            elsif ( $nfound <0>close();
        exit( 0 );
    }
    else
    {
        Fatal( "Can't fork: $!" );
    }
}

# The server is there, connect to it
#print( "Writing commands\n" );
CLIENT->autoflush();

my $message = serialize( \%options );
print( CLIENT $message );
shutdown( CLIENT, 1 );

exit( 0 );
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

The good news is that I have left the configuration at 640X480 in streaming mode with the newest Zoneminder version 1.24.2 / Ubuntu 10.10 and its not locking up the Foscam. Not really sure why with the ZM version 1.23.4 it would lock up the Foscam. The control via the PM file works well also.

The support folks at Foscam were very friendly relating to my first Foscam providing me all of the files to update the FW yet the camera really never worked after the first "wrong" FW update. So its just sitting there in a bricked mode.
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Post by PacoLM »

Hi pete,

Which version of fw has actually your Foscam?.

PacoLM
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

Currently its sitting where I purchased the camera at

Device FW version 11.22.2.23
Webu UI version 2.4.18.15

Days running ZM 1.24.x and no lockups at an uncapped FPS, 640X480 with the PM control file. Previously with ZM 1.23.X the same Foscam would lock up in a few minutes to where I would have to pull the power.

I had "given up" on the camera before installation/update to ZM 1.24.X and was just doing a timed snapshot.cgi with it; such that it would lock up.
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Post by PacoLM »

Hi,

I had some problems with the previous fw I had in my Foscam, so after reading this topic, I searched for the newer firmware. There's a newer version (Firmware 11.14.2.28 UI 2.4.8.15), I found it here:

http://www.foscam.nl/index.php?option=c ... w&Itemid=3

Regards,

PacoLM[/url]
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

Thanks Paco.

The new camera I have is the FI8918W. It starting locking up yesterday after running for "days" on newest ZM version level.

This morning set it to snapshot and it still locked up.

I'm very cautious now relating to firmware updates as the previous model (bricked on the shelf now) was a newer model of the Foscam. I updated it with the older model Foscam firmware and it never was right after that. Even with technical support from Foscam (and using the serial connection to update the firmware).
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Post by pete_c »

Thanks PacoLM for your help.

I finally updated the Foscam FW and changed the ZM to Foscam link. I also updated the CPU/Memory now to 4Gb. I am now getting 30 FPS on the video card cams and doing decent but less than 10 FPS on the two IP cams.

The Foscam is now running with no problems 24/7. The Panasonic IP cam never caused any issues.

I'm impressed though with the FPS. I never got more than 15 FPS with the older 1.23.x ZM setup on the older computer.

The only change now I want to make is in the PM file. If I click left or right it continues moving until I stop it.

Does yours work the same way?
User avatar
pete_c
Posts: 88
Joined: Thu Jan 24, 2008 3:21 am
Location: USA

Foscam Stability

Post by pete_c »

I finally was able to create a ZM configuration that won't lock up the Foscam anymore.

I changed the buffers such that I let it run at the full FPS of 5-15 FPS or so and at a 640X480 resolution. The average FPS is only around 5 though.

I also noticed that NTP really doesn't work well. IE: test it yourself and then look at the logging. The date in the logging (new camera cold boot) stays back in 1969. If you just shut off the NTP setup and sync to you PC it'll be OK but not synced to NTP. I also had a detailed look at the networking going on. Its kind of a "jumbled" hodgpodge of chatter which almost is like the thing is beaconing all of the time conflicting with the video streaming.

Here is my buffers configuration. (which has worked now for over 3 days).

Image Buffer Size (frames) - 10
Warmup Frames - 5
Pre Event Image Count - 5
Post Event Image Count - 5
Stream Replay Image Buffer - 1000
Alarm Frame Count - 1

I also have the PM file working adjust for slower PT motion and have inserted the 3 "lighting" configurations - all working well now.

My final comment on the Foscam is that its a "cute" toy and attempts to be a real PT camera but fails miserably - worth more like $20 than even $80 USD.
krusty
Posts: 1
Joined: Thu Feb 10, 2011 2:25 pm

cannot get it working

Post by krusty »

Hi all,

i've a foscam ip cam, model FI8918W and trying to follow the manual.

http://www.zoneminder.com/wiki/index.php/Foscam

at this point "Now save that as ‘FoscamFI8908W.pm’ in the same location where you found the PanasonicIP.pm file. (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,. Click on edit and add a new control with these details: "

I copied the file where it supposed to be (on my ubuntu is /usr/share/perl5/ZoneMinder/Control). checked permissions as well.

but then....

i really do not understand. after 2 hours i feel like a dumb. I copied the file, i followed all the previous steps. but when "click on edit and add a new control..." i get lost.
where should i click on "edit"?

on options? (top right)
on the camera name under "name"?
or whereelse?

why this manual is not idiot (me) proof with pictures? or maybe is the interface changed after the writing of the manual?

or maybe my model is not compatible since is the model after the one used to write that manual?


please help.

cheers and thanks for your time guys
Post Reply