Dahua HTTP Api For DVR V1.29
Dahua HTTP Api For DVR V1.29
Version 1.29
1
Document History
No Release Notes Date Version Author
1 draft 2007-1-18 1.10 Haifeng Wang
2
1. Preface
This document details the API of Dahua video products. Programmers can access and configure Dahua video products follows the API. This
document with version 1.10 is available with firmware version 2.608, 2.610 and above. This document with version 1.20, 1.21, 1.22, 1.23, 1.24
is available with firmware 2.616 and above.
2. Catalog
Document History ......................................................................................................................................................................................................2
1. Preface..............................................................................................................................................................................................................3
2. Catalog..............................................................................................................................................................................................................3
3. HTTP API Transaction ........................................................................................................................................................................................8
3.1Transaction ...................................................................................................................................................................................................8
3.2Authentication ..............................................................................................................................................................................................9
4. Camera .............................................................................................................................................................................................................9
4.1Stream ........................................................................................................................................................................................................10
4.1.1 GetStream .......................................................................................................................................................................................10
4.1.2 GetMaxExtraStreamCounts .............................................................................................................................................................10
4.1.3 GetSnapshot ...................................................................................................................................................................................10
4.1.4 GetVideo .........................................................................................................................................................................................10
4.1.5 Playback ..........................................................................................................................................................................................11
4.1.6 Download ........................................................................................................................................................................................11
4.1.7 PlayBack By Filename .....................................................................................................................................................................11
4.1.8 LoadFile By Filename ......................................................................................................................................................................12
4.1.9 GetStream By Http ..........................................................................................................................................................................12
4.1.10 Playback By Http ...........................................................................................................................................................................12
4.2VideoColor ..................................................................................................................................................................................................13
4.2.1 GetVideoColorConfig ......................................................................................................................................................................13
4.2.2 SetVideoColorConfig .......................................................................................................................................................................13
4.3VideoEncode...............................................................................................................................................................................................14
4.3.1 GetVideoConfigCaps .......................................................................................................................................................................14
4.3.2 Resolution .......................................................................................................................................................................................15
4.3.3 GetVideoEncodeConfig ...................................................................................................................................................................16
4.3.4 SetVideoEncodeConfig ................................................................................................................................................................... 17
4.4AudioEncode ...............................................................................................................................................................................................18
4.4.1 GetAudioConfigCaps .......................................................................................................................................................................18
4.4.2 GetAudioEncodeConfig ...................................................................................................................................................................18
4.4.3 SetAudioEncodeConfig....................................................................................................................................................................19
4.5 SnapEncode ...............................................................................................................................................................................................20
4.5.1 GetSnapConfigCaps .........................................................................................................................................................................20
4.5.2 GetSnapEncodeConfig ....................................................................................................................................................................21
3
4.5.3 SetSnapEncodeConfig .....................................................................................................................................................................21
4.6ChannelTitle ...............................................................................................................................................................................................22
4.6.1 GetChannelTitleConfig ....................................................................................................................................................................22
4.6.2 SetChannelTitleConfig ....................................................................................................................................................................22
4.7VideoStandard ............................................................................................................................................................................................23
4.7.1 GetVideoStandardConfig ................................................................................................................................................................23
4.7.2 SetVideoStandardConfig .................................................................................................................................................................23
4.8VideoWidget...............................................................................................................................................................................................23
4.8.1 GetVideoWidgetConfig ...................................................................................................................................................................23
4.8.2 SetVideoWidgetConfig ...................................................................................................................................................................24
4.9VideoOut ....................................................................................................................................................................................................25
4.9.1 GetVideoOutConfig.........................................................................................................................................................................25
4.9.2 SetVideoOutConfig .........................................................................................................................................................................26
5. NetWork ......................................................................................................................................................................................................... 27
5.1NetInterfaces .............................................................................................................................................................................................. 27
5.1.1 GetInterfaces................................................................................................................................................................................... 27
5.2BasicConfig.................................................................................................................................................................................................. 27
5.2.1 GetBasicConfig ................................................................................................................................................................................ 27
5.2.2 SetBasicConfig .................................................................................................................................................................................28
5.3PPPoE ..........................................................................................................................................................................................................28
5.3.1 GetPPPoEConfig ..............................................................................................................................................................................28
5.3.2 SetPPPoEConfig ...............................................................................................................................................................................29
5.4DDNS ...........................................................................................................................................................................................................29
5.4.1 GetDDNSConfig ...............................................................................................................................................................................29
5.4.2 SetDDNSConfig................................................................................................................................................................................29
5.5Email ...........................................................................................................................................................................................................30
5.5.1 GetEmailConfig ...............................................................................................................................................................................30
5.5.2 SetEmailConfig ................................................................................................................................................................................31
5.6Wlan ...........................................................................................................................................................................................................31
5.6.1 GetWlanConfig ................................................................................................................................................................................31
5.6.2 SetWlanConfig ................................................................................................................................................................................32
5.7UPnP ...........................................................................................................................................................................................................33
5.7.1 GetUPnPConfig ...............................................................................................................................................................................33
5.7.2 SetUPnPConfig ................................................................................................................................................................................33
5.7.3 GetUPnPStatus ................................................................................................................................................................................33
5.8NTP .............................................................................................................................................................................................................34
5.8.1 GetNTPConfig..................................................................................................................................................................................34
5.8.2 SetNTPConfig ..................................................................................................................................................................................34
5.9AlarmServer ................................................................................................................................................................................................35
5.9.1 GetAlarmServerConfig ....................................................................................................................................................................35
5.9.2 SetAlarmServerConfig .....................................................................................................................................................................35
6. Events .............................................................................................................................................................................................................36
6.1EventHandler ..............................................................................................................................................................................................36
6.1.1 GetEventHandler.............................................................................................................................................................................36
6.1.2 SetEventHandler ............................................................................................................................................................................. 37
4
6.2Alarm ..........................................................................................................................................................................................................39
6.2.1 GetAlarmConfig ..............................................................................................................................................................................39
6.2.2 SetAlarmConfig ...............................................................................................................................................................................39
6.2.3 GetAlarmOutConfig ........................................................................................................................................................................39
6.2.4 SetAlarmOutConfig .........................................................................................................................................................................40
6.2.5 GetInSlots ........................................................................................................................................................................................40
6.2.6 GetOutSlots .....................................................................................................................................................................................40
6.2.7 GetInState .......................................................................................................................................................................................40
6.2.8 GetOutState ....................................................................................................................................................................................41
6.2.9 GetChannelInState ..........................................................................................................................................................................41
6.2.10 GetChannelOutState .....................................................................................................................................................................41
6.3MotionDetect .............................................................................................................................................................................................41
6.3.1 GetMotionDetectConfig ..................................................................................................................................................................41
6.3.2 SetMotionDetectConfig ..................................................................................................................................................................42
6.4BlindDetect .................................................................................................................................................................................................42
6.4.1 GetBlindDetectConfig .....................................................................................................................................................................42
6.4.2 SetBlindDetectConfig ......................................................................................................................................................................43
6.5LossDetect ..................................................................................................................................................................................................43
6.5.1 GetLossDetectConfig .......................................................................................................................................................................43
6.5.2 SetLossDetectConfig .......................................................................................................................................................................43
6.6 StorageAbnormal .......................................................................................................................................................................................44
6.6.1 GetStorageNotExistConfig ...............................................................................................................................................................44
6.6.2 SetStorageNotExistConfig ...............................................................................................................................................................44
6.6.3 Get StorageFailureConfig ................................................................................................................................................................44
6.6.4 Set StorageFailureConfig .................................................................................................................................................................44
6.6.5 GetStorageLowSpaceConfig ............................................................................................................................................................45
6.6.6 SetStorageLowSpaceConfig .............................................................................................................................................................45
6.7 NetAbnormal .............................................................................................................................................................................................45
6.7.1 GetNetAbortConfig .........................................................................................................................................................................45
6.7.2 SetNetAbortConfig ..........................................................................................................................................................................45
6.7.3 GetIPConflictConfig .........................................................................................................................................................................46
6.7.4 SetIPConflictConfig .........................................................................................................................................................................46
6.8 GetEventIndexes ........................................................................................................................................................................................46
6.9 Attach.........................................................................................................................................................................................................46
7.PTZ ........................................................................................................................................................................................................................48
7.1PTZConfig ....................................................................................................................................................................................................48
7.1.1 GetPTZConfig ..................................................................................................................................................................................48
7.1.2 SetPTZConfig ...................................................................................................................................................................................48
7.2PTZControl ..................................................................................................................................................................................................49
7.2.1 GetProtocolList................................................................................................................................................................................49
7.2.2 GetCurrentProtocolCaps .................................................................................................................................................................49
7.2.3 PTZ control commands ...................................................................................................................................................................50
7.3PTZStatus ....................................................................................................................................................................................................53
7.3.1 PTZ GetStatus ..................................................................................................................................................................................53
7. Record&Snap ..................................................................................................................................................................................................53
5
8.1Record .........................................................................................................................................................................................................53
8.1.1 GetRecordConfig .............................................................................................................................................................................53
8.1.2 SetRecordConfig..............................................................................................................................................................................54
8.1.3 GetRecordModeConfig ...................................................................................................................................................................54
8.1.4 SetRecordModeConfig ....................................................................................................................................................................55
8.2Snap ............................................................................................................................................................................................................55
8.2.1 GetSnapConfig ................................................................................................................................................................................55
8.2.2 SetSnapConfig .................................................................................................................................................................................55
8. System ............................................................................................................................................................................................................56
9.1General .......................................................................................................................................................................................................56
9.1.1 GetGeneralConfig............................................................................................................................................................................56
9.1.2 SetGeneralConfig ............................................................................................................................................................................56
9.2SystemTime ................................................................................................................................................................................................ 57
9.2.1 GetCurrentTime .............................................................................................................................................................................. 57
9.2.2 SetCurrentTime............................................................................................................................................................................... 57
9.3Locales ........................................................................................................................................................................................................ 57
9.3.1 GetLocalesConfig ............................................................................................................................................................................ 57
9.3.2 SetLocalesConfig .............................................................................................................................................................................58
9.4Language .....................................................................................................................................................................................................59
9.4.1 GetLanguageCaps ...........................................................................................................................................................................59
9.4.2 GetLanguageConfig .........................................................................................................................................................................59
9.4.3 SetLanguageConfig..........................................................................................................................................................................59
9.5AccessFilter .................................................................................................................................................................................................60
9.5.1 GetAccessFilterConfig .....................................................................................................................................................................60
9.5.2 SetAccessFilterConfig ......................................................................................................................................................................60
9.6AutoMaintain ..............................................................................................................................................................................................60
9.6.1 GetAutoMaintainConfig ..................................................................................................................................................................60
9.6.2 SetAutoMaintainConfig ...................................................................................................................................................................61
9.7UserManager ..............................................................................................................................................................................................61
9.7.1 Group ..............................................................................................................................................................................................61
9.7.2 GetGroupInfo .................................................................................................................................................................................. 62
9.7.3 GetGroupInfoAll .............................................................................................................................................................................. 62
9.7.4 AddUser .......................................................................................................................................................................................... 62
9.7.5 DeleteUser ......................................................................................................................................................................................63
9.7.6 ModifyUser .....................................................................................................................................................................................63
9.7.7 ModifyPassword .............................................................................................................................................................................63
9.7.8 GetUserInfo .....................................................................................................................................................................................63
9.7.9 GetUserInfoAll.................................................................................................................................................................................64
9.7.10 GetActiveUserInfoAll .....................................................................................................................................................................64
9.8System Operation .......................................................................................................................................................................................64
9.8.1 Reboot ............................................................................................................................................................................................64
9.8.2 Shutdown ........................................................................................................................................................................................64
9.8.3 GetDeviceType ................................................................................................................................................................................65
9.8.4 GetHardwareVersion .......................................................................................................................................................................65
9.8.5 GetSerialNo .....................................................................................................................................................................................65
6
9.8.6 GetMachineName ...........................................................................................................................................................................65
9.8.7 GetSystemInfo .................................................................................................................................................................................65
9.8.8 GetVendor .......................................................................................................................................................................................65
9.8.9 GetSoftWareVersion .......................................................................................................................................................................66
9.8.10 GetBuildDate .................................................................................................................................................................................66
9.9 Log .............................................................................................................................................................................................................66
9.9.1 StartFind .........................................................................................................................................................................................66
9.9.2 DoFind.............................................................................................................................................................................................66
9.9.3 StopFind .......................................................................................................................................................................................... 67
9.9.4 Clear ................................................................................................................................................................................................ 67
10. Storage ....................................................................................................................................................................................................... 67
10.1 File Finding ...................................................................................................................................................................................... 67
10.1.1 Create............................................................................................................................................................................................ 67
10.1.2 StartFind .......................................................................................................................................................................................68
10.1.3 FindNextFile ..................................................................................................................................................................................68
10.1.4 Close .............................................................................................................................................................................................69
10.1.5 Destroy ..........................................................................................................................................................................................69
10.2 Storage Device .................................................................................................................................................................................69
10.2.1 GetStorageDevicePortInfo ............................................................................................................................................................69
10.3 NAS .................................................................................................................................................................................................. 70
10.3.1 GetNASConfig ............................................................................................................................................................................... 70
10.3.2 SetNASConfig ................................................................................................................................................................................ 70
10.4 Storage Point ....................................................................................................................................................................................71
10.4.1 GetRecordStoragePointConfig ......................................................................................................................................................71
10.4.2 SetRecordStoragePointConfig .......................................................................................................................................................71
10.4.3 GetStorageGroupConfig ................................................................................................................................................................71
10.4.4 SetStorageGroupConfig................................................................................................................................................................. 72
11. GUI ............................................................................................................................................................................................................. 72
11.1.1 GetGUIConfig ................................................................................................................................................................................ 72
11.1.2 SetGUIConfig .................................................................................................................................................................................73
12. Display .......................................................................................................................................................................................................73
12.1 Split ..................................................................................................................................................................................................73
12.1.1 GetSplitMode ................................................................................................................................................................................73
12.1.2 SetSplitMode ................................................................................................................................................................................ 74
12.2 Monitor Tour .................................................................................................................................................................................... 74
12.2.1 EnableMonitorTour ....................................................................................................................................................................... 74
12.2.2 GetMonitorTourConfig .................................................................................................................................................................. 74
12.2.3 SetMonitorTourConfig .................................................................................................................................................................. 74
12.3 Monitor Collect ................................................................................................................................................................................75
12.3.1 GetMonitorCollectionConfig .........................................................................................................................................................75
12.3.2 SetMonitorCollectionConfig..........................................................................................................................................................75
13. Audio.......................................................................................................................................................................................................... 76
13.1 Audio MIME type ............................................................................................................................................................................. 76
13.2 Post Audio ........................................................................................................................................................................................ 76
13.2.1 Example for singlepart .................................................................................................................................................................. 76
7
13.3.2 Example for multipart ...................................................................................................................................................................77
13.3 Get Audio .........................................................................................................................................................................................77
13.3.1 Example for singlepart ..................................................................................................................................................................77
13.3.2 Example for multipart ................................................................................................................................................................... 78
14. Appendix .................................................................................................................................................................................................... 78
14.1 Stream Format ................................................................................................................................................................................. 78
15 PositionManager .........................................................................................................................................................................................80
15.1 GetStatus .........................................................................................................................................................................................80
3.1Transaction
The HTTP API Transaction starts from a request from a client Application, usually a web browser. The request is processed by the web
server on the Dahua video products, then send the response back to the client application. The HTTP request is taken in GET form. If the
request is successful, the Dahua video product will return a HTTP header contains 200 OK. The HTTP Body will contain actual data or error
message if an error occurs.
For describe convenience, we use some short words to instead the long expressions. The follows are several regulations:
1. The italics and bold will be replaced by the value behind the symbol “=”.
2. The URL must follow the standard way of writing a URL.(RFC_3986:Uniform Resource Identifiers (URI) Generic Syntax);that is ,spaces
and other reserved characters (“;”, “/”, “?”, “:”, “@”, “=”, “+”, “,” and “$”) within a <paramName> or a <paramValue> must be replaced
with %<ASCII hex>.For example ,the blank must be instead with %20.
3. To describe the range of the configuration, we use some symbols such as “[]”, “{}” and so on. For example :”[0-100]” denotes a
integer not less than 0 and not larger than 100. “{0,1,2,3}” denotes the valid value of a integer among 0,1,2 and 3.
4. In the request and response, we use “[]” to denote an array. The index is usually a integer and start form 0.
5. The parameter value has several types: string, integer, bool and float.Integer is 32 bits.The range of bool is “true” and “false”.
The below is an example of a transaction:
Request GET http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=VideoColor
Description Get VideoColor configuration.
Response HTTP/1.1 200 OK
Content-Type:text/plain
head.Brightness=50
head.Contrast=50
head.Hue=50
head.Saturation=50
head.TimeSection=1 00:00:00-24:00:00
8
Comment In above table, head= table.VideoColor[ChannelNo][ColorConfigNo]
ChannelNo = video channel index,
colorConfigNo = color config index.
0 = Color Config 1
1 = Color Config 2
…
We can also request the single config.
For example:
Request :
GET http://10.7.2.4/cgi-bin/configManager.cgi?action=getConfig&name=VideoColor[0][0].Brightness
Response:
HTTP/1.1 200 OK
Content-Type:text/plain
table.VideoColor[0][0].Brightness=50
3.2Authentication
The Dahua video product supplies two authentication ways: basic authentication and digest authentication. If the http request does not
have “Authorization” , the Dahua video product returns 401, utill the http request has a legal authentication .
For example:
1. When basic authentication, the Dahua video product response:
401 Unauthorized
WWW-Authenticate: Basic realm=”XXXXXX”
Then the client encode the username and password with base64, send the following request:
Authorization: Basic VXZVXZ.
2. When digest authentication, the Dahua video product response:
WWW-Authenticate: Digest realm="DH_00408CA5EA04", nonce="000562fdY631973ef04f77a3ede7c1832ff48720ef95ad",
stale=FALSE, qop="auth";
The client calculates the digest using username, password, nonce, realm and URI with MD5, then send the following request:
Authorization: Digest username="admin", realm="DH_00408CA5EA04", nc=00000001,cnonce="0a4f113b",qop="auth"
nonce="000562fdY631973ef04f77a3ede7c1832ff48720ef95ad",uri="cgi-bin/global.login?userName=admin",
response="65002de02df697e946b750590b44f8bf"
4. Camera
Camera API allows application to configure and view Dahua video product settings.
9
4.1Stream
4.1.1 GetStream
4.1.2 GetMaxExtraStreamCounts
4.1.3 GetSnapshot
4.1.4 GetVideo
10
--<boundary>
Content-Type:image/jpeg
Content-Length:<image size>
4.1.5 Playback
URL rtsp://<username>:<password>@<ip>:<port>/cam/
Syntax playback?channel=<channelNo>&starttime=<starttime>&endtime=<endtime>
Comme It’s similar with 4.1.1 GetStream. Except there is parameter starttime and endtime.
nt For example:
rtsp://admin:[email protected]:554/cam/playback?channel=1&starttime=2012_09_15_12_37_05&endtime=2012_
09_15_18_34_14
4.1.6 Download
URL http://<ip>/cgi-bin/loadfile.cgi?action=startLoad&channel=<channelNo>&subtype=<typeNo>startTime=<starttime>&
Syntax endTime=<endtime>
Respons HTTP Code: 200 OK
e Content-Type: Application/octet-stream
Content-Length:<fileLength>
Body:
<data>
<data>
Comme The channel number starts from 0.
nt Subtype default 0.
For example:
http://10.61.200.14/cgi-bin/loadfile.cgi?action=startLoad&channel=0&subtype=0&startTime=2012-10-8%2013:00:01
& endTime=2012-10-8%2014:00:01
11
4.1.8 LoadFile By Filename
Comment Compared to 4.1.1 GetStream using RTSP, it is another way of get stream. This is a way to use http
protocol to get realmonitor stream. The data format is shown in appendix.
Comment Compared to 4.1.5 Playback using RTSP, it is another way of get playback stream. This is a way to use
http protocol to get playback stream. The data format is shown in appendix.
cmd=pause
pause the playback stream;
cmd=cancel
cancel the playback stream, and destroy the streamed;
This is the cgi to control playback stream, used to control the stream which built by “action=getStream”.
4.2VideoColor
4.2.1 GetVideoColorConfig
4.2.2 SetVideoColorConfig
13
ParamName ParamValue type Description
head.Brightness integer Brightness, range is [0-100]
head.Contrast integer Contrast, range is [0-100]
head.Hue integer Hue
head.Saturation integer Saturation
head.TimeSection string Effective time for this video color config.
Format is: mask starttime endtime
Mask range is {0, 1}.
Mask 0 – this video config is not effective
Mask 1 - this config is effective
Starttime/Endtime format like 11:00:00.
Example:
0 01:00:00-02:00:00, means this config is not effective.
1 01:00:00-02:00:00, means this config is effective between 01:00:00 and 02:00:00
head.NightOptions.ExposureValue1 float
head.NightOptions.ExposureValue2 float
head.NightOptions.Gain integer
head.NightOptions.GainAuto bool
head.NightOptions.GainBlue integer
head.NightOptions.GainGreen integer
head.NightOptions.GainRed integer
head.NightOptions.WhiteBalance String
head.NightOptions. ReferenceLevel integer
head.NightOptions. ExternalSyncPhase integer
4.3VideoEncode
4.3.1 GetVideoConfigCaps
14
Comment In above table:
Channel: video channel index
RecordType:
0 = regular record
1 = motion detection record
2 = alarm record
ExtraStream:
0 = extra stream 1
1 = extra stream 2
2 = extra stream 3
SnapType:
0 = regular snapshot
1 = motion detection snapshot
2 = alarm snapshot
4.3.2 Resolution
15
"SVGA" 800 x 592
"XVGA" 1024 x 768
"WXGA" 1280 x 800
"SXGA" 1280 x 1024
"WSXGA" 1600 x 1024
"UXGA" 1600 x 1200
"WUXGA" 1920 x 1200
"ND1" 240 x 192
"720" 1280 x 720
"1080" 1920 x 1080
"1280x960" 1280 x 960 (1.3 Mega Pixels)
"1872x1408" 1872 x 1408 (2.5 Mega Pixels)
"3744x1408" 3744 x 1408 (5 Mega Pixels)
"2048x1536" 2048 x 1536 (3 Mega Pixels)
"2432x2048" 2432 x 2048 (5 Mega Pixels)
"1216x1024" 1216 x 1024 (1.2 Mega Pixels)
"1408x1024" 1408 x 1024 (1.5 Mega Pixels)
"3296x2472" 3296 x 2472 (8 Mega Pixels)
"2560x1920" 2560 x 1920 (5 Mega Pixels)
"960H", 960 x 576 960 x 480
"DV720P" 960 x 720
4.3.3 GetVideoEncodeConfig
16
headExtra.Video.Width=1600
headExtra.VideoEnable=true
Comment Channel: video channel index
RecordType:
0 = regular record
1 = motion detection record
2 = alarm record
ExtraStream:
0 = extra stream 1
1 = extra stream 2
2 = extra stream 3
4.3.4 SetVideoEncodeConfig
17
head.Video.FPS float Range is [0.2-30].
Frames per second.
< 1.0: several seconds/frame, FPS=0.3333: 3 seconds per frame.
>1.0: several frames/second. FPS=3: 3 frames per second.
head.Video.GOP integer Range is [1-100].
Group of picture, it’s the interval of I Frame,
Example: GOP=50, means there is one I frame every 49 P or B frames
head.Video.Height integer Video height
head.Video.Width integer Video Width
head.Video.Profile String Range is { Baseline, Main , Extended , High }
Only when video compression is H.264, it’s effective.
head.Video.Quality integer Range is [1-6].
Image Quality, available when Video.BitRateControl=VBR
1: worst quality
6: best quality
head.VideoEnable bool True: enable video
4.4AudioEncode
4.4.1 GetAudioConfigCaps
4.4.2 GetAudioEncodeConfig
4.4.3 SetAudioEncodeConfig
19
Range depends on capacity in 4.4.1 GetAudioConfigCaps
head.Audio.Compression string Range depends on capacity in 4.4.1 GetAudioConfigCaps
4.5 SnapEncode
4.5.1 GetSnapConfigCaps
Response caps[Channel].SnapFormat[SnapType].Video.CompressionTypes=H.264,MJPG
caps[Channel].SnapFormat[SnapType].Video.ResolutionTypes=3M,1080,SXGA,1_3M,720,D1,CIF
20
4.5.2 GetSnapEncodeConfig
4.5.3 SetSnapEncodeConfig
21
Depends on capacity in 4.3.1 GetVideoConfigCaps
head.Video.FPS float Range is [0.2-30].
Frames per second.
< 1.0: several seconds/frame, FPS=0.3333: 3 seconds per frame.
>1.0: several frames/second. FPS=3: 3 frames per second.
head.Video.GOP integer Range is [1-100].
Group of picture, it’s the interval of I Frame,
Example: GOP=50, means there is one I frame every 49 P or B frames
head.Video.Height integer Video height
head.Video.Width integer Video Width
head.Video.Quality integer Range is [1-6].
Image Quality, available when Video.BitRateControl=VBR
1: worst quality
6: best quality
head.VideoEnable bool True: enable video
4.6ChannelTitle
4.6.1 GetChannelTitleConfig
4.6.2 SetChannelTitleConfig
22
4.7VideoStandard
4.7.1 GetVideoStandardConfig
4.7.2 SetVideoStandardConfig
4.8VideoWidget
4.8.1 GetVideoWidgetConfig
23
Comment Channel: video channel index
CoReg: Cover Region
Covers is an array which sustains multi- Cover regions
0 = region 1
1 = region 2
2 = region 3
3 = region 4
head=table.VideoWidget[Channel].ChannelTitle (or)
table.VideoWidget[Channel].Covers[CoReg] (or)
table.VideoWidget[Channel].TimeTitle
4.8.2 SetVideoWidgetConfig
VideoWidgetConfig contains cover region settings, channel title settings and time title settings.
The italics below will be replaced by the above abbreviations.
Response OK or ERROR
24
headCover.Rect[1] Rect[0]:top left corner x coordinate (left)
headCover.Rect[2] Rect[1]:top left corner y coordinate (top)
headCover.Rect[3] Rect[2]:bottom right x coordinate (right)
Rect[3]:bottom right y coordinate (bottom)
headChannelTitle.BackColor[0] integer Range is the same with headCover
headChannelTitle.BackColor[1]
headChannelTitle.BackColor[2]
headChannelTitle.BackColor[3]
headChannelTitle.EncodeBlend bool
headChannelTitle.FrontColor[0] integer
headChannelTitle.FrontColor[1]
headChannelTitle.FrontColor[2]
headChannelTitle.FrontColor[3]
headChannelTitle.Rect[0] integer Only use the value of (left,top),the value of (right,bottom) is the same
headChannelTitle.Rect[1] as (left,top)
headChannelTitle.Rect[2] Rect[0], Rect[1] are used, and Rect[2] must be same with Rect[0],
headChannelTitle.Rect[3] Rect[3] must be same with Rect[1].
headTimeTitle.BackColor[0] integer Range is the same with headChannelTitle
headTimeTitle.BackColor[1] These are configs about time title.
headTimeTitle.BackColor[2]
headTimeTitle.BackColor[3]
headTimeTitle.EncodeBlend bool
headTimeTitle.FrontColor[0] integer
headTimeTitle.FrontColor[1]
headTimeTitle.FrontColor[2]
headTimeTitle.FrontColor[3]
headTimeTitle.Rect[0] integer
headTimeTitle.Rect[1]
headTimeTitle.Rect[2]
headTimeTitle.Rect[3]
headTimeTitle.ShowWeek bool True: Display week within the time title.
4.9VideoOut
4.9.1 GetVideoOutConfig
25
head.Color.Brightness=50
head.Color. Contrast =50
head.Color. Satuation =50
head.Color. Hue =50
head.Mode. Width =800
head.Mode. Height=600
head.Mode. BPP =16
head.Mode. Format =”Auto”
head.Mode. RefreshRate =60…
…
Comment head = table.VideoOut[channel].
4.9.2 SetVideoOutConfig
26
5. NetWork
5.1NetInterfaces
5.1.1 GetInterfaces
5.2BasicConfig
5.2.1 GetBasicConfig
27
table.Network.interface.IPAddress=10.7.2.3
table.Network.interface.MTU=1500
table.Network.interface.PhysicalAddress=00:10:5c:f2:1c:b4
table.Network.interface.SubnetMask=255.255.0.0
5.2.2 SetBasicConfig
5.3PPPoE
5.3.1 GetPPPoEConfig
28
Comment
Response table.PPPoE.Enable=false
table.PPPoE.Password=123456
table.PPPoE.UserName=123456
5.3.2 SetPPPoEConfig
5.4DDNS
5.4.1 GetDDNSConfig
5.4.2 SetDDNSConfig
29
ParamName ParamValue type Description
DDNS[index].Address string DDNS server IP address or name.
DDNS[index].Enable bool Multiple DDNS hostname can be configured, but Only one
hostname can be enabled, others should be disabled.
DDNS[index].HostName String Host name of this device.
DDNS[index].KeepAlive integer Range is [1-65535].
Unit is minutes.
DDNS[index].Password string DDNS user password
DDNS[index].Port integer Range is [1-65535].
Port of DDSN server
DDNS[index].Protocol string Range is {NO-IP DDNS, Dyndns DDNS, DAHUA}.
DDSN protocol type
DDNS[index].UserName string DDNS user name
5.5Email
5.5.1 GetEmailConfig
30
5.5.2 SetEmailConfig
5.6Wlan
5.6.1 GetWlanConfig
31
table.WLan.eth2.Keys[2]=password3
table.WLan.eth2.Keys[3]=password4
table.WLan.eth2.LinkMode=Auto
table.WLan.eth2.SSID=dahua
5.6.2 SetWlanConfig
32
5.7UPnP
5.7.1 GetUPnPConfig
5.7.2 SetUPnPConfig
5.7.3 GetUPnPStatus
33
5.8NTP
5.8.1 GetNTPConfig
5.8.2 SetNTPConfig
5.9AlarmServer
5.9.1 GetAlarmServerConfig
5.9.2 SetAlarmServerConfig
6. Events
6.1EventHandler
6.1.1 GetEventHandler
Example URL:
http://<ip>/cgi-bin/configManager.cgi?action=getConfig&name=Alarm[0].EventHandler
can get EventHandler settings of alarm channel 0.
Response
handlerName.EventHandler.AlarmOutChannels[0]=1
handlerName.EventHandler.AlarmOutChannels[1]=1
…
handlerName.EventHandler.AlarmOutEnable=false
handlerName.EventHandler.AlarmOutLatch=10
handlerName.EventHandler.BeepEnable=true
handlerName.EventHandler.Dejitter=0
handlerName.EventHandler.Delay=30
handlerName.EventHandler.LogEnable=true
handlerName.EventHandler.MailEnable=true
handlerName.EventHandler.PtzLink[0][0]=None
handlerName.EventHandler.PtzLink[0][1]=0
handlerName.EventHandler.PtzLink[1][0]=None
handlerName.EventHandler.PtzLink[1][1]=0
36
…
handlerName.EventHandler.PtzLinkEnable=false
handlerName.EventHandler.RecordChannels[0]=1
handlerName.EventHandler.RecordChannels[1]=1
…
handlerName.EventHandler.RecordEnable=true
handlerName.EventHandler.RecordLatch=10
handlerName.EventHandler.SnapshotChannels[0]=1
handlerName.EventHandler.SnapshotChannels[1]=1
…
handlerName.EventHandler.SnapshotEnable=false
handlerName.EventHandler.SnapshotPeriod=3
handlerName.EventHandler.SnapshotTimes=0
handlerName.EventHandler.TimeSection[0][0]=1 01:00:00-24:00:00
handlerName.EventHandler.TimeSection[0][1]=1 01:00:00-24:00:00
…
…
handlerName.EventHandler.TimeSection[6][5]=1 01:00:00-24:00:00
handlerName.EventHandler.TipEnable=true
handlerName.EventHandler. ExAlarmOutEnable=true
handlerName. ExAlarmOutChannels[0] =2
handlerName.ExAlarmOutChannels[1]=3
…
6.1.2 SetEventHandler
37
handlerName.EventHandler.BeepEnable bool Enable/Disable beep.
handlerName.EventHandler.Dejitter integer Range is [0-255].
Alarm signal dejitter seconds. Alarm signal change during this period is
ignored.
handlerName.EventHandler.Delay integer Range is [0-300].
Delay seconds before setting take effect.
handlerName.EventHandler.LogEnable bool Enable/Disable log for alarm.
handlerName.EventHandler.MailEnable bool Enable/Disable mail send for alarm.
handlerName.EventHandler.PtzLink[ch][0] string Range is {None, Preset, Tour, Pattern}
This is PTZ action linked with events. ch is PTZ channel index.
handlerName.EventHandler.PtzLink[ch][1] integer This is the parameter of PtzLink[ch][0],
If PtzLink[ch]][0] is
Preset: this is preset point.
Tour: this is tour path number.
Pattern: this is pattern number.
handlerName.EventHandler.PtzLinkEnable Bool Enable/Disable PTZ link.
handlerName.EventHandler.RecordChannels[ch] Integer Range is {0, 1}
0 – do not record on video channel ch
1 – record. on video channel ch
handlerName.EventHandler.RecordEnable bool Enable/Disable record function.
handlerName.EventHandler.RecordLatch integer Range is [10-300].
Unit is seconds, indicates the time to record after input alarm is cleared..
handlerName.EventHandler.SnapshotChannels[ch] integer Range is {0, 1}
0 – do not snapshot on video channel ch
1 – snapshot on video channel ch
handlerName.EventHandler.SnapshotEnable bool Enable/Disable snapshot function.
handlerName.EventHandler.SnapshotPeriod integer Range is [0-255].
Frames between snapshot.
0 means continuously snapshot for every frame.
handlerName.EventHandler.SnapshotTimes integer Range is [0-65535]
Snapshot times before stop, 0 means don’t stop snapshot.
handlerName.EventHandler.TimeSection[wd][ts] String It’s table contains effective time period for eventHanlder everyday.
wd (week day) range is [0-6] (Sunday-Staurday)
ts (time section) range is [0-23], it’s index of timesection table.
Example:
TimeSection[1][0]=1 12:00:00-18:00:00
Means EventHandler is effective between 12:00:00 and 18:00:00 at
Monday.
handlerName.EventHandler.TipEnable bool Enable/Disable local message box tip.
38
handlerName.EventHandler. ExAlarmOutEnable bool
handlerName. ExAlarmOutChannels[channels] integer
6.2Alarm
6.2.1 GetAlarmConfig
6.2.2 SetAlarmConfig
6.2.3 GetAlarmOutConfig
39
6.2.4 SetAlarmOutConfig
6.2.5 GetInSlots
6.2.6 GetOutSlots
6.2.7 GetInState
40
6.2.8 GetOutState
6.2.9 GetChannelInState
6.2.10 GetChannelOutState
6.3MotionDetect
6.3.1 GetMotionDetectConfig
41
6.3.2 SetMotionDetectConfig
6.4BlindDetect
6.4.1 GetBlindDetectConfig
42
head.Level=3
6.4.2 SetBlindDetectConfig
6.5LossDetect
6.5.1 GetLossDetectConfig
6.5.2 SetLossDetectConfig
43
6.6 StorageAbnormal
6.6.1 GetStorageNotExistConfig
6.6.2 SetStorageNotExistConfig
44
6.6.5 GetStorageLowSpaceConfig
6.6.6 SetStorageLowSpaceConfig
6.7 NetAbnormal
6.7.1 GetNetAbortConfig
6.7.2 SetNetAbortConfig
45
6.7.3 GetIPConflictConfig
6.7.4 SetIPConflictConfig
6.8 GetEventIndexes
(This response means event happened on channel 0, channel 2, and channel 3.)
6.9 Attach
For example:
HTTP Code: 200 OK\r\n
Cache-Control: no-cache\r\n
Pragma: no-cache\r\n
Expires: Thu, 01 Dec 2099 16:00:00 GMT\r\n
Connection: close\r\n
Content-Type: multipart/x-mixed-replace; boundary=myboundary\r\n\r\n
Body:
-- myboundary \r\n
Content-Type: text/plain\r\n
Content-Length: 39\r\n
Code=VideoMotion;action=Start;index=0\r\n\r\n
-- myboundary \r\n
Content-Type: text/plain\r\n
Content-Length: 38\r\n
Code=VideoBlind;action=Start;index=0\r\n\r\n
-- myboundary \r\n
Content-Type: text/plain\r\n
Content-Length: 38\r\n
Code= MDResult;action=Pulse;index=0;data=61708863,61708863…\r\n\r\n
-- myboundary \r\n
…
47
7.PTZ
7.1PTZConfig
7.1.1 GetPTZConfig
7.1.2 SetPTZConfig
48
-1: homing is disabled.
[0-255]: preset point number
Ptz[port].Homing[1] integer Range is [0-65535].
No operation timeout, unit is seconds.
After no operation timeout, PTZ go to preset point set in
Ptz[port].Homing[0].
Ptz[port].ProtocolName string PTZ protocol name, depends on PTZ capability,
refer to 7.2.1 GetProtocolList to get the protocol list.
7.2PTZControl
7.2.1 GetProtocolList
7.2.2 GetCurrentProtocolCaps
49
caps.TileSpeedMin=1
caps.TourMax=7
caps.TourMin=0
caps.Type=1
51
ClearPattern Clear pattern path Pattern number 0 0 0
AlarmSearch Search alarm. 0 0 0 0
Position Go to position Horizontal Vertical position Zoom change 0
position
AuxOn Auxiliary function on, auxiliary 0 0 0 0
function is defined in product
definition document.
AuxOff Auxiliary function off 0 0 0 0
Menu 0 0 0 0
Exit 0 0 0 0
Enter 0 0 0 0
Esc 0 0 0 0
MenuUp 0 0 0 0
MenuDown 0 0 0 0
MenuLeft 0 0 0 0
MenuRight 0 0 0 0
Reset Restore default configuration. 0 0 0 0
SetPresetName Preset point Preset point title. 0 0
number (1 byte)
AlarmPtz Alarm linked PTZ. External alarm Link type: Argument of link 0
input channel. 1: go to preset type:
point Link type = 1,
2: auto scan this is preset point
3: tour number
Link type = 2,
this is auto scan
path
Link type = 3,
this is tour path
LightController Control the light on/off. Address of light Light number switch 0
controller
PositionABS Go to ABS position Horizontal angle: Vertical Zoom in mutiple Speed[1-8], not
0°-360° angle :0°-90° must
PositionReset Use current direction as 0 0 0 0
reference.
UpTele up + TELE Speed [1-8] 0 0 0
DownTele down + TELE Speed [1-8] 0 0 0
LeftTele left + TELE Speed [1-8] 0 0 0
RightTele right + TELE Speed [1-8] 0 0 0
LeftUpTele leftup + TELE Speed [1-8] 0 0 0
LeftDownTele leftdown + TELE Speed [1-8] 0 0 0
RigjtUpTele rightup + TELE Speed [1-8] 0 0 0
RightDownTele rightdown + TELE Speed [1-8] 0 0 0
UpWide up + WIDE Speed [1-8] 0 0 0
52
DownWide down + WIDE Speed [1-8] 0 0 0
LeftWide left + WIDE Speed [1-8] 0 0 0
RightWide right + WIDE Speed [1-8] 0 0 0
LeftUpWide leftup + WIDE Speed [1-8] 0 0 0
LeftDownWide leftdown + WIDE Speed [1-8] 0 0 0
RightUpWide rightup + WIDE Speed [1-8] 0 0 0
RightDownWide rightdown + WIDE Speed [1-8] 0 0 0
Continuously Horizontal Speed Vertical Speed Zoom Speed [-8-8] Timeout
Move Continuously
[-8-8] [-8-8]
Relatively Relatively angle: Relatively Relatively Zoom
Move Relatively
0°-360° angle :0°-90°
7.3PTZStatus
7. Record&Snap
8.1Record
8.1.1 GetRecordConfig
53
table.Record[channel].TimeSection[weekday][4]=0 05:00:00-24:00:00
table.Record[channel].TimeSection[weekday][5]=0 06:00:00-24:00:00
8.1.2 SetRecordConfig
8.1.3 GetRecordModeConfig
54
8.1.4 SetRecordModeConfig
8.2Snap
8.2.1 GetSnapConfig
8.2.2 SetSnapConfig
55
Mask indicates record type by bits:
Bit0: regular snapshot
Bit1: motion detection snapshot
Bit2: alarm snapshot
Bit3: card snapshot
:
8. System
9.1General
9.1.1 GetGeneralConfig
9.1.2 SetGeneralConfig
56
9.2SystemTime
9.2.1 GetCurrentTime
9.2.2 SetCurrentTime
9.3Locales
9.3.1 GetLocalesConfig
57
9.3.2 SetLocalesConfig
Example:
yyyy-MM-dd HH:mm:ss or
58
MM-dd-yyyy HH:mm:ss or
dd-M-yy hh:mm:ss
9.4Language
9.4.1 GetLanguageCaps
9.4.2 GetLanguageConfig
9.4.3 SetLanguageConfig
59
9.5AccessFilter
9.5.1 GetAccessFilterConfig
9.5.2 SetAccessFilterConfig
9.6AutoMaintain
9.6.1 GetAutoMaintainConfig
60
table.AutoMaintain. AutoShutdownHour=0
table.AutoMaintain. AutoShutdownMinute=0
table.AutoMaintain. AutoStartUpDay=1
table.AutoMaintain. AutoStartUpHour=2
table.AutoMaintain. AutoStartUpMinute=0
9.6.2 SetAutoMaintainConfig
9.7UserManager
9.7.1 Group
There are two user groups: “admin” and “user”. The “admin” group has all the authorities of operating the IP Camera. The “user” group
only has monitor and replay authorities.
61
9.7.2 GetGroupInfo
9.7.3 GetGroupInfoAll
9.7.4 AddUser
62
9.7.5 DeleteUser
9.7.6 ModifyUser
9.7.7 ModifyPassword
9.7.8 GetUserInfo
63
9.7.9 GetUserInfoAll
9.7.10 GetActiveUserInfoAll
9.8System Operation
9.8.1 Reboot
9.8.2 Shutdown
64
9.8.3 GetDeviceType
9.8.4 GetHardwareVersion
9.8.5 GetSerialNo
9.8.6 GetMachineName
9.8.7 GetSystemInfo
9.8.8 GetVendor
65
9.8.9 GetSoftWareVersion
9.8.10 GetBuildDate
9.9 Log
9.9.1 StartFind
Example:
Find log between 2011-1-1 12:00:00 and 2011-1-10 12:00:00, URL is:
http://<ip>/cgi-bin/log.cgi?action=startFind&condition.StartTime=2011-1-1 12:00:00
&condition.EndTime=2011-1-10 12:00:00
Response token=1
9.9.2 DoFind
66
items[1].RecNo=790
items[1].Time=2011-05-20 11:59:21
items[1].Type=SaveConfig
items[1].User=System
…
9.9.3 StopFind
9.9.4 Clear
10. Storage
10.1.1 Create
67
10.1.2 StartFind
10.1.3 FindNextFile
10.1.4 Close
10.1.5 Destroy
10.2.1 GetStorageDevicePortInfo
69
10.3 NAS
10.3.1 GetNASConfig
10.3.2 SetNASConfig
70
10.4 Storage Point
10.4.1 GetRecordStoragePointConfig
10.4.2 SetRecordStoragePointConfig
10.4.3 GetStorageGroupConfig
10.4.4 SetStorageGroupConfig
11. GUI
11.1.1 GetGUIConfig
12. Display
12.1 Split
12.1.1 GetSplitMode
12.2.1 EnableMonitorTour
12.2.2 GetMonitorTourConfig
12.2.3 SetMonitorTourConfig
74
MonitorTour[ch].Collections Split collections
12.3.1 GetMonitorCollectionConfig
12.3.2 SetMonitorCollectionConfig
75
13. Audio
MIME Description
Audio/PCM
Audio/ADPCM
Audio/G.711A
Audio/G.711Mu
Audio/G.726
Audio/G.729
Audio/MPEG2
Audio/AMR
Audio/AAC
The RUL of transmit a singlepart、channel 1 audio stream(encoded with G.711 A-law) is:
http: //<ip>/cgi-bin/audio.cgi?action=postAudio&httptype=singlepart&channel=1
example:
POST /cgi-bin/audio.cgi?action=postAudio&httptype=singlepart&channel=1 HTTP/1.1
Content-Type: Audio/G.711A
Content-Length:9999999
<Audio data>
<Audio data>
76
13.3.2 Example for multipart
The RUL of transmit a multipart、channel 1 audio stream(encoded with G.711 A-law) is:
http: //<ip>/cgi-bin/audio.cgi?action=postAudio&httptype= multipart &channel=1
example:
POST /cgi-bin/audio.cgi?action=postAudio&httptype= multipart &channel=1 HTTP/1.1
Content-Type: multipart/x-mixed-replace; boundary=<boundary>
--<boundary>
Content-Type: Audio/G.711A
Content-Length: 800
<Audio data>
--<boundary>
The RUL of Request a singlepart、channel 1 audio stream(encoded with G.711 A-law) is:
http: //<ip>/cgi-bin/audio.cgi?action=getAudio&httptype=singlepart&channel=1
If the request was successful, the server returns a continuous flow of audio packets.The content type is only set at the beginning of the
connection.
Return:
HTTP Code: 200 OK
Content-Type: Audio/G.711A
Body:
<Audio data>
77
<Audio data>
The RUL of Request a multipart、channel 1 audio stream(encoded with G.711 A-law) is:
http: //<ip>/cgi-bin/audio.cgi?action=getAudio&httptype=multipart&channel=1
If the request was successful, the server returns a continuous flow of audio packets. The content type is “multipart/x-mixed-replace” and each
audio packet ends with a boundary string.
Return:
HTTP Code: 200 OK
Content-Type: multipart/x-mixed-replace; boundary=<boundary>
--<boundary>
Content-Type: Audio/G.711A
Content-Length: 800
<Audio data>
--<boundary>
14. Appendix
The Stream format is used by 4.1.9 GetStream By Http and 4.1.10 Playback By Http, describes the format of the data stream.
Stream Header:
Byte
0 1 2 3 4 5 6 7
Order
Byte
8 9 10 11 12 13 14 15
Order
Extend header
Key channel Sequence
length
Byte
16 17 18 19 20 21 22 23
Order
Byte
0 1 2 3 4 5 6 …
Order
Byte
0 1 2 3 4 5 6 7
Order
Audio Sample
Key 0x11 8 reserved Tracks reserved
Type Freq
A audio packet must contain the audio extend header;
Audio Type:1 - PCM8;2 - G729;3 - IMA_ADPCM;4 - G711U;5 - G721;6 - PCM8_VWIS;7 - MS_ADPCM;8 - G711A;9 - AMR-NB;10 -
PCM16;11- G723.1;12 – AAC;13 - G726_40;14 - G726_32;15 - G726_24;16 - G726_16
Tracks: Tracks number, support 1 and 2;
Sample Freq: audio sample frequence,1 - 4000;2 - 8000;3 - 11025;4 - 16000;5 - 20000;6 - 22050;7 - 32000;8 - 44100;9 - 48000;
Byte
0 1 2 3 4 5 6 7
Order
Video Frame
Key 0x21 16 reserved Width
Type Type
Byte
8 9 10 11 12 13 14 15
Order
I Frame Frame
Key Height reserved
Interval Rate
A video packet must contain the video extend header; Video Type means the video codec type, 1-MPEG4; 2-H.264; Frame Type: 1-I frame;
2-P frame;3-B frame; Width and Height describe the frame width and height by pixel;
79
Byte
0 1 2 3 4 5 6 …
Order
Byte
0 1 2 3 4 5 6 7
Order
Daylight
Key 0x31 8 reserved Time Zone saving reserved
time
When a stream begin, or the TimeZone changes, the video packet must contain the TimeZone extend header; Time Zone[0]:
[-12,12](west time zone 12 to east time zone 12), Time Zone[1] modify the time by minutes; Daylight saving time: 1/0, yes or not in daylight
saving time;
Byte
0 1 2 3 4 5 6 …
Order
15 PositionManager
15.1 GetStatus
80
status.SatelliteCount: satellite number;
status.WorkStatus: work status;
status.AlarmPoints: alarm Position;
Response status.Time= [2009,9,8,10,32,12]
status.Longitude=[120,10,32.00]
status.Latitude=[30,11,11.0]
status.Altitude=9999.9
status.Speed=30.00
status.Bearing=45.3
status.AntennasStatus=1
status.PositioningResult=1
status.SatelliteCount=2
status.WorkStatus=2
status.AlarmPoints=[1,31]
81