Skip to content

Instantly share code, notes, and snippets.

@prasincs
Last active June 10, 2023 08:54
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prasincs/4465801 to your computer and use it in GitHub Desktop.
Save prasincs/4465801 to your computer and use it in GitHub Desktop.
FOSCAM Documentation

Adapted from http://www.digitalham.co.uk/web/development/embedding-cctv/ipcam-cgi-sdk/

AFAIK, everything is based on the CGI scripts below, there might be ways to get the streams but I believe it's doable without hacking the firmware and stuff. All functions should be accessible via GET and POST methods.

ACL groups:visitor、operator and Administrator.

Upgrade_firmware.cgi and upgrade_htmls.cgi only support post method,others cgi only support get method.

next_url: an option param. If you don’t want only return a simple “OK” when set succeed, you can add a param in the end next_url. The param is the next file it jump to

when set succeed. The param must be a Relative path.

Get: (Example)

<form action=”/set_mail.cgi”>

<input name=”svr”>

<input name=”user”>

<input name=”pwd”>

<input name=”sender”>

<input name=”receiver1”>

<input name=”receiver2”>

<input name=”receiver3”>

<input name=”receiver4”>

<input type=hidden name=”next_url” value=”index.htm”>

<input type=submit value=”ok”>

</form>

Post : (Example)

<form action=”upgrade_firmware.cgi?next_url=index.htm”    method=”post”

enctype=”multipart/form-data”>

<input type=”file” name=”file” size=”20”>

</form>

Probably the most useful commands are these for capturing video and stills and some camera controls.

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

Notes

  • If the parameter “next_url” is not used, the snapshot name is:deviceid(Alias)_ Current time.jpg

  • Use “next_url” (for example:next_url=1 the name of photo:1.jpg)

  • Supports two Authentication Methods: http Basic64 encode and use of username/password in the param directly.

videostream.cgi

Description Use server push mode to send videostream to Client APP Permission visitor

Syntax: /videostream.cgi[?user=&pwd=]

Parameters user:username pwd:password

Note supports two Authentication Methods: http Basic64 encode and use of username/password in the param directly.

decoder_control.cgi

Description Decoder control (DigitalHam addition – LED on) Permission operator

Syntax : /decoder_control.cgi?command=[&next_url=]

Parameters 0 up 1 Stop up 2 down 3 Stop down 4 left 5 Stop left 6 right 7 Stop right … Reserved 25 center 26 Vertical patrol 27 Stop vertical patrol 28 Horizontal patrol 29 Stop horizontal patrol

These commands were not in the SDK but were explained to me by Dave Maddlone who got them from the source code of his camera control pages. They are not present in my control pages but the Android app I use does support goto preset.

30, 32, 34 (and probably more up to 44 as my Andoid app shows 8 presets) Set preset 1, 2, 3 etc. to current camera position.
31, 33, 35 (probably to 45) Move camera to preset 1, 2, 3 etc.

I have tested these commands for presets 1 2 and 3

… Reserved 94 IO output high (DigitalHam addition – LED on) 95 IO output low (DigitalHam addition – LED off)

camera_control.cgi

Description To control camera sensor Parameters Permission operator

Syntax: /camera_control.cgi?param=&value=[&next_url=]

Parameters

0 Resolution
8: QVGA
32:VGA

1 Brightness 0~255

2 Contrast 0~6

3 mode
  0: 50Hz
  1: 60Hz
  2: Outdoor

5 Flip&mirror
    0: default
    1: flip
    2: mirror
    3: flip + mirror

These administrator SET commands

    set_alarm.cgi
    set_alias.cgi
    set_datetime.cgi
    
    set_ddns.cgi
    set_devices.cgi
    set_ftp.cgi
    set_mail.cgi
    set_network.cgi
    set_pppoe.cgi
    set_upnp.cgi
    set_users.cgi
    set_wifi.cgi

are documented here

These miscellaneous commands..

@fabianayandrea
Copy link

and command zoom? exists?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment