edent / Sercomm-API

A comprehensive guide to the controlling Sercomm IP Cameras via their inbuit API
177 stars 37 forks source link

Sercomm Camera API

This is designed to be a fairly comprehensive set of API documentation for SerComm IP Cameras.

These API calls have been tested on the following cameras:

Sercomm supplies cameras to a number of partners - each with a custom firmware. It is possible your camera does not have access to all these API calls.

Buy me a coffee

Accessing The Cameras

Your camera may have been supplied with a username and password. If you do not know what these credentials are, you can reset the camera to its defaults.

Process

API Calls

The API is RESTful - although it isn't very communicative.

All API calls are GET except where noted.

Responses are in plain text except where noted.

Enable the UI

Some cameras don't show a menu by default.

Increase Resolution

Many cameras have a "hidden" 720p resolution. This can be activated for video and still images.

Get Still Image

Pan / Tilt Movement

For cameras which have moveable lenses, it is possible to control the direction the camera is facing.

Where $Direction can be Up, Down, Left, Right.

And $Distance can be any positive integer.

The maximum U and D value is 64.

The maximum L and R value is ??.

For example:

Diagonal moves can also be made:

There are preset locations which can be accessed

There is no response sent in reply to these commands - although you should be able to see the camera move.

Arming

Arming a camera allows you to create triggers for specific events. For example, send an email on motion detection.

[EVENT]
event_trigger=0
event_schedule=1
event_define1=
event_define2=
event_define3=
event_define4=
event_define5=
event_define6=
event_define7=
event_define8=
event_define9=
event_define10=
event_interval=0
event_mt=email:0;ftpu:1;httpn:0;httppost:0;smbc:0
event_attach=mp4,1,5,10
event_audio=email:0;ftpu:1;httpn:0;httppost:0;smbc:0
event_httpc=email:0;ftpu:0;httpn:0;httppost:0;smbc:0

Viewing Video

There are several ways you can get video and audio out of the cameras.

MJPEG

SDP (MPEG-4/H.264 video/MJPEG)

RTP/RTSP

The following can be accessed via the rtsp:// protocol.

Flash

Motion Detection

This is really tricky!

Some cameras can support up to 4 areas of motion detection. For example, you might have a camera pointed at your door, but are only interested in seeing when the handle or the letter box moves.

No matter what resolution your camera is, the motion detection is defined on a 640*480 grid with the top left corner being position 0,0 and the bottom right being 639,479.

         640
+-------------------+  
|(0,0)              |
|                   |
|                   |480
|                   |
|                   |
+-------------------+
                    (639,479)
[MOTION]
md_mode=1
md_switch1=1
md_switch2=0
md_switch3=0
md_switch4=0
md_name1=Window 1
md_name2=Window 2
md_name3=Window 3
md_name4=Window 4
md_window1=0,0,639,479
md_window2=0,0,160,120
md_window3=0,0,160,120
md_window4=0,0,160,120
md_threshold1=80
md_threshold2=127
md_threshold3=127
md_threshold4=127
md_sensitivity1=6
md_sensitivity2=6
md_sensitivity3=6
md_sensitivity4=6
md_update_freq1=90
md_update_freq2=90
md_update_freq3=90
md_update_freq4=90
md_point=0,0

As you can see, there are 4 windows, each with their own switch, name, co-ordinates, threshold, sensitivity, and update frequency.

It may help to think of them being grouped like this:

md_switch1=1
md_name1=Window 1
md_window1=0,0,639,479
md_threshold1=80
md_sensitivity1=6
md_update_freq1=90

md_switch2=0
md_name2=Window 2
md_window2=0,0,160,120
md_threshold2=127
md_sensitivity2=6
md_update_freq2=90

Notification

You can set the cameras to perform an action when motion is detected.

HTTP Notification

[HTTP_NOTIFY]
http_notify=1
http_url=
http_proxy=
http_proxy_no=80
http_method=1
http_user=
http_password=
proxy_user=
proxy_password=
event_data_flag=0

System Settings

