Help Decoding Foscam Ip Camera FI8908W

Post here to ask any questions about hardware suitability, configuration in ZoneMinder, or experiences. If you just want to know if something works with ZoneMinder or not, please check the Hardware Compatibility sections in the forum, and the Wiki first. Also search this topic as well.
Post Reply
ronluna
Posts: 8
Joined: Wed Apr 30, 2008 5:27 pm

Help Decoding Foscam Ip Camera FI8908W

Post by ronluna »

I'm trying to get the commands out Foscam IP Camera FI8908W with NeWave Ip Camera Web Server

I'm using Wireshark to get the comunication packets but I'm getting a hard time trying to decode it...

so far this what wireshark has returned after panning the camera to the right

0000 52 54 00 12 35 02 08 00 27 7a 30 9f 08 00 45 00 RT..5... 'z0...E.
0010 00 40 bf 3e 40 00 80 06 6d 59 0a 00 02 0f c0 a8 .@.>@... mY......
0020 01 69 08 1f 00 50 ad 6e 23 80 33 12 3e 21 50 18 .i...P.n #.3.>!P.
0030 ff a3 dc b8 00 00 4d 4f 5f 4f 0e 00 00 00 00 00 ......MO _O......
0040 00 00 00 00 00 01 00 00 00 01 00 00 00 06 ........ ......
ogm
Posts: 10
Joined: Sun Aug 20, 2006 11:40 am

Show your URL for testing

Post by ogm »

Hi,
Why don't you post your IP Camera's URL to the forum so the good people here could help.
I, for one would like to know about this PTZ Wireless Camera.
Thanks
ronluna
Posts: 8
Joined: Wed Apr 30, 2008 5:27 pm

Foscam.pm

Post by ronluna »

I was able to get some codes for Foscam IP FI8908W and based on the other pm's that zoneminder comes with this is the result

I'm not a perl guru but at least I got it to pan/tilt and center with Zoneminder 1.24.1

package ZoneMinder::Control::Foscam;

use 5.006;
use strict;
use warnings;

require ZoneMinder::Base;
require ZoneMinder::Control;

our @ISA = qw(ZoneMinder::Control);

our $VERSION = $ZoneMinder::Base::VERSION;

# ==========================================================================
#
# Foscam IP Control Protocol
#
# ==========================================================================

use ZoneMinder::Debug qw(:all);
use ZoneMinder::Config qw(:all);

use Time::HiRes qw( usleep );

sub new
{

my $class = shift;
my $id = shift;
my $self = ZoneMinder::Control->new( $id );
bless( $self, $class );
srand( time() );
return $self;
}

our $AUTOLOAD;

sub AUTOLOAD
{
my $self = shift;
my $class = ref($self) || croak( "$self not object" );
my $name = $AUTOLOAD;
$name =~ s/.*://;
if ( exists($self->{$name}) )
{
return( $self->{$name} );
}
Fatal( "Can't access $name member of object of class $class" );
}
our $stop_command;

sub open
{
my $self = shift;

$self->loadMonitor();

use LWP::UserAgent;
$self->{ua} = LWP::UserAgent->new;
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );

$self->{state} = 'open';
}

sub close
{
my $self = shift;
$self->{state} = 'closed';
}

sub printMsg
{
my $self = shift;
my $msg = shift;
my $msg_len = length($msg);

Debug( $msg."[".$msg_len."]" );
}

sub sendCmd
{
my $self = shift;
my $cmd = shift;
my $result = undef;
printMsg( $cmd, "Tx" );

my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" );
my $res = $self->{ua}->request($req);

if ( $res->is_success )
{
$result = !undef;
}
else
{
Error( "Error check failed:'".$res->status_line()."'" );
}

return( $result );
}

sub reset
{
my $self = shift;
Debug( "Camera Reset" );
my $cmd = "reboot.cgi?user=admin&pwd=";
$self->sendCmd( $cmd );
}

sub moveConUp
{
my $self = shift;
$stop_command = "1";
Debug( "Move Up" );
my $cmd = "decoder_control.cgi?command=0&user=admin&pwd=";
$self->sendCmd( $cmd );
}

sub moveConDown
{
my $self = shift;
$stop_command = "3";
Debug( "Move Down" );
my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
}

sub moveConLeft
{
my $self = shift;
$stop_command = "5";
Debug( "Move Left" );
my $cmd = "decoder_control.cgi?command=4&user=admin&pwd=";
$self->sendCmd( $cmd );
}

sub moveConRight
{
my $self = shift;
$stop_command = "7";
Debug( "Move Right" );
my $cmd = "decoder_control.cgi?command=6&user=admin&pwd=";
$self->sendCmd( $cmd );
}


sub moveStop
{
my $self = shift;
Debug( "Move Stop" );
my $cmd = "decoder_control.cgi?user=admin&pwd=&command=$stop_command";
$self->sendCmd( $cmd );
}



sub whiteConIn
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "White In $step" );
my $cmd = "/camera_control.cgi?2=$step";
$self->sendCmd( $cmd );
}

sub whiteConOut
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "White Out $step" );
my $cmd = "/camera_control.cgi?2=-$step";
$self->sendCmd( $cmd );
}

sub presetClear
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
Debug( "Clear Preset $preset" );
my $cmd = "nphPresetNameCheck?Data=$preset";
$self->sendCmd( $cmd );
}

sub presetSet
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
Debug( "Set Preset $preset" );
my $cmd = "nphPresetNameCheck?PresetName=$preset&Data=$preset";
$self->sendCmd( $cmd );
}

