This is an old revision of the document!
To set a configuration variable, simply perform an HTTP POST to the URL
http:/server_address/cgi-bin/control.cgi
with the body
variable=value
For per-channel configuration items, the varname is written as with Cn_varname,
where n is the channel number.
The response contains a return code in JSON format.
After setting the configuration, you must start or stop the channel
for the settings to take effect.
Python example code for setting configuration:
import requests server_url='http://192.168.81.68/cgi-bin/control.cgi' r = requests.post(server_url, 'C1_enc_port=22222') print r print r.json()
To read configuration variable, simply perform an HTTP POST to the URL
http://server_address/cgi-bin/control.cgi
with the body as given below.
The reponse will be in JSON format, giving the value of each variable.
To read global configuration variables, POST with this body:
ctrl=sys&chn=null
To read encoder channel configuration variables for channel 1, POST with this body:
ctrl=enc&chn=1
To read decoder channel configuration variables for channel 1, POST with this body:
ctrl=dec&chn=1
Python example code for reading configuration:
import requests, json, sys server_url='http://192.168.81.68/cgi-bin/control.cgi' global_cfg = requests.get(server_url, params='ctrl=sys&chn=null') print global_cfg.json() enc_cfg = requests.get(server_url, params='ctrl=enc&chn=1' ) print enc_cfg.json()
sysdevicename=HE4K-01
syspassword=
enc_channels=C1
dec_channels=C1
opmode=enc_ultrahd
opstate=Idle
use_dhcp=on
C1_enc_enable=yes
Description: Global enable for this a/v encoder channel
Possible values: yes, no
C1_enc_vidin=HDMI1
Description: Video input from which encoder will source its video
Possible values: Board-dependent
C1_enc_vbitrate=15000K
Description: Video bitrate in bits per second.
Possible values: A “K” suffix indicates kilobits (thousands of bits/second).
A “M” suffix indicates megabits (millions of bits/second).
Note: In UDP transport stream case, the C1_enc_tsrate should be set
higher than the C1_enc_vbitrate, with at least 15% margin.
C1_enc_frameratediv=1
C1_enc_gopsize=60
C1_enc_vprofile=high
Description: H.264 profile (see https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles for full description)
Possible values: baseline, main, high
C1_enc_maxdelayms=500
C1_enc_interframeinterval=1
C1_enc_audonoff=on
C1_enc_audin=hdmi
C1_enc_transport=rtp
C1_enc_ip=192.168.0.6
C1_enc_port=5004
C1_enc_vpid=220
C1_enc_apid=120
C1_enc_pcrpid=521
C1_enc_pmtpid=31
C1_enc_tsrate=20000k
C1_enc_lowlat=off
C1_enc_audchan1_enable=yes
C1_enc_audchan1_codec=dsp_aaclc
C1_enc_audchan1_brate=128000
C1_enc_audchan1_srate=48000
C1_enc_audchan1_mode=stereo
C1_enc_audchan1_source=hdmi
C1_enc_audchan1_pid=120
C1_enc_audchan1_rtpport=8892
C1_enc_audchan1_ptspcr=250
C1_enc_audchan1_format=adts
Generic actions apply to both encoder and decoder modes.
Python example of updating and reading encoder statistics:
import requests, json, sys server_url='http://192.168.81.68/cgi-bin/control.cgi' requests.post(server_url, 'action=EncoderStatus&chn=1') requests.post(server_url, 'action=StreamStatus&chn=1') requests.post(server_url, 'action=AStreamStatus&chn=1') requests.post(server_url, 'action=SourceStatus&chn=1') print requests.get(server_url, params='ctrl=stats&chn=null').json()