Lingpai encoder HTTP API interface description

  1. Summary and Disclaimer
  2. Design Description
    2.1 Introduction to LPH Protocol
    2.2 Description of the interaction process of the LPH protocol
    2.2.1 Communication interaction process
    2.2.2 LPH protocol API calling process
  3. LPH protocol API description
    3.1 Login request /link/user/lph_login
    3.2 Logout request /link/user/lph_logout
    3.3 Get system state information /link/system/get_sys_state
    3.4 Get system network state /link/system/get_net_state
    3.5 Get HDMI/SDI channel interface status/link/system/get_vi_state
    3.6 Get network configuration information /link/system/get_network
    3.7 Set network configuration /link/system/set_network
    3.8 Get system time /link/system/get_sys_date
    3.9 Set system time /link/system/set_sys_date
    3.10 Get ntp service information /link/system/get_ntpd
    3.11 Set ntp service /link/system/set_ntpd
    3.12 Get video channel encoding information/link/encoder/get_enc_confs
    3.13 Update network input source parameters /link/encoder/set_net_chns
    3.14 Set input source encoding parameters /link/encoder/set_enc_chns
    3.15 Set HDMI/SDI crop and rotate video parameters/link/encoder/set_cap_chns
    2.16 Set audio encoding parameters /link/encoder/set_audio_chns
    3.17 Get video stream output configuration /link/stream/get_stream_confs
    3.18 Set video stream output configuration /link/stream/set_stream_confs
    3.19 Get hls ndi ts configuration information/link/stream/get_hls_ndi_ts
    3.20 Set hls ndi ts configuration information/link/stream/set_hls_ndi_ts
    3.21 Get multi-platform live broadcast configuration information/link/stream/get_platform_lives
    3.22 Set multi-platform live broadcast configuration information/link/stream/set_platform_lives
    3.23 Multi-platform live start /link/stream/start_platform_lives
    3.24 Multi-platform live stop /link/stream/stop_platform_lives
    3.25 Get multi-platform live status /link/stream/get_platform_lives_state
    3.26 Get watermark configuration parameters /link/overlay/get_overlay_confs
    3.27 Set watermark configuration parameters /link/overlay/set_overlay_confs
    3.28 Get all preset layout information /link/layout/get_deflay_confs
    3.29 Get the video layout and mix information used/link/layout/get_layout_confs
    3.30 Video layout switching, audio mixing/link/layout/set_layout_confs
    3.31 Get HDMI, VGA output configuration information/link/output/get_output_confs
    3.32 Set HDMI, VGA output configuration information/link/output/set_output_confs
    3.33 Get recording parameters /link/record/get_record_confs
    3.34 Set global recording parameters /link/record/set_record_confs
    3.35 Start recording /link/record/start_rec
    3.36 Stop recording all /link/record/stop_rec

原文链接:灵派编码器HTTP API接口说明_LinkPi的博客-CSDN博客_灵派编码器

  1. Summary and Disclaimer
    The background of LinkPi encoder is implemented in PHP. If you have customization requirements, you can modify its source code by yourself. For the background source program of LinkPi encoder, see Encoder: 通用编码器源码 - Gitee.com . Some users need to control the encoder in their own server or software written by themselves, which can be done by calling the Lingpai encoder HTTP API interface. For the convenience of discussion, we define the LPH encoder HTTP API interface as the LPH interface .
    Due to product version upgrades or other reasons, the contents of this document will be continuously updated. Unless otherwise agreed, this document is only used as a guide for use, and all statements and suggestions in this document do not constitute any express or implied warranty.

2. Design Description

2.1 Introduction to LPH Protocol

The LPH protocol is an API interface defined on top of HTTP, and its essence still belongs to the HTTP protocol. Based on HTTP, the LPH protocol adds the interactive process of Digest authentication and login authentication.

2.2 Description of the interaction process of the LPH protocol

2.2.1 Communication interaction process

The main differences between the HTTP interaction process with Digest authentication of the LPH command and the standard HTTP interaction process are as follows:


The LPH protocol currently only supports the Digest authentication process, and the default authentication user name and password are both admin.
Next, we use postman as the client to illustrate a communication process. Here we take login (/link/user/lph_login) as an example.
(1) First, we start postman, and open the postman console tool as shown below, and clear the console information

(2) Create a request, the url is /link/usr/lph_login, the request method can be GET/POST, and set the delivery Here, take the GET request as an example, as shown in the figure below

(3) Set the postman Http authentication method, and set the user name and password, as shown in the figure below

(4) Click the Send button to send the request, and then open the postman console tool, you can see 2 The request record, as shown in Figure

5 below, through comparison, we can see that the first time the client sends a request to the server, the server returns 401, and carries the
WWW-Authenticate authentication information in the response header, and the postman client gets the authentication information After that, calculate the Authenticate and add it to the request header, and send it again.