sub presetGoto
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
Debug( "Goto Preset $preset" );
my $cmd = "nphControlCamera?Direction=Preset&PresetOperation=Move&Data=$preset";
$self->sendCmd( $cmd );
}

sub presetHome
{
my $self = shift;
Debug( "Home Preset" );
my $cmd = "decoder_control.cgi?command=25&user=admin&pwd=";
$self->sendCmd( $cmd );
}

1;


if someone want to help finishing this script for full control.... this are the commands:

snapshot.cgi
description To obtain the snapshot
Permission visitor
Syntax /snapshot.cgi[?user=&pwd=&next_url=]
Parameters user:username
pwd:password
next_url:the name of snapshot
Note 1 If not use the parameter “next_urlâ€
wankelrx8
Posts: 1
Joined: Mon May 18, 2009 7:33 pm

Foscam FI8908W Source Path

Post by wankelrx8 »

I also have a Foscam FI8908W and would really appreciate any help getting it to work in Zoneminder. Can you tell me what path you used in the Sources tab, to grab the video stream? This is one question that I can't seem to find an answer to, no matter how hard I search.
scribble
Posts: 5
Joined: Fri Oct 16, 2009 11:01 am

Post by scribble »

Hi,

I would also like to know if anyone has successfully grabbed the video stream from a foscam into zoneminder.


Thanks
scribble
Posts: 5
Joined: Fri Oct 16, 2009 11:01 am

Post by scribble »

Something to add is i know zoneminder is successfully logging into the camera as viewing the camera's log lists the ZM IP address as successfully logging in as ADMIN every 20 seconds or so.

It must be a bit complicated finding the stream? i've tried several versions of /videostream.cgi and /videostream.cgi[?usr=&pwd=&resolution=] to no avail.
troyy0206
Posts: 45
Joined: Fri Oct 30, 2009 1:54 am

Post by troyy0206 »

scribble wrote:Something to add is i know zoneminder is successfully logging into the camera as viewing the camera's log lists the ZM IP address as successfully logging in as ADMIN every 20 seconds or so.

It must be a bit complicated finding the stream? i've tried several versions of /videostream.cgi and /videostream.cgi[?usr=&pwd=&resolution=] to no avail.
I have one of those "fake" Foscam cameras that people are talking about. It's the purple one with the model IPCAM02. I was having the same problem and I figured out for some reason my ZM install just isn't showing 640x480. Had the same issue with an Axis 210. I'm not sure why yet, i'm new to ZM so I gotta research it.

However, I set the image to 320x240 in the "Source" on the console and set it to the same on the web interface of the camera and it's working fine!

Now I just need to figure out why it's not working at 640x480.

the path I used was /video.cgi?user=admin&pwd={password}
skyking
Posts: 84
Joined: Sat Nov 03, 2007 4:07 am

Post by skyking »

When a camera that will do a higher resolution works at 320 x 240, but not higher it is often due to shared memory issues.
http://www.zoneminder.com/wiki/index.php/FAQ
dollarbrand
Posts: 1
Joined: Thu Apr 22, 2010 9:52 pm
Location: Indianapolis

Post by dollarbrand »

I just got a new foscam from www.foscam.us and wanted to set it up using Zoneminder.

This is the grab URL for the image with a clean Foscam camera (i.e., username="admin" password="" [password is blank]:

http://69.201.171.212/videostream.cgi?user=admin&pwd=
"It is not because things are difficult that we do not dare; it is because we do not dare that they are difficult." - Seneca
user888
Posts: 13
Joined: Wed Apr 28, 2010 6:48 am

Post by user888 »

jawesker
Posts: 6
Joined: Fri May 28, 2010 3:44 am

Please Help me I can make PT work over Foscam

Post by jawesker »

Hi everyone..

I can'nt make work "pan and tilt" over my foscam

I did every think..
I check the Foscam.pl source again again again.... but nothing happends..
I compile the source code from ubuntu, centos with out results..
I made it by .deb package nothing happends..
I made it from live cd but nothing..
In the logs says:
log: /var/log/messages
+-----------------------------------------------------------------------------------

Jun 2 06:19:04 jawesker-laptop zmcontrol[2180]: INF [Starting control server 1/FoscamFI8908W]
Jun 2 06:19:04 jawesker-laptop zmcontrol[2181]: INF [Control server 1/FoscamFI8908W starting at 10/06/02 06:19:04]
Jun 2 06:19:12 jawesker-laptop kernel: [ 2081.682296] hrtimer: interrupt took 3306052 ns

+---------------------------------------------------------------------

log: /var/log/syslog

+----------------------------------------------------------------------------------
Jun 2 06:21:52 jawesker-laptop zmcontrol[2284]: INF [Control server 1/FoscamFI8908W starting at 10/06/02 06:21:52]
Jun 2 06:22:02 jawesker-laptop zmcontrol[2283]: FAT [Can't connect: No such file or directory]
+---------------------------------------------------------------------------

In the others logs such as zmwatch.log zmdpk.log zmdc.log zmaudit.log zmfilter.log I don't get any error or logs (I found those files in /temp is rare it has to be at /var/log/zm/)

I tried averything all ready, in the original Foscam software it works with out any trouble
Please Help me

Aguante Zoneminder
_________________
I want make my tesis with zoneminder and foscam
I want make my tesis with zoneminder and foscam
daveharris
Posts: 25
Joined: Mon Oct 26, 2009 2:47 pm

Post by daveharris »

Post Reply