User Tools

Site Tools


http_api_lua |

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
http_api_lua [2017/02/17 16:47]
johnw
http_api_lua [2018/08/10 22:21]
rlancaster [HTTP API for HE4K-01 / HE4K-R4 / MVE-150 / MVE-100R / SME-01 / DME-02/03/04]
Line 1: Line 1:
-====== HTTP API ======+====== HTTP API for HE4K-01 / HE4K-R4 / MVE-150 / MVE-100R / SME-01 / DME-02/​03/​04 ​======
  
 +
 +For Camera/​Sensor based products <font 12.8px/​arial;;#​000000;;#​ffffff>​(Z3Cam/​FXXX)</​font>​ and the HE1080/​DME-10 use [[:​http_api|Z3-Camera_Solutions-http_api]]
  
 ===== Configuration API Syntax ===== ===== Configuration API Syntax =====
Line 89: Line 91:
 print enc_cfg.json() print enc_cfg.json()
 </​code>​ </​code>​
 +
 +
 +==== Persistent Configuration ====
 +
 +If you want the current configuration to be saved for future startups,
 +you must explicitly perform the "​SaveUser"​ action.
 +
 +
 +Python example code for saving configuration to persistent storage:
 +
 +<​code>​
 +#! /​usr/​bin/​env python
 +
 +import requests, json, sys
 +from time import sleep
 +
 +
 +server_url='​http://​192.168.81.7/​cgi-bin/​control.cgi'​
 +
 +payload='​action=SaveUser'​
 +r = requests.post(server_url,​ payload)
 +print r
 +print r.json()
 +</​code>​
 +
 +
  
 ===== Global Configuration ===== ===== Global Configuration =====
Line 280: Line 308:
  
 Possible values: off, on Possible values: off, on
 +
 +
 +C1_enc_pcrinterval
 +
 +Description:​ Interval between PCR packets in milliseconds.
 +
 +Possible values: 30 - 100
 +
 +==== C1_enc_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 path to storage is set by the “storage” parameter.
 +
 +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.
 +
 +==== C1_enc_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.
 +
 +
 +==== C1_enc_storage ====
 +
 +Absolute path to mounted media device (e.g. /​media/​sda1/​)
 +
 </​file>​ </​file>​
  
 +
 +
 +===== Encoder Audio Configuration =====
  
 ==== C1_enc_audchan1_enable ==== ==== C1_enc_audchan1_enable ====
Line 372: Line 430:
  
 Possible values: adts Possible values: adts
 +
 +
 +===== Encoder Text Overlay Configuration (only for DME-02/​03/​04,​ SBE264-01, SBE264-DVR-13) =====
 +
 +==== C1_enc_ovlglobalalpha ====
 +
 +Description:​ Global alpha blending setting
 +
 +Possible values: 0 (totally transparent) to 100 (totally opaque)
 +
 +==== C1_enc_ovltext ====
 +
 +Description:​ ASCII Text to draw
 +
 +==== C1_enc_ovltextenable ====
 +
 +Description:​ Enable or disable text overlay
 +
 +Possible values: on, off
 +
 +==== C1_enc_ovltextlocation ==== 
 +
 +Description:​ Set position of overlay text onscreen
 +
 +Possible values: top_left, top_right, top_center, bottom_left,​ bottom_right,​ bottom_center
  
  