(6) After the server authentication is passed, the request result will be returned, if the following figure

2.2.2 LPH protocol API calling process

Through the example of 2.2.1, it is known that the Authorization header information is required in the communication process, but the request headers other than the login request must not only carry the Authorization information but also the three sets of HASH values ​​obtained by the login, in order for the request to succeed.

Here is a brief description of the interaction process by obtaining video channel information:
(1) To send a request, first log in to the server /link/user/lph_login
(2) After logging in, send /link/encoder/get_channels to obtain video channel information
(3) After obtaining the information logout /link/user/lph_logout

As shown in the figure below, after the login is successful, add 3 HASH values ​​to the request header of the call to get the video channel information interface, and then you can get the correct request result.

3. LPH protocol API description

3.1 Login request /link/user/lph_login

Request Type: GET/POST
parameters

parameter name Field Type Is it mandatory describe
username string Yes The login user name, which is the same as the login web user name
passwd string Yes The login password, which is the same as the login web password, needs to be encrypted with md5 before transmission.

response

{
    "data": {
        "L-HASH": "0b3bb1f7fcdffc5ea1077090b9bbc43314fa4268",
        "P-HASH": "29a07d69a3e5f9b8ef42eee9d5a837af2ff0f403",
        "H-HASH": "9d181efb0c1b606f5a7fef2a45b1385a447794f3"
    },
    "status": "success",
    "msg": "登录成功"
}

3.2 Logout request /link/user/lph_logout

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": "",
    "status": "success",
    "msg": "登出成功"
}

3.3 Get system state information /link/system/get_sys_state

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": {
        "cpu": 17, //cpu百分比使用率
        "mem": 41, //内存百分比使用率
        "temperature": 42 //核心温度,摄氏度
    },
    "status": "success",
    "msg": "执行完成"
}

3.4 Get system network state /link/system/get_net_state

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": {
        "rx": 0, //网络下行
        "tx": 0  //网络上行
    },
    "status": "success",
    "msg": "执行完成"
}

3.5 Get HDMI/SDI channel interface status/link/system/get_vi_state

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": [
        {
            "avalible": true,       //Whether there is hdm/sdi input source access
            "framerate": 50,        //frame rate
            "full": false,
            "height": 1080,         //video high
            "interlace": false,    //whether interlace scanning
            "protocol": "HDMI",    //Input source type
            "samplerate": 48000,   //Audio sample rate
            "width": 1920           //video width
        },
          …………
    ],
    "status": "success",
    "msg": "执行完成"
}

3.6 Get network configuration information /link/system/get_network

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": {
        "ip": "192.168.1.213",
        "mask": "255.255.252.0",    //掩码
        "gateway": "192.168.1.1",   //网关
        "dns": "8.8.8.8",
          "mac": "886570e99627"
        "dhcp": false
    },
    "status": "success",
    "msg": "执行完成"
}

3.7 Set network configuration /link/system/set_network

Request Type: GET/POST
parameters

parameter name Field Type Is it mandatory describe
ip string no ip address
mask string no subnet mask
gateway string no gateway
dns string no dns
dhcp bool no Whether to automatically obtain the ip, when the value is true, other parameters will be ignored

Response
no return value

3.8 Get system time /link/system/get_sys_date

Request Type: GET/POST
parameters

parameter name Field Type Is it mandatory describe
none none none none

response

{
    "data": "2021-11-11 03:37:28",
    "status": "success",
    "msg": "执行完成"
}

3.9 Set system time /link/system/set_sys_date

Request Type: GET/POST
parameters

parameter name Field Type Is it mandatory describe
sysDate string Yes The parameter format is and only is: “yyyy/MM/dd/hh/mm/ss”

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.10 Get ntp service information /link/system/get_ntpd

Request Type: GET/POST
parameters

parameter name Field Type Is it mandatory describe
none none none none

response

{
    "data": {
        "server": "cn.pool.ntp.org",   //ntp server address
        "enable": false                   //Whether to synchronize the time of the ntp server when booting
    },
    "status": "success",
    "msg": "执行完成"
}

3.11 Set ntp service /link/system/set_ntpd

Request Type: GET/POST
parameters

parameter name Field Type Is it mandatory describe
server string no NTP server address, such as cn.pool.ntp.org
enable bool no Whether to synchronize ntp time when booting
sync bool no Whether to synchronize ntp time immediately

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.12 Get video channel encoding information/link/encoder/get_enc_confs

Request Type: GET/POST
parameters

parameter name Field Type Is it mandatory describe
none none none none

response

