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
http_api_lua [2017/12/18 23:40]
johnw
http_api_lua [2020/02/18 16:08] (current)
johnw
Line 1: Line 1:
-====== HTTP API ======+====== HTTP API for HE4K-01 / HE4K-R4 / MVE-150 / MVE-100R / SME-01 / DME-02/​03/​04 / SBE264-DVR-23 / BLE264-S4 / BLE264-H4 ​====== 
 + 
 + 
 +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]]
  
  
Line 38: Line 41:
 print r.json() print r.json()
 </​code>​ </​code>​
 +
  
 ==== Reading Configuration ==== ==== Reading Configuration ====
Line 89: Line 93:
 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 142: Line 171:
  
 higher than the C1_enc_vbitrate,​ with at least 15% margin. higher than the C1_enc_vbitrate,​ with at least 15% margin.
 +
  
 ==== C1_enc_frameratediv ==== ==== C1_enc_frameratediv ====
Line 215: Line 245:
  
  
-\\  
 ==== C1_enc_ip ==== ==== C1_enc_ip ====
  
Line 280: Line 309:
  
 Possible values: off, on Possible values: off, on
- 
  
 C1_enc_pcrinterval C1_enc_pcrinterval
Line 301: Line 329:
  
 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. 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 ==== ==== C1_enc_storage ====
  
 Absolute path to mounted media device (e.g. /​media/​sda1/​) Absolute path to mounted media device (e.g. /​media/​sda1/​)
- 
 </​file>​ </​file>​
  
  
 +===== Encoder Audio Configuration =====
  
-===== Encoder Audio Configuration ===== 
  
 ==== C1_enc_audchan1_enable ==== ==== C1_enc_audchan1_enable ====
Line 367: Line 393:
  
  
-\+%%\%% 
 + 
 ==== C1_enc_audchan1_pid ==== ==== C1_enc_audchan1_pid ====
  
Line 377: Line 405:
  
  
-\+%%\%% 
 + 
 ==== C1_enc_audchan1_rtpport ==== ==== C1_enc_audchan1_rtpport ====
  
Line 384: Line 414:
  
  
-\+%%\%% 
 + 
 ==== C1_enc_audchan1_ptspcr ==== ==== C1_enc_audchan1_ptspcr ====
  
  
-Description:​ For transport stream modes only -- intial PTS to PCR offset for audio, in milliseconds+Description:​ For transport stream modes only – intial PTS to PCR offset for audio, in milliseconds
  
  
Line 394: Line 426:
  
  
-\+%%\%% 
 + 
 ==== C1_enc_audchan1_format ==== ==== C1_enc_audchan1_format ====
  
Line 404: Line 438:
  
  
-===== Encoder Text Overlay Configuration (only for DME-02/​03/​04,​ SBE264-01, SBE264-DVR-13) =====+===== Encoder Text Overlay Configuration (only for DME-02/​03/​04,​ SBE264-01, SBE264-DVR-23, BLE264-S4, BLE264-H4) ===== 
  
 ==== C1_enc_ovlglobalalpha ==== ==== C1_enc_ovlglobalalpha ====
 +
  
 Description:​ Global alpha blending setting Description:​ Global alpha blending setting
 +
  
 Possible values: 0 (totally transparent) to 100 (totally opaque) Possible values: 0 (totally transparent) to 100 (totally opaque)
 +
  
 ==== C1_enc_ovltext ==== ==== C1_enc_ovltext ====
 +
  
 Description:​ ASCII Text to draw Description:​ ASCII Text to draw
 +
  
 ==== C1_enc_ovltextenable ==== ==== C1_enc_ovltextenable ====
 +
  
 Description:​ Enable or disable text overlay Description:​ Enable or disable text overlay
 +
  
 Possible values: on, off Possible values: on, off
  
-==== C1_enc_ovltextlocation ==== + 
 +==== C1_enc_ovltextlocation ==== 
  
 Description:​ Set position of overlay text onscreen Description:​ Set position of overlay text onscreen
 +
  
 Possible values: top_left, top_right, top_center, bottom_left,​ bottom_right,​ bottom_center Possible values: top_left, top_right, top_center, bottom_left,​ bottom_right,​ bottom_center
Line 478: Line 523:
     print r.text     print r.text
 </​code>​ </​code>​
 +
  
 ==== StartChannel ==== ==== StartChannel ====
Line 488: Line 534:
 Once you start the channel, it will not transmit data until the\\  Once you start the channel, it will not transmit data until the\\ 
 video input is detected. video input is detected.
 +
  
 ==== StopChannel ==== ==== StopChannel ====
Line 493: Line 540:
  
 Transition the encoder or decoder channel into the stopped state. Transition the encoder or decoder channel into the stopped state.
- 
  
  
 ==== GetStorage ==== ==== GetStorage ====
  
-Reads the device files and mount points of available storage. + 
-The following example shows an SD card device /​dev/​mmcblk0p1 +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 
-mounted at the directory /​media/​mmcblk0p1 +
-and a USB device /dev/sda1 mounted at the directory /media/sda1+
  
 <​code>​ <​code>​
Line 512: Line 557:
 </​code>​ </​code>​
  
-Output: + 
-<​Response [200]> +Output: <​Response [200]> {u'​mounts':​ u'/​dev/​mmcblk0p1 /​media/​mmcblk0p1/,/​dev/​sda1 /​media/​sda1/,',​ u'​ret':​ u'​0'​}
-{u'​mounts':​ u'/​dev/​mmcblk0p1 /​media/​mmcblk0p1/,/​dev/​sda1 /​media/​sda1/,',​ u'​ret':​ u'​0'​}+
  
  
 ==== Dynamic ==== ==== Dynamic ====
 +
  
 Set a dynamic parameter after encoding has already started Set a dynamic parameter after encoding has already started
 +
  
 <​code>​ <​code>​
Line 532: Line 578:
 </​code>​ </​code>​
  
-   vratediv ​   Set video frame rate divider + 
-   ​vrate       Set bitrate +<​code>​ 
-   ​auxfile ​    ​Dynamically start/stop auxfile recording (value is either on or off) +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 545: Line 627:
 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.
 +
  
 ==== StreamStatus ==== ==== StreamStatus ====
Line 554: Line 637:
 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.
 +
  
 ==== AStreamStatus ==== ==== AStreamStatus ====
Line 563: Line 647:
 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.
 +
  
 ==== SourceStatus ==== ==== SourceStatus ====
Line 597: Line 682:
  
 <​code>​ <​code>​
- 
 {u'​astream_status_str':​ u'​Channel 1 Subchannel 1 Codec dsp_aaclc +OK', ​ {u'​astream_status_str':​ u'​Channel 1 Subchannel 1 Codec dsp_aaclc +OK', ​
  ​u'​ret':​ u'​0', ​  ​u'​ret':​ u'​0', ​
Line 609: Line 693:
  ​u'​stream_status_str':​ u'​Channel 1 URL rtp://​192.168.0.6:​5004 Frames 140 +OK'}  ​u'​stream_status_str':​ u'​Channel 1 URL rtp://​192.168.0.6:​5004 Frames 140 +OK'}
 </​code>​ </​code>​
 +
 +
 +\\
 +
http_api_lua.1513640430.txt.gz · Last modified: 2017/12/18 23:40 by johnw