You are on page 1of 14

Merit LILIN Ent. Co., Ltd.

HTTP IVS API/SDK Document for iMEGAPRO

January 13, 2013

Table of Contents
Chapter 1-1. Overview...................................................................................................3
Chapter 1.1. Firmware versions ...................................................................................3
Chapter 1.2. Product-specific functionality ..................................................................3
Chapter 1.3. Product Support List ................................................................................3
Chapter 2.1. General notations ....................................................................................3
Chapter 2.1.1. General abbreviations ..........................................................................3
Chapter 2.2. Convention of this document.....................................................................3
Chapter 2.3 HTTP status returned codes...................................................................3
Chapter 3.1. Image and video request URLs..............................................................5
Chapter 3.1.1. JPEG image (snapshot).......................................................................5
Chapter 3.1.2. MJPEG video (server-push) ................................................................6
Chapter 3.2. Motion detection configuration ...............................................................7
Chapter 3.2.1. Get alarm, IVS, and motion event status ...........................................8
Chapter 3.2.2. Enable IVS or motion detection algorithm........................................11
Chapter 3.2.3. Set motion detection type ..................................................................11

MERIT LILIN CO.,

Chapter 1.

INTRODUCTION

Chapter 1-1.

Overview

This document, HTTPAPI, specifies the HTTP-based application-programming interface (API) for
intelligent video surveillance (IVS) of Merit LILIN iMegaPro products.

Application developers can use

this document to develop applications for IVS.

Chapter 1.1.

Firmware versions

The support for this HTTPAPI document is highly dependent on the product release. Please make sure
that the functions, you want, are provided by the release of your product.

Chapter 1.2.

Product-specific functionality

Some of the functions described in this specification may not be implemented in every IP-based product,
and the set of the Common Gateway Interface (CGI) parameters and actual parameter values may differ
among different products.

At the end of each API function has product information for developers.

Chapter 1.3. Product Support List


LILIN iMEGAPRO IVS series

Chapter 2. HOW TO USE THIS MANUAL


This section contains information about general usages of this document.
Chapter 2.1.
Chapter 2.1.1.

General notations
General abbreviations

CGI : Common Gateway Interface a standardized way to communicate between a client (e.g., a
web browser) and a server (e.g., a web server).
N/A : Not applicable a feature/parameter/value is not used in a specific task.
Chapter 2.2. Convention of this document
In URL syntax and in descriptions of CGI parameters, text in italic within angle brackets denotes that is to
be replaced with either a value or a string. When replacing the text string, the angle brackets shall also
be replaced.
Chapter 2.3

HTTP status returned codes

The built-in Web server uses the standard HTTP status codes.

The syntax of returned HTTP status is

as following format:
HTTP/1.0 <HTTP code> <HTTP text> \r\n
HTTP code and text meanings are described as the followings:
HTTP Code
200

HTTP Text
OK

MERIT LILIN CO.,

Description
The request has succeeded.

204

No Content

400

Bad Request

401

Unauthorized

403
404

Forbidden
Not Found

MERIT LILIN CO.,

Server has received the request but there is no information


returned, and the client should stay in the same document
view. This is mainly to allow inputting scripts without changing
the document at the same time.
The request had bad syntax or was inherently impossible to be
satisfied.
The parameter to this message gives a specification of
authorization schemes that are acceptable. The client should
retry the request with a suitable Authorization header.
The request is for an action that is forbidden.
The server has not found anything matching the given URL.

Chapter 3.

HTTP API

Chapter 3.1.

Image and video request URLs

There are two different ways to request images from Merit LILINs IP Fast Dome, LAN camera, and
video serversnapshot (JPEG) and server-push (MJPEG).

Chapter 3.1.1.

JPEG image (snapshot)

When a jpeg image is requested, the server either returns the specified JPEG image file or an image
with an error image (No Video | Not Permission | Not available).
Syntax:
http://< serverIP >/snap<image size>
Parameter
<image size>

Values
cif
480p
720p
1080p

Description
352 by 240
720 by 480
1280 by 768
2MP cameras (if JPEG 1080P profile gets opened)