{
    "data": [
        {
            "id": 0, //channel id
            "name": "HDMI",  //channel name
            "type": "vi",  //channel type,There are 4 kinds of vi usb net mix
            "enable": true,  //Channel master switch, main stream encoding switch
            "enable2": false, //Substream encoding switch
            "encv": {  //Main stream encoding parameters
                "Iqp": 25,  //Iframe quantizer
                "Pqp": 25,  //P帧量化因子
                "bitrate": 4000, //码率 kb/s
                "codec": "h264",  //编码格式
                "framerate": 30, //帧率
                "gop": 2, //gop length
                "gopmode": 0, //HiSilicon gop mode,0--Normal 1--SmarP 2--DualP 3--Bipred
                "height": 1080, //视频高
                "lowLatency": false, //是否低延时编码
                "maxqp": 36, //最大量化因子
                "minqp": 22, //最小量化因子
                "profile": "main", //Code compression method
                "rcmode": "cbr", //rate control
                "width": 1920 //视频宽
            },
            "encv2": {   //Substream parameters, same as encv
                "Iqp": 25,
                "Pqp": 25,
                "bitrate": 1000,
                "codec": "h264",
                "framerate": 30,
                "gop": 1,
                "gopmode": 0,
                "height": 360,
                "lowLatency": false,
                "maxqp": 36,
                "minqp": 22,
                "profile": "high",
                "rcmode": "avbr",
                "width": 640
            },
            "enca": { //Audio encoding parameters
                "audioSrc": "hdmi", //audio source used
                "bitrate": 128, // 码率 kb/s
                "channels": 1,  //Channel 1 stands for mono, 2 stands for stereo
                "codec": "aac",  //audio coding format
                "gain": 6, //sound gain
                "samplerate": 48000 //采样率
            },
            "cap": {  //Video parameters, this attribute is a unique attribute of vi channel (HDMI/SDI), other channels do not exist
                "crop": {
                    "B": 0,  //video below collection,unit pixel
                    "L": 0, //视频左采集,unit pixel
                    "R": 0, //视频右采集,unit pixel
                    "T": 0  //视频上采集,unit pixel
                },
                "deinterlace": false, //Whether to deinterlace the full frame
                "rotate": 0  //Rotation angle
            },
"net": {  //Network input, this property is unique to the net channel, other channels do not exist
                "bufferMode": 0,  //buffer mode
                "decodeA": false,  //Whether to decode audio
                "decodeV": false, //Whether video decoding
                "framerate": -1, //framerate
                "minDelay": 500, //Buffer time, in milliseconds
                "path": "rtsp://192.168.2.182/1", //network stream address
                "protocol": "tcp" //Transfer Protocol
            }
        },
…………
    ],
    "status": "success",
    "msg": "执行完成"
}

3.13 Update network input source parameters /link/encoder/set_net_chns

Request Type: POST
Parameters

Parameter Type describe
string The parameter is a JsonArray string, the example is as follows

Parameter example

[
    {
        "id":2,
        "path":"rtsp://192.168.2.180/1",
        "decodeV":true,
        "enable":true
},
…………
NetObject,
NetObject
]

NetObject object properties are shown in the following table

property name Field Type Is it mandatory describe
id int Yes channel id
name string no channel name
path string no network stream address
bufferMode int no Buffer Mode 0: Normal 1: Real Time 2: Synchronous
minDelay int no Buffer time, in milliseconds
protocol string no Transport protocol, tcp\upd
framerate int no frame rate
decodeV bool no Whether video decoding
decodeA bool no Whether to decode audio
enable bool no Channel master switch, whether to enable streaming
enable2 bool no Whether to enable sub-stream, valid when video decoding is enabled

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.14 Set input source encoding parameters /link/encoder/set_enc_chns

Request Type: POST
Parameters

Parameter Type describe
string The parameter is a JsonArray string, the example is as follows

Parameter example

[
    {
        "id":2,
        "name":"HDMI",
        "enable":true,
        "enable2":false,
        "encv":{
            "width":1920,
            "height":1080,
            "codec":"h264",
            "profile":"main",
            "rcmode":"cbr"
        },
        "encv2":{
            "width":640,
            "height":360        
}
    },
…………
ChnObject
]

The properties of the ChnObject object are shown in the following table

parameter name Field Type Is it mandatory describe
id int Yes channel id
name string no channel name
enable bool no Channel master switch, main stream encoding switch
enable2 bool no Substream encoding switch
encv EncObject no Main stream encoding parameters, object type, properties are shown in the following table
env2 EncObject no Substream encoding parameters, object type, properties are shown in the following table

EncObject