Device Information

hostname=Camera
description=
defname=SC92FFF7
mpeg4_resolution=640
mjpeg_resolution=1280
h264_resolution=1280
h264_resolution2=320
h264_resolution3=320
mic_in=on
speaker_out=off
ptctrl=on
wlled=off
irled=off
serial=off
resolutions=1280x720,640*480,320*240,160*120
mac=00:0e:8f:92:ff:f7
privacy_button=off
pir_sensor=off
wps_pin_code=1234567
ioctrl=off
company_name=Xanboo
model_number=RC8230
wireless=on
sw_pppoe=yes
fw_ver=V1.0.15R00
ip_addr=192.168.0.42
netmask=255.255.255.0
gateway=192.168.0.1
timezone=26
current_time=10/13/2015 08:56:42
http_port=80
rtsp_port=554
https_port=443
Firmware Version: V1.0.15
Serial Number:12345
Firmware Release Date: Mar 01,2013

User Access

mic_in=on
speaker_out=on
ptctrl=on
ioctrl=off

Get IR Filter

Date And Time

timezone=26
year=2015
month=10
day=13
hour=08
minute=19
second=57

Configuration Settings

Log Files

2015-10-13 07:12:33 DHCP: Lease renewal successfully.
2015-10-13 07:11:28 WATCHDOG: Haven't received HTTP requests for 1200 seconds, reconnecting WIFI.
2015-10-13 06:55:12 NTP: Synchronization OK.
2015-10-13 06:53:47 DHCP: Lease renewal successfully.
2015-10-13 06:51:11 Network: Wireless activated.

Networking

WiFi Environment

<?xml version="1.0" encoding="utf-8"?>
<SiteList>
   <Site>
        <SSID>MyWiFiNetwork</SSID>
        <BSSID>34:44:11:A9:C2:D4</BSSID>
        <Mode>Infrastructure</Mode>
        <Security>WPA2-PSK</Security>
        <AUTH>SharedKey</AUTH>
        <Encryption>AES</Encryption>
        <Channel>1</Channel>
        <Signal>100</Signal>
        <WPS>Yes</WPS>
    </Site>
    ...

WiFi Status

signal_strength=100
signal_strength-A=0
signal_strength-B=0
essid=MyWiFiNetwork
domain=Europe
channel=11
bssid=C1:15:A2:01:1D:11
wps_pin_code=123456

Samba

The cameras can upload images and videos to local network shares.

<?xml version="1.0" encoding="utf-8"?>
<List>
    <WorkGroup>
        <Name>WORKGROUP</Name>
        <List>
            <Server>
                <Name>MYSERVER</Name>
                <Comment>Samba 4.1.6-Ubuntu</Comment>
            </Server>
        </List>
    </WorkGroup>
</List>

Other Configuration Groups

Sercomm's configuration API uses the concept of "groups".

[Manufacture]
[SYSTEM]
[LOG]
[NETWORK]
[WIRELESS]
[DDNS]
[HTTP]
[RTSP_RTP]
[UPNP]
[EMAIL]
[FTP]
[SMBC]
[VIDEO]
[H264]
[MPEG4]
[JPEG]
[STREAMS]
[AUDIO]
[USER]
[IP_FILTER]
[MOTION]
[IO]
[EVENT]
[QOS]
[MCWS]
[HTTP_NOTIFY]
[HTTP_EVENT]
[PPPOE]
[BONJOUR]
[SDCARD]
[PTZ]

Note: The groups available will depend on which camera you have. For example, not all cameras have an SD Card slot.

Manufacturer Information

[Manufacture]
def_name=
default_ip=192.168.0.99/255.255.255.0
max_user=20
summer_chg=1
conf_status=1

System Configuration

