Audio and Video Processing
Basic Concept
When using BOS as the back-end storage source station, users in the audio-visual industry may often face different usage cases based on the upper business logic. With the continuous optimization of the user experience by business layer, audio-visual business needs a higher and higher level of real-time capability of data processing, treatment and access, and hopes to provide a more simplified way to use.
Thanks to a brand-new audio-visual processing interface within the industry provided by Baidu AI Cloud BOS, files of mp4 format can be uploaded, and then be automatically saved in a system as the hls format to be accessed by players of m3u8 style. Fully meet the use stream ofc "UGC upload-automated processing-playback", eliminating the originally complex video operation processing logic, and speed up the business.
Audio-video Processing Command
Audio and video files, larger than picture files, need longer processing time, usually in seconds. Therefore, the BOS audio and video processing command adopts a write-time processing scheme which is different compared with BOS Photo Processing Interface, that is, the original audio and video file is processed on demand when written to BOS, rather than processing based on the metrics defined when the user reads it.
BOS audio -video processing interface is defined as follows:
- Format conversion parameter
Parameter name | Abbreviation | Type | Value | Request description Required | |
---|---|---|---|---|---|
format | f | string | [hls] | Convert video into specified format. | |
time | t | int | [6,600] | Slicing time by default is 10s. | No |
- Persistent storage parameter
Parameter name | Abbreviation | Type | Value | Request description | Is it required |
---|---|---|---|---|---|
object | o | string | - | The object name, encoded by base64 and subject to object length limit, does not exceed 1,024 characters. | Yes |
Request Method
In the POST interface of BOS, parameters are written in the header format. In that way, the audio-video files, uploaded by POST, are converted and stored based on header requests.
POST /video.mp4 HTTP/1.1
Content-Length: ContentLength
Content-Type: ContentType
x-bce-process: video/format,f_hls
Request Example
Sample of conversion and storage
Convert video.mp4 into hls and store the hls file in video/demo.hls.
POST /video.mp4 HTTP/1.1
Content-Length: ContentLength
Content-Type: ContentType
x-bce-process: video/format, f_hls|system/save, o_dmlkZW8vZGVtby5tM3U4
Rules and Restrictions
Supported specifications:
- Supported original audio-video format: mp4
- Supported target audio-video format: hls
- Current usage available on bj region
- It is currently available only in the bos upload interface of post style.
Currently, only the file conversion from mp4 to hls is available in BOS audio-video processing, but the conversion of other file codes will gradually available in BOS.
For a processing capacity of wider types in the short term and a relatively long processing delay in business side, refer to Baidu AI Cloud Audio-Video Transcoding MCT and Baidu AI Cloud Audio-Video On-Demand VOD.