property name Field Type Is it mandatory describe
width int no Video width, when the value is -1, the default width of the input source is used
height int no Video high, when the value is -1, the default high input source is used
codec string no Encoding method, optional value: h264 h265 close
profile string no Encoding compression method, optional value: base main high
rcmode string no rate control, optional value cbr vbr avbr fixqp
bitrate string no Bit rate kb/s
framerate string no frame rate
gop int no gop length
gopmode int no HiSilicon GOP mode, 0–Normal 1–SmarP 2–DualP 3–BipredB
minqp Int no Minimum quantization factor
maxqp int no Maximum quantization factor
Iqp int no I frame quantization factor
why int no P-frame quantization factor
lowLatency bool no Whether low-latency encoding

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.15 Set HDMI/SDI crop and rotate video parameters/link/encoder/set_cap_chns

Request Type: POST
Parameters

Parameter Type describe
string The parameter is a JsonArray string, the example is as follows

Parameter example

[
    {
        "id":2,
        "L":"200",
        "rotate":90,      
    },
…………
CapObject
]

CapObject object properties are shown in the following table

property name Field Type describe
id int channel id
deinterlace bool Whether to deinterlace the full frame
rotate int Video rotation, optional value 0 90 180 270
L int Video ruling left, in pixels
R int Video adjudication right, in pixels
T int Video adjudication, unit pixel
B int Under video adjudication, unit pixel

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

2.16 Set audio encoding parameters /link/encoder/set_audio_chns

Request Type: POST
Parameters

Parameter Type describe
string The parameter is a JsonArray string, the example is as follows

Parameter example

[
    {
        "id":2,
        "codec":"aac",
        " audioSrc":"hdmi",
          " gain":"6"     
    },
…………
AudioObject
]

AudioObject object properties are shown in the following table

property name Field Type describe
id int channel id
codec string Encoding format, optional value aac pcma mp2 mp3 opus close
audioSrc string Audio source, optional value hdmi sdi line
gain int Sound gain, optional value -24 -18 -12 -6 0 6 12 18 24
samplerate int Sampling rate, optional value 16000 32000 44100 48000 -1 (-1 means automatic)
channels int Channel, optional value 1—mono 2—stereo
bitrate int Bit rate kb/s

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.17 Get video stream output configuration /link/stream/get_stream_confs

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": [
        {
            "id": 0,   //通道id
            "name": "HDMI", //通道名称
            "type": "vi",  //通道类型
              "enable": true,  //通道总开关,主码流开关
              "enable2": false,  //子码流开关
            "stream": {  //主码流输出
                "hls": false,  //输出hls流开关
                "http": true,  //输出tsHttp流开关
                "push": {  //推流参数
                    "enable": false,  //是否开启推流
                    "format": "auto", //封装格式
                    "hevc_id": 12, //rtmp输出时,h265数据使用的id号
                    "path": "rtmp://127.0.0.1/live/test_main0" //推流地址
                },
                "rtmp": true, //输出rtmp流开关
                "rtsp": true, //输出rtsp流开关
                "srt": { //srt流参数
                    "enable": false, //是否开启rtsp流
                    "ip": "127.0.0.1", //ip地址
                    "latency": 50, //延时
                    "mode": "listener", //模式
                    "passwd": "", //密码
                    "port": 9001, //端口
                    "streamid": "" // stream id
                },
                "udp": {  //组播参数
                    "bandwidth": 100, //流控最大带宽
                    "enable": false, //是否开启组播
                    "flowCtrl": true, //是否开启流控
                    "ip": "233.233.2.1", //地址
                    "port": 3000,  //端口
                    "rtp": false, //是否增加rtp头
                    "ttl": 5 //ttl
                }
            },
            "stream2": {  //子码流输出,参数主码流输出
                "hls": false,
                "http": true,
                "push": {
                    "enable": false,
                    "format": "auto",
                    "hevc_id": 12,
                    "path": "rtmp://127.0.0.1/live/test_sub0"
                },
                "rtmp": true,
                "rtsp": true,
                "srt": {
                    "enable": false,
                    "ip": "127.0.0.1",
                    "latency": 50,
                    "mode": "listener",
                    "passwd": "",
                    "port": 9101,
                    "streamid": ""
                },
                "udp": {
                    "bandwidth": 100,
                    "enable": false,
                    "flowCtrl": true,
                    "ip": "233.233.3.1",
                    "port": 3000,
                    "rtp": false,
                    "ttl": 5
                }
            }
        },
    …………
    ],
    "status": "success",
    "msg": "执行完成"
}

3.18 Set video stream output configuration /link/stream/set_stream_confs

Request Type: POST
Parameters

Parameter Type describe
string The parameter is a JsonArray string, the example is as follows

Parameter example

[
    {
        "id":0,
        "stream":{
            "hls":true,
            "http": false,
            "rtsp":true,
            "udp":{
                "enable":true
            }
        },
        "stream2":{
            "rtmp":true,
            "http":false,
            "hls":false,
            "push":{
                "enable":true,
                "path":"rtmp://192.168.2.110/live/main"
            },
            "udp":{
                "enable":false
            }
        }
},
ChnObject,
ChnObject,
ChnObject,
…………
]