[SYSTEM]
cfg_ver=RC8230_XANBOO_0001
host_name=MyCamera
comment=
time_format=24
date_format=1
time_zone=26
daylight_saving=1
ntp_mode=1
ntp_server=clock.via.net
ntp_date=0
ntp_hour=6
ntp_min=1
led_mode=1
reboot_time=2015-10-13 06:46:54
boot_up_time=2015-10-13 11:55:22
reboot_reason=Reboot by Internal (Reason: hydra is gone)
wd_timer_wifi=20
wd_timer_idled=300
wd_timer_acted=180
wd_reboot_num=347
wd_reboot_time=1444713006;1444585286

Logging

[LOG]
log_mode=1
log_level=3
syslog_mode=0
syslog_server=
syslog_port=514
im_mode=0
im_server=
im_account=
im_password=
im_sendto=
im_message=
ftplog_mode=1
smtplog_mode=1
systemlog_mode=1
imlog_mode=1

Network

[NETWORK]
ip_addr=192.168.0.42
netmask=255.255.255.0
gateway=192.168.0.1
dhcp=1
dns_type=1
dns_server1=192.168.0.1
dns_server2=8.8.8.8
wins_type=0
wins_ip=

Wireless

[WIRELESS]
wlan_type=1
wlan_essid=MyNetwork
wlan_channel=0
wlan_domain=5
wlan_security=2
wep_authtype=2
wep_mode=1
wep_index=1
wep_ascii=
wep_kep1=
wep_kep2=
wep_kep3=
wep_kep4=
wpa_ascii=
wmm=0

Dynamic DNS

[DDNS]
ddns_mode=0
ddns_service=
ddns_account=
ddns_password=
ddns_host_name=
ddns_hour=12
ddns_minute=
ddns_update_unit=3
ddns_update_period=10

TODO! Many of the DDNS providers no longer work.

HTTP

[HTTP]
http_mode=1
http_port2=1
http_port2_num=8080
https_mode=1
ssport_enable=0
ssport_number=1025

Real Time Streaming Protocol

[RTSP_RTP]
rtsp_port=554
rtp_port=5000
rtp_size=1400
mcast_enable=0
mcast_video_enable=0
mcast_video_addr=224.2.0.1
mcast_video_port=2240
mcast_h264_enable=0
mcast_h264_addr=224.2.0.1
mcast_h264_port=2242
mcast_audio_enable=0
mcast_audio_addr=224.2.0.1
mcast_audio_port=2244
mcast_hops=16

Universal Plug and Play

[UPNP]
upnp_mode=0
upnp_traversal=
upnp_camera=

EMAIL

[EMAIL]
smtp_enable=1
smtp_server=
pop_server=
smtp_port=465
smtp_auth=1
smtp_account=
smtp_password=
smtp2_enable=0
smtp2_server=
pop2_server=
smtp2_port=25
smtp2_auth=0
smtp2_account=
smtp2_password=
from_addr=
from_addr2=
to_addr1=
to_addr2=
to_addr3=
send_email=1
email_att=7
subject=
smtp_serv_flag=1
smtp2_serv_flag=1

Note: The response will never display your passwords.

TODO!

FTP

[FTP]
ftp1=1
ftp1_server=
ftp1_account=
ftp1_passwd=
ftp1_path=
ftp1_passive=1
ftp1_port=21
ftp2=0
ftp2_server=
ftp2_account=
ftp2_passwd=
ftp2_path=
ftp2_passive=0
ftp2_port=21

Note: The response will never display your passwords.

Samba

[SMBC]
smbc_enable=1
smbc_server=
smbc_path=
smbc_account=
smbc_passwd=
smbc_rec_enable=0
smbc_rec_file_ctrl=1
smbc_rec_filesize=0
smbc_rec_duration=15
smbc_rec_streaming=1
smbc_rec_mode=1
smbc_rec_server=
smbc_rec_path=
smbc_rec_account=
smbc_rec_passwd=
smbc_rec_filename_prefix=
smbc_rec_behavior=0,0,1
smbc_rec_schedule=
smbc_rec_bymd_fn_prefix=
smbc_rec_bymd_len=

TODO!

Video