Example: Request JPEG image from video input with 480P size.
HTTP/1.0 200 OK\r\n
Content-Type: image/jpeg\r\n
Content-Length: 8567\r\n
\r\n
<JPEG image data which start with 0xffd8 and end with 0xffd9>\r\n
Example: Request JPEG image by cameras default resolution.
http://192.168.0.200/snap480p
Return: Requested JPEG image
Note: This 192.168.0.200/snap CGI is across all LILIN IP camera platforms.
HTTP/1.0 200 OK\r\n
Content-Type: image/jpeg\r\n
[ Content-Length: <image size>\r\n ]
\r\n
<JPEG image data>
\r\n
Example: Request JPEG image by cameras 720P resolution.
http://192.168.0.200/snap720p
Return: Requested JPEG image

MERIT LILIN CO.,

Chapter 3.1.2.

MJPEG video (server-push)

When an MJPG video is requested, the server either returns continuous flow of jpeg images or an
image with an error image (No Video | Not Permission | Not available) returned. The content type is
multipart/x-mixed-replace and each image ends with a boundary string <boundary>. The returned
image and HTTP data are equal to the request for a single JPEG image.
Syntax:
http://<serverIP>/getimage
Example: Request JPEG image stream from the camera.
http://192.168.0.200/getimage
Return: Requested Multipart JPEG image
HTTP/1.0 200 OK\r\n
Content-Type: multipart/x-mixed-replace;boundary=--<boundary>\r\n
\r\n
--<boundary>\n
<image>
--<boundary>\n
<image>

where the <boundary> field in Merit LILIN digital device is


<myboundary>\n
and the returned <image> field is
Content-Type: image/jpeg\n
Content-Length: <jpeg image size> Stamp:<YYYYMMDD 00HHmmss TK SSSSSSSS>\n\n
<jpeg image data>
where
Stamp: Time stamp, of which format is with Date, Time, Tick, and Sequence-number

Date:

Time:

Tick:
Seq:

Field
Year, A.D.
Month (1~12)
Day (1~31)
Hour (0~23)
Minute (0~59)
Second (0~59)
Ticks(0~99)
32
Seq (0~2 -1)

MERIT LILIN CO.,

Bits
31-16
15-8
7-0
31-16
15-8
7-0
7-0
31-0

Example
07d2=2002 AD
04=Apr
01=First
0011=17 hr
36=54 min
0e=14 sec
09=90 ms from last sec.
84b=2123 images since server start

Chapter 3.2.

Motion detection configuration

The CGI set motion grid on the IP camera.


Syntax:
http://<serverIP>/motion[?<parameter>=<value>[&<parameter>=<value>]]
Parameters:
Parameter
cmd=<string>

Values
get,set

mdEv=<int>

0,1

mdSen=<int>

1~30

mdFreq=<int>
mdX0=<int>
mdX1=<int>
mdY0=<int>
mdY1=<int>
MdBlock=<int>[,<int>,..]

1~100
0~10
0~10
0~6
0~6
0,..,76

Description
It is necessary to choose what kind of command.
get=request the motion detection settings.
set=set the motion detection settings.
Motion detection feature enable or disable
0=disable, 1=enable.
Motion detection sensitivity, larger value means less
sensitive. Default value is 5.
Polling Frequency in 1/10 second. Default value is 5.
Left most coordinates of grid number
Right most coordinates of grid number
Top coordinates of grid Number
Bottom coordinates of grid number
Series of blocks for detect motion if using GRID method.

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

Parameter
cmd=<string>

Values
get,set

Description
It is necessary to choose what kind of command.
get=request the motion detection settings.
set=set the motion detection settings.

mdEv=<int>

0,1

Motion detection feature enable or disable


0=disable, 1=enable.

mdSen=<int>

1~99

Motion detection sensitivity, larger value means less


sensitive. Default value is 30.

MERIT LILIN CO.,

mdX0=<int>

0~14
0~19

mdX1=<int>

0~14
0~19

mdY0=<int>

0~9
0~11

mdY1=<int>

0~9
0~11