ChnObject

property name Field Type Is it mandatory describe
id int Yes channel id
stream StreamObject no Main stream output parameters
Stream2 StreamObject no Substream output parameters

StreamObject

property name Field Type Is it mandatory describe
hls bool no whether to output hls stream
http bool no whether to output http stream
rtmp bool no Whether to output rtmp stream
rtsp bool no Whether to output rtsp stream
push PushObject no Push stream configuration parameters
udp UdpObject no udp multicast configuration parameters
srt SrtObject no srt stream configuration parameters

PushObject

property name Field Type Is it mandatory describe
enable bool no Whether to enable push streaming
format string no Package format, the value can be auto flv rtsp rtp mpegts rtp_mpegts
hevc_id int no When rtmp is output, the id number used by h265 data
path string no Push URL

UdpObject

property name Field Type Is it mandatory describe
bandwidth int no Flow control maximum bandwidth, in Mb
enable bool no Whether to enable multicast
flowCtrl bool no Flow control, so that the stream is sent more evenly, preventing packet loss, but consuming some performance
ip string no address
port int no port
rtp bool no whether to add rtp header
ttl int no ttl

SrtObject

property name Field Type Is it mandatory describe
latency int no delay
enable bool no Whether to enable srt stream
mode string no mode, caller listener rendezvous
ip string no address
port int no port
passwd string no password
streamid int no stream id

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.19 Get hls ndi ts configuration information/link/stream/get_hls_ndi_ts

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": [
        {
            "id": 0,   //通道id
            "name": "HDMI", //通道名称
            "type": "vi",  //通道类型
              "enable": true,  //通道总开关,主码流编码是否启用
              "enable2": true,  //子码流编码否启用
            "hls": {
                "hls_base_url": "/hls/",  //url前缀
                "hls_filename": "-%06d.ts",  //文件名后缀
                "hls_list_size": 5,  //列表长度
                "hls_time": 5  //分片长度
            },
            "ndi": {
                "enable": false,  //开关
                "group": "",   //NDI 分组
                "name": "stream0"  //NDI 名称
            },
            "ts": {
                "mpegts_original_network_id": 1, //network id
                "mpegts_pmt_start_pid": 4096, //pmt pid
                "mpegts_service_id": 1, // service id
                "mpegts_start_pid": 100, // pid
                "mpegts_transport_stream_id": 1, //stream id
                "tsSize": 1316  //packet size
            }
        }
    ],
    "status": "success",
    "msg": "执行完成"
}

3.20 Set hls ndi ts configuration information/link/stream/set_hls_ndi_ts

Request Type: POST
Parameters

Parameter Type describe
string The parameter is a JsonArray string, the example is as follows

Parameter example

[
    {
        "id":0,
        "hls":{
            "hls_time":5,
            "hls_list_size":5
        },
        "ndi": {
            "enable":true,
            "name":"stream0"
        },
        "ts": {
            "mpegts_pmt_start_pid":4096,
            "mpegts_original_network_id":1,
            "mpegts_start_pid":100
        }
    }
,
ChnObject,
ChnObject,
ChnObject,
…………
]

ChnObject

property name Field Type Is it mandatory describe
id int Yes channel id
hls HlsObject no hls output parameter
and NdiObject no ndi output parameters
ts TsObject no ts output parameter

HlsObject

property name Field Type Is it mandatory describe
hls_base_url string no url prefix
hls_filename string no File name suffix: such as -%06d.ts
hls_list_size int no m3u8 file fragment list length
hls_time int no Fragment length, in seconds

NdiObject

property name Field Type Is it mandatory describe
enable bool no open close
group string no NDI grouping
name string no NDI name

TsObject

property name Field Type Is it mandatory describe
mpegts_original_network_id int no network id
mpegts_pmt_start_pid int no pmt pid
mpegts_service_id int no service id
mpegts_start_pid int no pid
mpegts_transport_stream_id int no stream id
tsSize int no packet size

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.21 Get multi-platform live broadcast configuration information/link/stream/get_platform_lives

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": {
        "autorun": false,  //是否自动启动
        "srcA": 0,  //音频源
        "srcV": 0,  //视频源
        "url": [
            {
                "des": "直播平台1", //描述
                "enable": true,  //是否开启
                "path": "rtmp://127.0.0.1/live/push1" //推流地址
            },
            {
                "des": "直播平台2",
                "enable": true,
                "path": "rtmp://127.0.0.1/live/push2"            },
            {
                "des": "直播平台3",
                "enable": false,
                "path": "rtmp://127.0.0.1/live/push3"            }
        ]
    },
    "status": "success",
    "msg": "执行完成"
}

3.22 Set multi-platform live broadcast configuration information/link/stream/set_platform_lives

