This set of interfaces realizes the uploading and management of video resources, and provides support for video transcoding and publishing.
The uploaded video files on the server, after transcoding, form an online video resource that can be broadcast externally.
This section describes the interface for file upload and management, and the Transcoding interface is described in the next section.
-
13.1. File Upload Interface
purpose
Upload a video file via the HTTP POST protocol. The file upload interface is a special interface, and the interface location differs from other interfaces. The
Upload protocol uses the HTTP POST protocol, and the data that submits the form is Multipart/form-data encoded (enctype= "Multipart/form-data").
There are detailed specifications here (usually you don't need to read this document for Web development):
rfc1867 http://www.ietf.org/rfc/rfc1867.txt
for apps that use web page uploads, Using a typical form to submit an upload file, the data submission address is set to this interface address.
Request
http://host/upload?app=g3_video&sub_path=&file_name=&token=abcd& FIELD_NAME=FIELD_ABCD
Where:
http://host/upload is the upload location and remains the same. Replace host with the actual streaming server IP address or domain name.
Parameter:
app=g3_video , which means that the video file is uploaded and remains intact.
Sub_path indicates which subdirectory to upload to, if omitted to be uploaded under user root .
file_name The file name to be saved on the server if the file is uploaded, omitted if it is identical to the upload file name. This parameter provides an opportunity to rename an uploaded file on the server. The file name should be UTF-8 encoded. The
token has the same meaning as any other interface.
response
{"code": 0}
13.2. query file List Interface
Purpose
Query the list of video files under a directory on the server.
Request
filemgr/?request=list_files&subpath=&page=1
Sub_path A subdirectory of the file that corresponds to the Sub_path parameter when uploading the file. If omitted, the file under user root is queried. The
page page number, which supports paged queries and paging information in the returned data.
Response
{"Code": 0, "data": {"page": "1", "page_size": ".", "pages": "1", "Total": "1", "Count": 1, "items": [{ "FileName": "Case video 8.mp4", "Mtime": "2018-01-12 12:43", "Size": "3153954", "CharSet": "utf- 8 "," timestamp ": 1515732410," Is_media ": 1," duration ": 98," bitrate ": 255309, "Stream_number": 2, "timestamp_m": 1515397208, "streams": [{ "Index": "0", "type": "Video", "Codec": "H264", "Pic_width": 640, "Pic_height": 352, "bitrate": 208980, "duration": 98, "pix_fmt": "yuv420p", "frame_rate": "28/1" }, {"Index": "1", "type": "Audio", "Codec": "AAC"," LAN ":" und "," channels ": 1," bitrate ": 43970, "duration": 98, "Sample_rate": 44100}] }] }}
The
Return data contains paging information, which is queried by page when the file size is large. The
Items element contains 0 or more file information. The streams element is the audio and video stream information contained in the file, a multimedia file containing 1 to multiple audio and video streams
filename filename, the returned filename is always UTF-8 encoded
CharSet The filename is encoded in the character set on the server, and the ellipsis is UTF-8 encoding. If the encoding is non-UTF-8, in subsequent interfaces, bring the property into the
mtime file Last modified
size file size, in bytes
Duration file broadcast duration, units per second
bitrate composite bitrate, Unit bps
stream_number file contains the total number of audio and video streams
streams element :
streams contains 0 or more audio and video streams, attributes: Index number of the
index Stream, In the Transcoding interface, in the case of a multi-lingual audio stream, you can select the specified audio stream by passing in the audio stream index number.
Type video or audio, corresponding to video, audio
codec stream encoding format, such as H264 encoding, AAC encoding, etc.
Bitrate stream bit rate, Unit bps
pix_fmt video frame format
frame_rate frame rate
pic_ Width video frame width
pic_height video frame height
LAN Audio language information, language code abbreviation
Channels number of audio channels
sample_rate audio sample rate
-
13.3. Query the file directory interface
Purpose
Query the file directory on the server.
Request a subdirectory of
filemgr/?request=list_dirs&subpath=
sub_path file, if omitted, The file directory under user root is queried.
Response
{"code": 0, "data": {"Count": 2, "items": [{"filename": "Auto", "Mtime": "2018-0 1-06 16:36 "," Size ":" 4096 "," timestamp ": 0," Auto_transcode ": 1}, { "FileName": "Audio", "Mtime": "2017-12-27 18:09", "Size": "4096", "timestamp": 0, "Auto_transcode": 0}] }}
The items element contains 0 or more directory information.
filename directory name
mtime Last modified time
Auto_transcode If the automatic transcoding task is set for this directory, 1 means that there is an automatic transcoding task
13.4. Query the file information interface
Purpose
Query information for a video file on the server.
Request
filemgr/?request=get_file&filename= case video 8.mp4&charset=utf-8
FileName file name, if in a subdirectory, should contain a complete relative directory, such as Mypath/myfile.mp4, with UTF-8 encoding
CharSet The actual character set encoding of the file name on the server, which is returned in the Query file list interface.
Response
{"Code": 0, "data": {"Count": 1, "items": [{"filename": "/Case Video 8.mp4", "CharSet": "UTF-8", "Mtime": 1515732213, "size": 3153954, "timestamp": 1516941450, "Is_media": 1, "duration": 98, "bitrate": 255309, "Stream_number": 2, "timestamp_m": 1515397208, "Streams": [{"index": "0", "type": "Video", " Codec ":" H264 "," Pic_width ": 640," Pic_height ": 352," bitrate ": 20898 0, "duration": 98, "pix_fmt": "yuv420p", "frame_rate": "28/1" }, {"Index": "1", "type": "Audio", "codec" : "AAC", "LAN": "und", "channels": 1, "bitrate": 43970, "duration": 98, "Sample_rate": 44100}]}]}}
Returns information for a file that contains multimedia information.
The description of the file information for the returned data is the same as the description of the file information in the query file list interface .
- 13.5. Delete the file interface
Use
Delete the files on the server.
Request
Filemgr/?request=remove&filename=myvideo.mp4&charset=ascii
filename, if in a subdirectory, should contain a complete relative directory, such as Mypath/myfile.mp4, with the file name UTF-8 encoded
CharSet The actual character set encoding of the file name on the server, which is returned in the Query file list interface.
Response{"code":0}
Interface Specification 13. File upload and management related interfaces