MdBlock=<int>[,<int>,..] 0v,149v
0v,239v

Left most coordinates of grid number


(H.264 D1 IP camera)
Left most coordinates of grid number
(H.264 HD IP camera)
Right most coordinates of grid number
(H.264 D1 IP camera)
Right most coordinates of grid number
(H.264 HD IP camera)
Top coordinates of grid Number
(H.264 D1 IP camera)
Top coordinates of grid Number
(H.264 HD IP camera)
Bottom coordinates of grid number
(H.264 D1 IP camera)
Bottom coordinates of grid number
(H.264 HD IP camera)
Series of blocks for detect motion if using GRID
method. (H.264 D1 IP camera)
Series of blocks for detect motion if using GRID
method. (H.264 HD IP camera)

Example: Request the motion detection configuration.


http://192.168.0.200/motion?cmd=get&camid=1
Return: Requested motion detection configuration
HTTP/1.0 200 OK\r\n
Date: Thu, 01 Jan 1970 00:00:00 GMT\r\n
Connection: close\r\n
Content-Type: text/html\r\n
Content-Length: 48\r\n
\r\n
mdEv=1\n
mdSen=5\n
mdFreq=5\n
mdBlock=1:12:13\n
Chapter 3.2.1. Get alarm, IVS, and motion event status
Get alarm, IVS, and motion status. The CGI continuously sends event status including motion
detection, face detection, audio detection, IVS detection, and tampering detection status every second.
http://<serverIP>/getalarmmotion
Example
http://192.168.0.200/getalarmmotion
Return: alarm and motion detect status

MERIT LILIN CO.,

--myboundary
Content-Type: text/plain
CamTime:2013-05-06 12:56:35
MotionDetect=0
AlarmInputDetect=0
AudioDetect=0
TemperDetect=0
Electric=1,
hit1=0,x11=100,y11=100,x12=200,y12=200,
hit2=0,x21=239,y21=303,x22=580,y22=247,
hit3=0,x31=413,y31=363,x32=515,y32=442,
hit4=0,x41=639,y41=333,x42=598,y42=414,
Color detection=0
FaceDetectNumber=0
--myboundary
Content-Type: text/plain
CamTime:2013-05-06 12:56:35
MotionDetect=0
AlarmInputDetect=0
AudioDetect=0
TemperDetect=0
Electric=1,
hit1=0,x11=100,y11=100,x12=200,y12=200,
hit2=0,x21=239,y21=303,x22=580,y22=247,
hit3=0,x31=413,y31=363,x32=515,y32=442,
hit4=0,x41=639,y41=333,x42=598,y42=414,
Color detection=0
FaceDetectNumber=0

Parameters:
Get Parameter
MotionDetect=<result>

Values
0~1

AlarmInputDetect=<result> 0~1
AudioDetect=<result>

0~1

TemperDetect=<result>

0~1

FaceDetectNumber=<resu 0~1
lt>
Electric=<result>
0~4

hit<int>=<result>

MERIT LILIN CO.,

Description
0 No motion
1 Motion
0 No alarm input is detected (digital input).
1 AlarmInput
0 No audio is detected.
1 Audio
0 No tempering is detected.
1 Temper
0 No Face
1 Face
Virtual fences types :
0 None, not enabled
1 Line, virtual fences
2 Rectangle, rectangle fences
3 Connection, connected fences
4 Polygon, polygonal fences
<int>
1~8, up to 8 lines
<result>
0 No alarm is triggered.
1 Alarm is triggered.

x11=<int>

0~719

y11=<int>

0~439

x12=<int>

0~719

y12=<int>

0~439

x21=<int>

0~719

y21=<int>

0~439

x22=<int>

0~719

y22=<int>

0~439

x31=<int>

0~719

y31=<int>

0~439

x32=<int>

0~719

y32=<int>

0~439

x41=<int>

0~719

y41=<int>

0~439

x42=<int>

0~719

y42=<int>

0~439

x51=<int>

0~719

y51=<int>

0~439

x52=<int>

0~719

y52=<int>

0~439

x61=<int>

0~719

y61=<int>

0~439

x62=<int>