Request Type: POST
Parameters

property name Field Type Is it mandatory describe
autorun bool no Whether to automatically open
srcA int no audio source
srcV int no video source
url array no Address collection, which stores UrlObject objects

UrlObject

property name Field Type Is it mandatory describe
of the string Yes Platform description
enable bool Yes use enable
path string Yes address

Parameter example

{
        "autorun": false,
        "srcA": 0,
        "srcV": 0,
        "url": [
            {
                "des": "直播平台1",
                "enable": true,
                "path": "rtmp://127.0.0.1/live/push1"
            },
            {
                "des": "直播平台2",
                "enable": true,
                "path": "rtmp://127.0.0.1/live/push2"
            },
            {
                "des": "直播平台3",
                "enable": false,
                "path": "rtmp://127.0.0.1/live/push3"
            },
            {
                "des": "直播平台4",
                "enable": false,
                "path": "rtmp://127.0.0.1/live/push4"
            }
        ]
}

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.23 Multi-platform live start /link/stream/start_platform_lives

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": "",
    "status": "success", 
    "msg": "执行完成" //注意:如果没有挂载外部存储设备,会启动录制失败
}

3.24 Multi-platform live stop /link/stream/stop_platform_lives

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": "",
    "status": "success", 
    "msg": "执行完成"
}

3.25 Get multi-platform live status /link/stream/get_platform_lives_state

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": {
        "duration": 243945,  //启动持续时间,单位ms
        "pushing": true, //多平台直播状态
        "speed": [ //每个平台地址的速度,和保存的直播平台是一一对应关系
            2406,  //速度 kb/s
            2406,
            0,
            0
        ]
    },
    "status": "success",
    "msg": "执行完成"
}

3.26 Get watermark configuration parameters /link/overlay/get_overlay_confs

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": [
        {
            "id": 0,  //通道id
            "name": "HDMI",  //通道名称
            "type": "vi",   //通道类型
            "enable": true,  //通道总开关,主码流是否启用
            "enable2": false,  //子码流是否启用
            "overlay": [  //水印参数,下面展示全部6种水印类型,实际中根据设置的类型和参数返回
                {
                      "type": "text", //叠加类型为文本
                      "enable": true, //显示该叠加层
                      "font": "/link/res/font.ttf", //字体文件路径
                      "content": "我是水印", //文字内容,最多支持250个字
                      "x": 0.1, //叠加层坐标[0,1],相对于整个图像
                      "y": 0.136, //同上
                      "scale": 2.2, //文字相对大小,不同的字体表现不同,[0.1,4]
                      "color": "#669900", //文字颜色,RGB
                      "bgColor": "", //文字颜色,RGBA,留空表示透明
                      "alpha": 1, //叠加层透明度
                      "move": -1, //负数向左滚动,正数向右滚动,数值越大速度越快
                      "w":0.515 //叠加层宽度,主要用于限制滚动范围。
                },
                {
                     "type": "time", //叠加类型为时间戳
                        "enable": true, //显示该叠加层
                        "font": "/link/res/font.ttf", //字体文件路径
                        "content": "yyyy年MM月dd日 hh:mm:ss", //时间格式
                        "x": 0.1, //叠加层坐标[0,1],相对于整个图像
                        "y": 0.136, //同上
                        "scale": 2.2, //文字相对大小,不同的字体表现不同,[0.1,4]
                       "color": "#669900", //文字颜色,RGB
                       "bgColor": "", //文字颜色,RGBA,留空表示透明
                       "alpha": 1 //叠加层透明度
                },
                {
                     "type": "pic", //叠加类型为图像
                        "enable": true, //显示该叠加层
                        "content": "/link/res/logo.png", //图片路径
                        "x": 0.1, //叠加层坐标[0,1],相对于整个图像
                        "y": 0.1, //同上
                        "scale": 1, //图片等比缩放倍数,[0.1,4]
                        "alpha": 1 //叠加层透明度
                         //图片也可以增加w、h属性,会导致图片强制拉伸,可能产生比例变化
                },
                {
                    "type": "mask", //叠加类型为马赛克
                       "enable": true, //显示该叠加层
                       "content": "16", //马赛克粒度,8/16/32/64
                       "x": 0.4, //叠加层坐标[0,1],相对于整个图像
                       "y": 0.4, //同上
                       "w": 0.2, //同上
                       "h": 0.2 //同上
                },
                {
                    "type": "border", //叠加类型为边框
                       "x": "0.483", //叠加层坐标[0,1],相对于整个图像
                       "y": "0.508", //同上
                       "h": "0.197", //同上
                       "w": "0.304", //同上
                       "enable": true, //显示该叠加层
                       "color": "#000000", //边框颜色,RGB
                       "alpha": 1, //叠加层透明度
                       "border": 7 //边框宽度,像素
                },
                {
                   "type": "rect", //叠加类型为矩形
                      "x": "0.097", //叠加层坐标[0,1],相对于整个图像
                      "y": "0.104", //同上
                      "h": "0.261", //同上
                      "w": "0.208", //同上
                      "enable": true, //显示该叠加层
                      "color": "#000000", //矩形颜色,RGB
                      "alpha": 1 //叠加层透明度
                }
            ]
        },
          …………
    ],
    "status": "success",
    "msg": "执行完成"
}