Line 440: Line 523:
  
  
 +
 +==== GetStorage ====
 +
 +Reads the device files and mount points of available storage.
 +The following example shows an SD card device /​dev/​mmcblk0p1
 +mounted at the directory /​media/​mmcblk0p1
 +and a USB device /dev/sda1 mounted at the directory /media/sda1
 +
 +<​code>​
 +import requests, json, sys
 +
 +payload='​action=GetStorage'​
 +r = requests.post(server_url,​ payload)
 +print r
 +print r.json()
 +</​code>​
 +
 +Output:
 +<​Response [200]>
 +{u'​mounts':​ u'/​dev/​mmcblk0p1 /​media/​mmcblk0p1/,/​dev/​sda1 /​media/​sda1/,',​ u'​ret':​ u'​0'​}
 +
 +
 +==== Dynamic ====
 +
 +
 +Set a dynamic parameter after encoding has already started
 +
 +
 +<​code>​
 +chn='​1'​
 +variable='​auxfile'​
 +value='​off'​
 +payload='​action=Dynamic&​chn='​ + chn + '&​var='​ + variable + '&​val='​ + value
 +
 +r = requests.post(server_url,​ payload)
 +print r
 +print r.json()
 +</​code>​
 +
 +
 +<​code>​
 +vratediv ​   Set video frame rate divider
 + ​vrate ​      Set bitrate
 + ​auxfile ​    ​Dynamically start/stop auxfile recording (value is either on or off)
 +</​code>​
 +
 +The auxfile command will return a status from the table below.
 +
 +^Auxfile status ^Number |
 +|    VCAP_VENC_ERR_NO_SPACE ​              | -26 |
 +|    VCAP_VENC_ERR_THREAD_ERR ​            | -25 |
 +|    VCAP_VENC_ERR_BAD_MOUNTPOINT ​        | -24 |
 +|    VCAP_VENC_ERR_STOPPING_AUDIO ​        | -23 |
 +|    VCAP_VENC_ERR_MTS_INVALID_DEST ​      | -22 |
 +|    VCAP_VENC_ERR_MTS_BAD_UDP_DEST ​      | -21 |
 +|    VCAP_VENC_ERR_INSUFFICIENT_TS_RATE ​  | -20 |
 +|    VCAP_VENC_ERR_NO_SPARE_MTS_BW ​       | -19 |
 +|    VCAP_VENC_ERR_MTS_START_FAILURE ​     | -18 |
 +|    VCAP_VENC_ERR_MTS_DUPLICATE_DEST ​    | -17 |
 +|    VCAP_VENC_ERR_MTS_DUPLICATE_NAME ​    | -16 |
 +|    VCAP_VENC_ERR_MTS_TEARDOWN_FAILURE ​  | -15 |
 +|    VCAP_VENC_ERR_MTS_NAME_NOT_FOUND ​    | -14 |
 +|    VCAP_VENC_ERR_MTS_CREATE_FAILURE ​    | -13 |
 +|    VCAP_VENC_ERR_MTS_RATE_MISMATCH ​     | -12 |
 +|    VCAP_VENC_ERR_MTS_NO_FREE_INFO ​      | -11 |
 +|    VCAP_VENC_ERR_NOT_IMPLEMENTED ​       | -10 |
 +|    VCAP_VENC_ERR_AUDIO_CAPTURE_SINK ​    | -8 |
 +|    VCAP_VENC_ERR_NO_FREE_AUDIO_STREAM ​  | -7 |
 +|    VCAP_VENC_ERR_VIDEO_FILE_NAME_PARSE ​ | -6 |
 +|    VCAP_VENC_ERR_STREAM_NOT_RUNNING ​    | -5 |
 +|    VCAP_VENC_ERR_STREAM_HAS_CHILDREN ​   | -4 |
 +|    VCAP_VENC_ERR_AUDIO_CAPTURE_SOURCE ​  | -3 |
 +|    VCAP_VENC_ERR_STARTING_AUDIO ​        | -2 |
 +|    VCAP_VENC_ERR_BAD_DESTINATION ​       | -1 |
 +|    VCAP_VENC_SUCCESS ​                   | 0 |
 +|    VCAP_VENC_WARN_ALREADY_STARTED ​      | 1 |
 +
 +
 +\\
  
 ==== EncoderStatus ==== ==== EncoderStatus ====
Line 476: Line 638:
 To read the result, you need to POST the “stats” control as shown\\ ​ To read the result, you need to POST the “stats” control as shown\\ ​
 in the Python example code below. in the Python example code below.
 +
  
 ===== Reading Statistics ===== ===== Reading Statistics =====
http_api_lua.txt · Last modified: 2020/02/18 16:08 by johnw