0~719

y62=<int>

0~439

x71=<int>

0~719

y71=<int>

0~439

x72=<int>

0~719

y72=<int>

0~439

x81=<int>

0~719

MERIT LILIN CO.,

Virtual fences:
The 1 area of start x1 point
Virtual fences:
Area #1 of starting y1 point
Virtual fences:
Area #1 of end x1 point
Virtual fences:
Area #1 of end y1 point
Virtual fences:
Area #2 of starting x1 point
Virtual fences:
Area #2 of starting y1 point
Virtual fences:
Area #2 of end x1 point
Virtual fences:
Area #2 of end y1 point
Virtual fences:
Area #3 of starting x1 point
Virtual fences:
Area #3 of starting y1 point
Virtual fences:
Area #3 of end x1 point
Virtual fences:
Area #3 of end y1 point
Virtual fences:
Area #4 of starting x1 point
Virtual fences:
Area #4 of starting y1 point
Virtual fences:
Area #4 of end x1 point
Virtual fences:
Area #4 of end y1 point
Virtual fences:
Area #5 of starting x1 point
Virtual fences:
Area #5 of starting y1 point
Virtual fences:
Area #5 of end x1 point
Virtual fences:
Area #5 of end y1 point
Virtual fences:
Area #6 of starting x1 point
Virtual fences:
Area #6 of starting y1 point
Virtual fences:
Area #6 of end x1 point
Virtual fences:
Area #6 of end y1 point
Virtual fences:
Area #7of starting x1 point
Virtual fences:
Area #7of starting y1 point
Virtual fences:
Area #7 of end x1 point
Virtual fences:
Area #7 of end y1 point
Virtual fences:

10

y81=<int>

0~439

x82=<int>

0~719

y82=<int>

0~439

Color detection=<int>

0~1

hit=<int>

0~1

x1=<int>
y1=<int>

0~439

x2=<int>
y2=<int>

0~439

Area #8 of starting x1 point


Virtual fences:
Area #8 of starting y1 point
Virtual fences:
Area #8 of end x1 point
Virtual fences:
Area #8 of end y1 point
Color detection:
0 Disable
1 Enable
0 No Alarm
1 Alarm
Color detection :
The detect color x1 point
Color detection :
The detect color y1 point
Color detection :
The detect color x2 point
Color detection :
The detect color y2 point

Chapter 3.2.2. Enable IVS or motion detection algorithm


The CGI can enable or disable motion detection algorithm. When motion detection algorithm is off, IVS
and motion detection are off.
Example: Enable IVS algorithm.
http://192.168.0.200/mdmotion?MD_FLAG=1
Syntax:
http://<serverIP>/mdmotion[?<parameter>=<value>]
Parameters:
Parameter
MD_FLAG=<int>

Values
0~1

Description
0 - Disable
1 Enable

Chapter 3.2.3. Set motion detection type


The CGI can enable or disable motion detection algorithm.
and motion detection are off.

When motion detection algorithm is off, IVS

Example: Clear IVS algorithm.


http://192.168.0.200/fences_mode?dectmode=2&set=0
Example: Set IVS virtual fences.
http://192.168.0.200/fences_mode?dectmode=2&set=2&act=1&x11=100&y11=100&x12=200&y1
2=200&x21=319&y21=155&x22=525&y22=281
Example: Set IVS rectangle fences.

MERIT LILIN CO.,

11

http://192.168.0.200/fences_mode?dectmode=2&set=2&act=2&x11=100&y11=100&x12=200&y1
2=200&x21=244&y21=229&x22=334&y22=311
Example: Set IVS traffic light/color detection area.
http://192.168.0.200/fences_mode?traffic=1&x1=530&y1=213&x2=630&y2=263
Syntax:
http://<serverIP>/fences_mode[?<parameter>=<value>[&<parameter>=<value>]]
Parameters:
Parameter
dectmode=<int>

Values
0~3

set=<int>

0~8

act=<int>

0~4

x11=<int>

0~719

y11=<int>

0~439

x12=<int>

0~719

y12=<int>

0~439

x21=<int>