3.27 Set watermark configuration parameters /link/overlay/set_overlay_confs

Request Type: POST
Parameters

Parameter Type describe
string The parameter is a JsonArray string, the example is as follows

Parameter example

[
    {
        "id":0,
        "overlay": [
                {
                    "alpha": 1,
                    "color": "#669900",
                    "content": "Overlay Text",
                    "enable": true,
                    "font": "/link/res/font.ttf",
                    "move": -1,
                    "scale": 2.2,
                    "type": "text",
                    "w": 0.515,
                    "x": 0.1,
                    "y": 0.136
                },
                   …………
            ]
    },
ChnObject,
ChnObject,
ChnObject,
…………
]

ChnObject

property name Field Type Is it mandatory describe
id int Yes channel id
overlay array Yes Watermark collection, there are watermark objects in the collection, which can be text watermarks, image watermarks, time watermarks, mosaic watermarks, border watermarks, and rectangular watermarks. There are 6 types of watermarks in total. The 6 types of watermarks can be combined and repeated freely, but the watermarks used in the same video channel The number cannot exceed 8, and the optional parameters for different watermarks are as follows

TextObject (text watermark)

property name Field Type Is it mandatory describe
type string Yes Watermark type, the text watermark type value is text
enable bool Yes whether to show this overlay
font string Yes Absolute path to font file
content string Yes Text content, up to 250 characters
x double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
Y double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
scale double Yes The relative size of the text, different fonts behave differently, [0.1,4]
color string Yes Text color, RGBA, leave blank to indicate transparency, for example: #669900
bgColor string Yes Text background color, RGBA, leave blank to indicate transparency, for example: #669900
move int Yes Negative numbers scroll to the left, positive numbers scroll to the right, 0 is still, the larger the value, the faster the speed
alpha double Yes Overlay Transparency
in double Yes The width of the overlay, mainly used to limit the scrolling range

TimeObject (time watermark)

property name Field Type Is it mandatory describe
type string Yes Watermark type, time watermark type value is time
enable bool Yes whether to show this overlay
font string Yes Absolute path to font file
content string Yes Time format, such as yyyy year MM month dd day hh:mm:ss
x double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
Y double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
scale double Yes The relative size of the text, different fonts behave differently, [0.1,4]
color string Yes Text color, RGBA, leave blank to indicate transparency, for example: #669900
bgColor string Yes Text background color, RGBA, leave blank to indicate transparency, for example: #669900
alpha double Yes Overlay Transparency

PicObject (image watermark)

property name Field Type Is it mandatory describe
type string Yes Watermark type, the image watermark type value is pic
enable bool Yes whether to show this overlay
content string Yes image absolute path
x double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
Y double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
scale double Yes The relative size of the text, different fonts behave differently, [0.1,4]
alpha double Yes Overlay Transparency

MaskObject (mosaic watermark)

property name Field Type Is it mandatory describe
type string Yes Watermark type, the mosaic watermark type value is mask
enable bool Yes whether to show this overlay
content string Yes Mosaic particles, optional values ​​8 16 32 64
x double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
Y double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
in double Yes Overlay width [0,1], relative to the entire image, the upper left corner of the image is [0,0]
h double Yes Overlay height [0,1], relative to the entire image, the upper left corner of the image is [0,0]

BorderObject (border watermark)

property name Field Type Is it mandatory describe
type string Yes The watermark type, the border watermark type value is border
enable bool Yes whether to show this overlay
x double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
Y double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
in double Yes Overlay width [0,1], relative to the entire image, the upper left corner of the image is [0,0]
h double Yes Overlay height [0,1], relative to the entire image, the upper left corner of the image is [0,0]
color string Yes Border color, RGBA, leave blank for transparency Example: #669900
alpha double Yes Overlay Transparency
border int Yes border width, pixels

RectObject (rectangular watermark)

