Z3-Camera Solutions-Http Api
Z3-Camera Solutions-Http Api
Reading Configuration
http://server_address/cgi-bin/control.cgi
The reponse will be in JSON format, giving the value of each variable.
To read global configuration variables, GET with this body:
ctrl=sys&chn=null
To read encoder channel configuration variables for channel 1, GET with this body:
ctrl=enc&chn=1
server_url='http://192.168.0.120/cgi-bin/control.cgi'
Sample output:
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
aenable
acodec
abitrate
asamplerate
asource
apid
Possible values: 32 to 8191 - must not conflict with other PID assignments.
aport
aptspcr
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
Description: For transport stream modes only – intial PTS to PCR offset for audio, in milliseconds
auth_passwd
auth_user
authonoff
Description: Enable or disable RTMP authentication. Default: off Possible values: on, off
channel
Possible values: 1, 2, 3
feccol
feconoff
fecrow
filesize
fprefix
Description: Relative filename for TSFILE or AUX file recording. Note that “fprefix” does NOT include
the absolute media path – the “storage” parameter is the proper place to specify the absolute media
path.
storage
telopcharsize
telopenable
teloplocation
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
teloptext
vgopsize
vbitrate
vdelay
vdest
Description: Destination URL address for encoded bitstream. May be interpreted differently depending
on “vprotocol” setting.
client_ip:client_port
server_ip[:server_port]/application/streamname
vframeratediv
Description: Divide video input frame rate by this number to get encode frame rate.
The encoder will discard (frameratediv-1) out of (frameratediv) frames.
Possible values: 1, 2, 3, 4, 5, 6
vgdr
Description: Enable or disable Gradual Data Refresh. Reduces I-frame size (reduces latency). At lower
bitrates, a horizontal rolling artifact may be visible.
vcodec
vprofile
vprotocol
vquality
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
Description: Set balance between low latency, and higher quality+bitrate compliance.
vratectrl
vres
vsource
Description: Video input from which encoder will source its video
pipenable
piplocaton
Description: Sets the location of the PIP on channel one. Only available on FV4K/FV2K/FSDI
vinterlacemode
vmulticastdest
amulticastdest
rtsp_auth_enable
rtsp_auth_username
rtsp_auth_password
Possible values: *
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
The following parameters only apply to transport stream encoding (transport is set to udp, asi, tsfile,
mts, or tsrtp).
vpid
Possible values: 32 to 8191 – must not conflict with other PID assignments
apid
Possible values: 32 to 8191 – must not conflict with other PID assignments
pcrpid
Possible values: 32 to 8191 – must not conflict with other PID assignments
pmtpid
tsrate
Possible values: The 'K' suffix indicates kilobits (thousands of bits/second). The 'M' suffix indicates
megabits (millions of bits/second).
Note: In UDP transport stream case, the tsrate should be set higher than the vbitrate, with at least
15% margin.
tslowlat
auxonoff
Describe: Enable AUXillary file recording in UDP mode – allows simultaneous UDP streaming and TS
file recording on the same channel. Only valid if transport is UDP and tslowlat is off
The filename is set by the “fprefix” parameter. The default value is “MOV1_%F_%T”. The ”%F”
specifier inserts a date stamp, and the ”%T” specifier inserts a time stamp.
The recording file size is set by the “filesize” parameter. When the file reaches this size, a new file will
be created.
klvbrate
klvenable
klvpid
klvsrc
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
pcrinterval
Global Configuration
Action Syntax
actionname='StartChannel'
server_url='http://192.168.0.120'
payload = 'ctrl=sys&chn=null'
sysctrl = requests.get(control_cgi_url, params=payload)
j = sysctrl.json()
print j
enc_channels_string = j['enc_channels']
opmode = j['opmode']
channel_list = enc_channels
if channel[0:0] == 'C':
channel = channel[1:]
print actionname, ' ', opmode, 'channel', channel
payload = 'action='+actionname+'&'+ 'chn=' +channel+'&' +
'loadfromdb=true';
headers={'Content-Type':'application/x-www-form-urlencoded;
charset=UTF-8'}
r = requests.post(control_cgi_url, data=payload, headers=headers)
print r.text
The “loadfromdb=true” parameter will load the current settings from the database.
If you omit the loadfromdb parameter, *none* of the database settings will be used – any parameters
you do not supply, will be set to default values.
For example, this is what a StartChannel request from the web server looks like:
action=StartChannel&chn=1&vsource=&vres=follow_input&vcodec=h265&vgdr=on&vpr
ofile=high&vratectrl=cbr&vbitrate=2M&vframeratediv=1&vgopsize=60&vprotocol=r
tsp&vdest=192.168.0.6:8600&storage=&fprefix=MOV1_%F_%T_&vpid=221&vdelay=1000
&pcrpid=521&pcrinterval=50&pmtpid=31&tsrate=3000K&tslowlat=on&feconoff=off&f
ecrow=1&feccol=5&zixioverhead=15&zixiauthen=off&zixisession=test&zixiuser=us
er&aenable=on&asource=MICL&acodec=fdk_aaclc&abitrate=128000&asamplerate=4800
0&aport=8700&apid=120&aptspcr=250&klvenable=off&klvmode=sdi&klvsrc=/dev/gv76
01.0&klvpid=35&klvbrate=1000&authonoff=off&auth_user=user&auth_passwd=passwo
rd&auxonoff=off&filesize=1024M&telopenable=off&teloptext=ENCDEV&teloplocatio
n=top_left&telopcharsize=32&vquality=balanced
StartChannel
Once you start the channel, it will not transmit data until the
video input is detected.
StopChannel
SaveUser
Save current settings to non-volatile memory, so they will be used on the next startup.
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
RestartBoard
PtzContinuousMove
action=PtzContinuousMove&data={"PanTilt":{"x":-0.5,"y":0},"idx":0}
action=PtzContinuousMove&data={"PanTilt":{"x":0.5,"y":0},"idx":0}
action=PtzContinuousMove&data={"PanTilt":{"x":0,"y":1},"idx":0}
PtzStop
action=PtzStop&data={"mode":1,"idx":0}
CameraControl
Only one command can be sent at a time; the list below are the only supported VISCA commands
through the HTTP API. To use VISCA commands that are not listed, usage of the TCP socket can be
used to send those VISCA commands.
API Format:
action=CameraControl&command=visca_command
example:
action=CameraControl&command=dzoom_off
action=CameraControl&command=set_monitor_mode 1080p-59.94
The commands use the same syntax as the serial menu “V” command, as shown below
For the most current list of VISCA commands supported press “V” from the Serial/SSH session of the
Serial Menu.
auto_icr_disable
auto_icr_enable
cam_control_inquiry
cam_custom_recall
cam_custom_reset
cam_custom_set
chroma_get_suppress
chroma_suppress Set Chroma Suppression (0=none, 1 to 3=chroma
supression strength)
clear_if
color_gain Set Color gain (0=60%, 14=200%)
color_get_gain
color_get_hue
color_hue Set Color hue (0=-14 degrees, 14=+14 degrees)
debug_rx
dzoom_combine_mode
dzoom_direct D-Zoom Position (0x00 to 0xeb)
* Enabled during Separate mode
dzoom_off
dzoom_on
dzoom_separate_mode
dzoom_stop
dzoom_super_res
dzoom_tele_var p = 0 (Low) .. 7 (High)
* Enabled during Separate Mode
dzoom_wide_var p = 0 (Low) .. 7 (High)
* Enabled during Separate Mode
dzoom_x1_max
eflip_off
eflip_on
ext1_func_inquiry
ext2_func_inquiry
ext3_func_inquiry
focus_auto
focus_direct focus pos
Min. 0x1000 Over Inf
0x2000 10m
0x3000 5m
0x4000 3.3m
0x5000 2.5m
0x6000 2m
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
0x7000 1.7m
0x8000 1.5m
0x9000 1m
0xa000 50cm
0xb000 30cm
0xc000 15cm
0xd000 6cm
0xe000 1cm
focus_get_mode
focus_get_pos
focus_manual
focus_near_limit focus near limit
Min. 0x1000 Over Inf
0x2000 10m
0x3000 5m
0x4000 3.3m
0x5000 2.5m
0x6000 2m
0x7000 1.7m
0x8000 1.5m
0x9000 1m
0xa000 50cm
0xb000 30cm
0xc000 15cm
0xd000 6cm
0xe000 1cm
focus_stop
focus_tele_std
focus_tele_var p = 0 (Low) .. 7 (High)
focus_toggle
focus_wide_std
focus_wide_var p (0 (Low) .. 7 (High))
get_low_delay_mode Get low delay mode: 0 - normal, 1 - low delay
get_monitor_mode get_monitor_mode: Get video mode of camera output
help
high_sensitivity_off
high_sensitivity_on
icr_mode modes:
auto
on
off
threshold [0-255]
lens_control_inquiry
lens_get_temp
lr_reverse_off
lr_reverse_on
other_inquiry
power_inquiry
power_off
power_on
register_read Read internal register.
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
zoom_get_pos
zoom_stop
zoom_tele_std
zoom_tele_var p = 0 (Low) .. 7 (High)
zoom_wide_std
zoom_wide_var p (0 (Low) .. 7 (High))
SaveCamera
zoom_direct_value
white_balance_mode
color_gain
color_hue
chroma_suppress
wb_manual_rgain_direct
wb_manual_bgain_direct
optical_zoom_only
Possible values: 0, 1
focus_direct_value
Description: Set manual camera focus distance Possible values: 0x1000 to 0xf000
manual_focus
SetIp
local_ip
IPv4 adresss
local_netmask
IPv4 netmask
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
default_gw
local_dnsip
local dnsip2
do_autostart
enc_adv_setting
SetDisplay
disp_std
UpdateTerm
term_mode
term_protocol
term_localport
term_servaddr
term_servport
term_baudrate
term_devicefile
Overlay
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
Add/Update overlay
chn
rgn_idx
type
source
In the case of text overlay this would be the source text for png overlay this is the path to the png on
the encoder. Images must be uploaded to board to be used.
location
This is the location of the overlay. Possible values: 'top_left', 'top_right', 'top_center', 'bottom_left',
'bottom_right', 'bottom_center', 'x,y' (negative numbers not supported for x or y)
char_size
For text overlay this is the character size. Possible values: 16,32,64
layer
This will set the layer for the overly higher numbers will overlay over lower numbers if overlapping.
alpha
OverlayStop
chn
rgn_idx
Dynamic
chn
var
Variable to modify dynamically. Possible values: vratediv, vrate, gop, analog_gain, telop_text,
pip_enable, pip_location, startmulticast, stopmulticast
val
SetSNTP
enable
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
Enable/Disable SNTP.
servers
timezone
SetOnvif
enable
Enable/Disable ONVIF.
fixed_profile_max
SetTermSrvEnable
termserve_remote_enable
SetZFinderEnable
zfinder_enable
SetEncoder
Write encoder settings to active preset. See Python example code for Seting Configuration below
EncoderStatus
To read the result, you need to POST the “stats” control as shown\ in the Python example code below.
StreamStatus
To read the result, you need to POST the “stats” control as shown\ in the Python example code below.
AStreamStatus
To read the result, you need to POST the “stats” control as shown\ in the Python example code below.
SourceStatus
To read the result, you need to POST the “stats” control as shown\ in the Python example code below.
To set the encode configuration per channel the SetEncoder action is used with a post. All variables
Wiki - http://wiki.z3technology.com/
Last update: 2020/03/04 18:45 http_api http://wiki.z3technology.com/doku.php/http_api
should be present or they will be replaced with a defualt that may not be valid for your application.
More than one channel can be set per command. It is recommended you first read the current
settings from the encoder then modify them and send the new settings back as in the Python
example below:
server_url='http://192.168.0.120/cgi-bin/control.cgi'
channel = 1
enc_cfg_json=enc_cfg.json()
enc_cfg_json['vframeratediv'] = 2 #set frame rate divider to 2
new_cfg = {}
new_cfg['action'] = 'SetEncoder'
for key, value in enc_cfg_json.iteritems():
print "key = {} value = {}".format(key,value)
new_idx = "enc_{}_{}".format(channel,key)
print "setting {} to {}".format(new_idx,value)
new_cfg[new_idx] = value
print new_cfg
requests.post(server_url, data=new_cfg)
Reading Statistics
Example output:
{u'status': u'OK',
u'astream_status_str': u'\tChannel 1 Codec fdk_aaclc Frames 8998 +OK',
u'temp_status_str': u'+LENS 39 +FPGA 42 +CPU 42 +OK',
u'ret': u'0',
u'encoder_status_str': u' *** Encode Bitstream Received Statistics ***
From:
http://wiki.z3technology.com/ - Wiki
Permanent link:
http://wiki.z3technology.com/doku.php/http_api
Wiki - http://wiki.z3technology.com/