[VIDEO]
video_schedule=0
video_define1=
video_define2=
video_define3=
video_define4=
video_define5=
video_define6=
video_define7=
video_define8=
video_define9=
video_define10=
time_stamp=1
text_overlay=0
text=
power_line=50
color=0
exposure=4
sharpness=4
flip=0
mirror=0
hue=4
saturation=4
contrast=4
default_channel=1
mask_window1=0
mask_window2=0
mask_window3=0
mask_window4=0
mask_color1=888888
mask_color2=888888
mask_color3=888888
mask_color4=888888
mask_position1=160,180,480,300
mask_position2=160,180,480,300
mask_position3=160,180,480,300
mask_position4=160,180,480,300
night_mode=0

TODO!

H264

[H264]
mode=1
resolution=4
quality_type=1
quality_level=5
bit_rate=768
frame_rate=25
gov_length=25
sp_uri=
mode2=1
resolution2=2
quality_type2=0
quality_level2=3
bit_rate2=256
frame_rate2=10
gov_length2=10
sp_uri2=
mode3=1
resolution3=2
quality_type3=0
quality_level3=3
bit_rate3=64
frame_rate3=10
gov_length3=10
sp_uri3=
bandwidth=0
profile=66
cropping=0
bandwidth2=0
profile2=66
cropping2=0
bandwidth3=0
profile3=66
cropping3=0

TODO!

MPEG4

[MPEG4]
mode=1
resolution=3
quality_type=1
quality_level=5
bit_rate=256
frame_rate=25
gov_length=10
sp_uri=
mode2=0
resolution2=1
quality_type2=1
quality_level2=3
bit_rate2=256
frame_rate2=15
gov_length2=10
sp_uri2=
mode3=0
resolution3=3
quality_type3=1
quality_level3=3
bit_rate3=1000
frame_rate3=15
gov_length3=10
sp_uri3=
bandwidth=0
cropping=0
bandwidth2=0
cropping2=0
bandwidth3=0
cropping3=0

TODO!

JPEG

[JPEG]
mode=1
resolution=4
quality_level=3
frame_rate=15
sp_uri=
mode2=0
resolution2=1
quality_level2=3
frame_rate2=15
sp_uri2=
mode3=0
resolution3=3
quality_level3=3
frame_rate3=30
sp_uri3=
bandwidth=0
cropping=0
bandwidth2=0
cropping2=0
bandwidth3=0
cropping3=0

TODO!

Video Streams

[STREAMS]
channel1=H264,1
channel2=JPEG,2
channel3=MPEG4,3

TODO!

Audio

[AUDIO]
audio_in=1
in_volume=1
in_audio_type=1
audio_out=0
out_volume=8
out_audio_type=0
audio_mode=1
operation_mode=1
in_pcm_sr=8000
audio_in2=1
in_pcm_sr2=5512
in_audio_type2=3
au_trigger_en=0
au_trigger_volume=50
au_trigger_method=0

TODO!

User Database

[USER]
login_check=1
admin_timeout=5
admin_name=admin
admin_password=
viewer_name=demo
viewer_password=
user1=viewer,
user2=
user3=
user4=
user5=
user6=
user7=
user8=
user9=
user10=
user11=
user12=
user13=
user14=
user15=
user16=
user17=
user18=
user19=
user20=
audio_in_ctrl=1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
audio_out_ctrl=1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
pt_ctrl=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
adm_ctrl=0
io_ctrl=0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

Note: The response will never display your passwords.

TODO!

IP Filters

[IP_FILTER]
ip_filter=0
ip_filter_rule=0
ip_filter1=
ip_filter2=
ip_filter3=
ip_filter4=
ip_filter5=
ip_filter6=
ip_filter7=
ip_filter8=
ip_filter9=
ip_filter10=
ip_filter11=
ip_filter12=
ip_filter13=
ip_filter14=
ip_filter15=
ip_filter16=
ip_filter17=
ip_filter18=
ip_filter19=
ip_filter20=

TODO!

IO Pins

Some cameras have IO pins on the back. You can use these to send signals to, or receive signals from the camera.