property name Field Type Is it mandatory describe
type string Yes Watermark type, the value of the rectangular watermark type is rect
enable bool Yes whether to show this overlay
x double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
Y double Yes Overlay coordinates [0,1], relative to the entire image, the upper left corner of the image is [0,0]
in double Yes Overlay width [0,1], relative to the entire image, the upper left corner of the image is [0,0]
h double Yes Overlay height [0,1], relative to the entire image, the upper left corner of the image is [0,0]
color string Yes Border color, RGBA, leave blank for transparency Example: #669900
alpha double Yes Overlay Transparency

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.28 Get all preset layout information /link/layout/get_deflay_confs

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": [
        {
            "id": 0,  //布局id 
            "name": "9宫格"  //布局名称
        },
        {
            "id": 1,
            "name": "4分屏"
        },
        {
            "id": 2,
            "name": "1+2"
        },
        {
            "id": 3,
            "name": "画中画"
        },
        {
            "id": 4,
            "name": "单画面"
        },
        {
            "id": 5,
            "name": "上下"
        }
    ],
    "status": "success",
    "msg": "执行完成"
}

3.29 Get the video layout and mix information used/link/layout/get_layout_confs

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": {
        "srcV": [   //视频布局内使用的视频通道id,-1为占位符,表示该位置没有切入任何输入源
            "0",
            "-1",
            "-1",
            "-1"
        ],
        "srcA": [  //音频混音使用的视频通道id
            "0"
        ],
        "curLayId": 1,  //当前正在使用的布局id
        "curLayName": "4分屏"  //当前正在使用的布局名
    },
    "status": "success",
    "msg": "执行完成"
}

3.30 Video layout switching, audio mixing/link/layout/set_layout_confs

Request Type: GET/POST
parameters

property name Field Type Is it mandatory describe
layId int no the layout id to use
srcV array no Video channel ID cut in the layout, “-1” is a placeholder
srcA array no Video channel id used for audio mixing

Parameter example

{
    "layId": 1,  //使用的布局id
    "srcV" : ["1","2","3","-1"], // 切入的视频通道id,-1表示该位置不切入任何输入源
    "srcA" : ["1"]  //音频混音使用的视频通道id
}

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.31 Get HDMI, VGA output configuration information/link/output/get_output_confs

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": {
        "output": {  //HDMI 输出参数
            "enable": false,  // 是否启用HDMI输出
            "lowLatency": false,  //是否开启低延时
            "output": "1080P60",  //输出分辨率
            "rotate": 0, //旋转0 90 180  270
            "src": 6, //输出的视频通道id
            "type": "hdmi", // 类型
            "ui": true //是否输出ui(个人开发的UI程序)
        },
        "output2": { //VGA 输出参数,同HDMI
            "enable": false,
            "lowLatency": false,
            "output": "1080P60",
            "rotate": 0,
            "src": 0,
            "type": "vga",
            "ui": false
        }
    },
    "status": "success",
    "msg": "执行完成"
}

3.32 Set HDMI, VGA output configuration information/link/output/set_output_confs

Request Type: GET/POST
parameters

property name Field Type Is it mandatory describe
output OutObject no HDMI output configuration
output2 OutObject no VGA output configuration

OutObject

property name Field Type Is it mandatory describe
enable bool no Whether to enable output
lowLatency bool no Whether to enable low latency
output string no Output resolution 1080P60 1080I60 1080P50 1080I50 1080P30 720P60 720P50
rotate int no rotate
src int no The video channel id used by the output
ui bool no Whether to output ui (personally developed UI program)

Parameter example

{
    "output": {
        "enable": true,
        "lowLatency": true,
        "output": "1080P60",
        "src": 6
    },
    "output2": {
        "enable": false,
        "lowLatency": false,
        "output": "1080P60",
        "src": 0
    }
}

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.33 Get recording parameters /link/record/get_record_confs

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": {
        "chns": [ //启动录制时,录制的视频通道id
            "0",
            "2"
        ],
        "mp4": true, //是否录制mp4
        "flv": false, //是否录制flv
        "mkv": false, //是否录制mkv
        "mov": false, //是否录制mov
        "ts": false //是否录制ts
    },
    "status": "success",
    "msg": "执行完成"
}

3.34 Set global recording parameters /link/record/set_record_confs

Request Type: GET/POST
parameters

property name Field Type Is it mandatory describe
chns array no Collection of video channel ids to record
mp4 bool no whether to record mp4
flv bool no whether to record flv
mkv bool no whether to record mkv
rice bool no whether to record mov
ts bool no whether to record ts

Parameter example

{
    "chns": [
            "0",
            "2"
        ],
        "mp4": true,
        "flv": true,
        "mkv": false
}

response

{
    "data": "",
    "status": "success",
    "msg": "执行完成"
}

3.35 Start recording /link/record/start_rec

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": "",
    "status": "success", 
    "msg": "执行完成" //注意:如果没有挂载外部存储设备,会启动录制失败
}

3.36 Stop recording all /link/record/stop_rec

Request Type: GET/POST
parameters

parameter name Field Type describe
none none none

response

{
    "data": "",
    "status": "success", 
    "msg": "执行完成"
}