0~719

y21=<int>

0~439

x22=<int>

0~719

y22=<int>

0~439

x31=<int>

0~719

y31=<int>

0~439

x32=<int>

0~719

y32=<int>

0~439

x41=<int>

0~719

y41=<int>

0~439

MERIT LILIN CO.,

Description
0 YUV motion
1 Edge motion
2 Virtual fences
3 Color detection
0 Clear all
1 Total of 1 area
2 Total of 2 areas
3 Total of 3 areas
4 Total of 4 areas
5 Total of 5 areas
6 Total of 6 areas
7 Total of 7 areas
8 Total of 8 areas
0 None
1 Line
2 Rectangle
3 Connection
4 Polygon
Virtual fences :
Area #1 of starting x1 point
Virtual fences
Area #1 of starting y1 point
Virtual fences:
Area #1 of end x1 point
Virtual fences:
Area #1 of ending y1 point
Virtual fences:
Area #2 of starting x1 point
Virtual fences:
Area #2 of starting y1 point
Virtual fences:
Area #2 of ending x1 point
Virtual fences:
Area #2 of ending y1 point
Virtual fences:
Area #3 of starting x1 point
Virtual fences:
Area #3 of starting y1 point
Virtual fences:
Area #3 of ending x1 point
Virtual fences:
Area #3 of ending y1 point
Virtual fences:
Area #4 of starting x1 point
Virtual fences:

12

x42=<int>

0~719

y42=<int>

0~439

x51=<int>

0~719

y51=<int>

0~439

x52=<int>

0~719

y52=<int>

0~439

x61=<int>

0~719

y61=<int>

0~439

x62=<int>

0~719

y62=<int>

0~439

x71=<int>

0~719

y71=<int>

0~439

x72=<int>

0~719

y72=<int>

0~439

x81=<int>

0~719

y81=<int>

0~439

x82=<int>

0~719

y82=<int>

0~439

sens=<int>

0~2

traffic=<int>

0~1

x1=<int>
y1=<int>
x2=<int>
y2=<int>
color=<int>

0~719
0~439
0~719
0~439
0~3

rate=<int>

2~50

MERIT LILIN CO.,

Area #4 of starting y1 point


Virtual fences:
The 4 area of ending x1 point
Virtual fences:
Area #4 of ending y1 point
Virtual fences:
Area #5 of starting x1 point
Virtual fences:
Area #5 of starting y1 point
Virtual fences:
Area #5 of ending x1 point
Virtual fences:
Area #5 of ending y1 point
Virtual fences:
Area #6 of starting x1 point
Virtual fences:
Area #6 of starting y1 point
Virtual fences:
Area #6 of ending x1 point
Virtual fences:
Area #6 of ending y1 point
Virtual fences:
Area #7 of starting x1 point
Virtual fences:
Area #7 of starting y1 point
Virtual fences:
Area #7 of ending x1 point
Virtual fences:
Area #7 of ending y1 point
Virtual fences:
Area #8 of starting x1 point
Virtual fences:
Area #8 of starting y1 point
Virtual fences:
Area #8 of ending x1 point
Virtual fences:
Area #8 of ending y1 point
Sensitivity:
0 Low
1 Normal
2 High
Color detection:
0 Disable
1 Enable
Color detection:
Color detection area X1 and Y1.
Color detection:
Color detection area X2 and Y2.
Color detection:
0 Red
1 Yellow
2 Green
3 Blue
Color detection:
Color sensitivity

13

Chapter 3.3.

Object Counting

Chapter 3.3.1. Get Object Counting


This CGI allows to get the incoming and outgoing counters from the IVS engine.
Syntax:
http://<serverIP>/getcounting?mode=<iMode>
Parameters:
Get Parameter
iMode

Values
0~1

Description
0 Counting in counter
1 Counting out counter

Example:
http://192.168.0.200/getcounting?mode=1
Chapter 3.3.2. Reset Object Counter
This CGI allows to reset the counter for incoming and outgoing counters from the IVS engine.
Example:
http://192.168.0.200/restcounting

MERIT LILIN CO.,

14

You might also like