[IO]
in1_trigger=0
in2_trigger=0
in1_type=3
in2_type=0
out1_init=1
out2_init=1
out1_button=0,0,10
out2_button=0,0,10
out1_action=1
out2_action=1
out1_pulse_duration=10
out2_pulse_duration=10

TODO!

Quality of Service

[QOS]
qos_enable=0
qos_dscp=32
qos_av_switch=0

TODO!

MCWS???

[MCWS]
url_periodic=
url_event=
expire_hours=0

TODO!

HTTP Events

[HTTP_EVENT]
http_event_en=0
http_post_en=0
http_post_user=
http_post_pass=
http_post_url=

Note: The response will never display your passwords.

TODO!

Point-to-point protocol over Ethernet

[PPPOE]
pppoe_enable=0
pppoe_username=
pppoe_password=
pppoe_dod=0
pppoe_idle_time=300
pppoe_redial_time=30
pppoe_hostname=
pppoe_mtu_type=0
pppoe_mtu=1492

Note: The response will never display your passwords.

Bonjour

[BONJOUR]
bonjour_name=RC8230-92fff7
bonjour_mode=0

SD Card

Some cameras have a slot for a MicroSD Card, onto which images and videos can be saved.

[SDCARD]
sdcard_rec_enable=0
sdcard_rec_event_enable=0
sdcard_rec_audio_enable=0
sdcard_rec_file_ctrl=1
sdcard_rec_file_size=10
sdcard_rec_disk_ctrl=0
sdcard_rec_duration=60
sdcard_rec_stream_id=1
sdcard_rec_filename_prefix=
sdcard_rec_event_prefix=
sdcard_rec_schedule=
sdcard_rec_schedule1=
sdcard_rec_schedule2=
sdcard_rec_schedule3=
sdcard_rec_schedule4=
sdcard_rec_schedule5=
sdcard_rec_schedule6=
sdcard_rec_schedule7=
sdcard_rec_schedule8=
sdcard_rec_schedule9=
sdcard_rec_schedule10=

TODO!

Pan/Tilt/Zoon

[PTZ]
PtzMode=1
PtzMdMutex=2
Preset1Name=
Preset2Name=
Preset3Name=
Preset4Name=
Preset5Name=
Preset6Name=
Preset7Name=
Preset8Name=
Preset9Name=
Preset1Position=
Preset2Position=
Preset3Position=
Preset4Position=
Preset5Position=
Preset6Position=
Preset7Position=
Preset8Position=
Preset9Position=
Patrol1Position=
PredefineHome=0,0
PatrolInterval=
PatrolStyle=0

TODO!

Firmware

Firmware Download

Firmware Upload

It is possible to upgrade the firmware via the API. I would strongly recommend doing this via the GUI to ensure that the upgrade is accepted.

Never upload the firmware from one model of camera to a different model.

Reboot and Reset

These controls allow you to reboot/restart the camera. You can also reset it to its system defaults.

Note: There is no confirmation prompt! Once you issue these commands, they will execute immediately.

Software Licenses

The cameras make extensive use of Open Source Software. You can see the software versions and Open Source Licensing information.

Time Zones

The cameras use a somewhat baroque way of representing Timezones. Each zone has a number. Timezones with daylight savings are marked with an asterisk *.

Telnet

Some cameras will allow Telnet access.

List of available telnet commands:

- .
- :
- [
- [[
- alias
- bg
- break
- cd
- chdir
- continue
- echo
- eval
- exec
- exit
- export
- false
- fg
- hash
- help
- jobs
- kill
- let
- local
- printf
- pwd
- read
- readonly
- return
- set
- shift
- source
- test
- times
- trap
- true
- type
- ulimit
- umask
- unalias
- unset
- wait

TODO!

If you can help with these missing piece of functionality, I would be most grateful.

Sending Audio

With the speakers enabled, it should be possible to POST an audio file to the cameras, either in G.726, or G.711 (a-law or u-law). I've not been able to get this working. See further discussion.

Missing Functionality

Not all API calls are documented. Not all which are in the official documentation are valid. Fill in the gaps :-)