百度智能云

All Product Document

          Multimedia Cloud Processing

          Preset-API Interface

          Create Template

          Interface description

          When the Preset preset by the system cannot satisfy the demand, you can create a custom Preset through this interface.

          Request

          • Request syntax:

            POST /v{version}/preset HTTP/1.1 
            accept-encoding: gzip, deflate 
            x-bce-date: {utc-date-string} 
            connection: keep-alive 
            accept: */* 
            host: media.bj.baidubce.com 
            x-bce-request-id: {bce-request-id} 
            content-type: application/json
            authorization: {bce-authorization-string} 
          • Request header: No special Header parameter
          • Request parameter (the followings are Requestbody parameters):
          Field name Field type Necessity Field description Optional value Default value
          presetName String Required Template name - -
          description String Optional Description of transcoding template; - -
          container String Required Container of audio and video files mp4, flv, hls, mp3, m4a, a-hls, pcm, dash -
          transmux Bool Optional Whether to convert the container format true, false false
          clip Object Optional Whether to capture audio and video clips - -
          + startTimeInSecond Number Optional Start time of video clip - -
          + durationInSecond Number Optional Duration of video clip - -
          audio Object Optional A collection of audio output information, if the audio-related parameters are not set, the transcoding output does not include an audio stream, and if the audio stream is retained, the object must be set - -
          + bitRateInBps Number Optional Audio target code rate (unelectable when the input is pcm, and can be empty when setting mute, or it is required) Greater than 0 -
          + sampleRateInHz Number Optional Audio sampling rate; 22050, 32000, 44100, 48000, 96000 Don’t fill, meaning to keep the same as input.
          + channels Number Optional Audio track count 1, 2 If It is not filled in, it indicates consistence with the input
          + pcmFormat String Optional PCM audio format, which is valid only when container=pcm s16le -
          + volumeAdjust Object Optional Set the volume-related parameters - -
          ++ mute Bool Optional Whether to mute, when mute is set, it is not allowed to have insert of audio type in Job. When mute is set with other audio parameters at the same time, priority shall be given to mute true, false false
          ++ norm Bool Optional Whether to normalize the audio true, false false
          ++ gain Number Optional Volume adjustment, in db; increase the volume if the value is positive -60 ~ 60 -
          video Object Optional A collection of video output information, if the video (video?)-related parameters are not set, the transcoding output does not include a video stream, and if the video stream is retained, the object must be set - -
          + codec String Optional Collection of video coding information h264,h265(H265 only supports main profile), h265_bd265 h264
          + codecOptions Object Optional Configuration options for video coding - -
          ++ profile String Optional Level baseline, main, high baseline
          + bitRateInBps Number Required Target code rate of video - -
          + crf Number Optional Constant quality factor, if crf value is set, bitRateInBps can represent the maximum target code rate. 1 ~ 51 -
          + maxFrameRate Number Optional Maximum frame rate of target video 10,15, 23.97, 24, 25, 29.97, 30, 50, 60 -
          + maxWidthInPixel Number Optional Maximum width of target video 128 ~ 4096 If It is not filled in, it indicates consistence with the original video
          + maxHeightInPixel Number Optional Maximum height of target video 96 ~ 3072 If It is not filled in, it indicates consistence with the original video
          + sizingPolicy String Optional Size shrinking strategy Of keep, shrinkToFit, stretch and shrinkToFitBlur, keep indicates to maintain the width-height ratio of the original video; shrinkToFit indicates to maintain the width-height ratio of the original video and add black edges; stretch indicates to stretch the original video; shrinkToFitBlur is the same as shinkToFit, except the black edges are replaced to Gaussian Blur keep
          + autoAdjustResolution Bool Optional When the original video is a portrait video, it automatically adjusts the template width, making it smaller than the height, to ensure the minimum zoom ratio, and vice versa. You can set it only when sizingPolicy is keep. true,false false
          + playbackSpeed Number Optional The value of playback speed below 1.0 indicates to decelerate the video, and that higher than 1.0 indicates to accelerate the video (the audio settings cannot be assigned at the same time) 0.05 ~ 20.0 -
          encryption Object Optional Collection of encrypted and decrypted HLS information - -
          + strategy String Required Video encryption policy Fixed:It means encryption with a fixed key. Use the key assigned by the user to encrypt the video, and aesKey is required.;
          Open: With an open key, the system will generate an encrypted key automatically, but the key is disclosed, without access control;
          PlayerBinding: Bind a player, the system automatically generates an encrypted key, and the key has access control.;
          The key is set with access control under PlayerBinding mode, with higher security, and it is recommended to use PlayerBinding mode.
          -
          + aesKey String Required AES 128 encryption key - -
          watermarkId String Optional Watermark id(it is allowed to add watermark when transmux = true) - -
          watermarks Object Optional To set multiple watermarks, it is not allowed to specify watermarkId and watermarks at the same time - -
          + image Array Required Multiple watermark watermarkId array The size is 5 at maximum -
          transCfg Object Optional Transcoding configuration information - -
          + transMode String Required Transcoding mode normal, twopass。 When transcoding mode is twopass, video cannot be vacant. -
          extraCfg Object Optional Additional configuration of transcoding
          + watermarkDisableWhitelist String Optional Set the condition without watermark added The portrait can be set currently, meaning no watermarks in the portrait screen videos -
          + segmentDurationInSecond Number Optional Set the partition duration. You can set it only when container is hls, a-hls, dash. The value ranges from 3.0 to 15.0, and the floating-point number accuracy is within three digit after the decimal point -
          + gopLength Number Optional Set gop length (set only when the video parameters are configured; when segmentDurationInSecond and gopLength exist together, it is recommended to guarantee segmentDurationInSecond* original video FPS to be the integral multiples of gopLength) [0, 250],Whereas, 0 indicates that the resulting video contains only frame i. -
          + skipBlackFrame Bool Optional Detect intelligently, and clip the black frame in the title, and intercept the black frame of the first 5s at most true,false false
          • Request example:

            POST /v3/preset HTTP/1.1 
            accept-encoding: gzip, deflate 
            x-bce-date: 2015-03-24T13:08:44Z 
            host: media.bj.baidubce.com 
            accept: */* 
            connection: keep-alive 
            x-bce-request-id: 3807ce30-5264-45f2-9b52-26b78e24a750
            content-type: application/json
            authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2015-03-24T13:08:44Z/1800/host;x-bce-date/7e21c9cf1e4e2cc6921a407a388fe98df122c53b9f509043d841be76eb09a1f9 
            
            { 
                "presetName": "customlized_preset", 
                "description": "A example preset description", 
                "container": "mp4", 
                "clip": { 
                    "startTimeInSecond": 0, 
                    "durationInSecond": 60 
                }, 
                "audio": { 
                    "bitRateInBps": 256000 
                }, 
                "video": { 
                    "codec": "h264", 
                    "codecOptions": { 
                        "profile": "baseline" 
                    }, 
                    "bitRateInBps": 1024000, 
                    "maxFrameRate": 30, 
                    "maxWidthInPixel": 4096, 
                    "maxHeightInPixel": 3072, 
                    "sizingPolicy": "keep", 
                    "playbackSpeed": 1.5 
                }, 
                "watermarkId": "wmk-fekn2ydgq2fe9f1x" 
            } 

          Response

          • Response header: No special Header parameter
          • Response parameter: None
          • Response example:

            HTTP/1.1 200 OK 
            Transfer-Encoding: chunked 
            x-bce-request-id: 3807ce30-5264-45f2-9b52-26b78e24a750
            Cache-Control: no-cache
            Server: BWS 
            Date: Tue, 24 Mar 2015 13:37:10 GMT 
            Content-Type: application/json;charset=UTF-8 

          Query assigned Template

          Interface description

          Query the assigned template information through presetName.

          Request

          • Request syntax:

            GET /v{version}/preset/{presetId} HTTP/1.1 
            accept-encoding: gzip, deflate 
            x-bce-date: {utc-date-string} 
            host: media.bj.baidubce.com 
            accept: */* 
            connection: keep-alive 
            x-bce-request-id: {bce-request-id} 
            content-type: application/json
            authorization: {bce-authorization-string} 
          • Request header: No special Header parameter
          • Request parameter: None
          • Request example:

            GET /v3/preset/bce.video_mp4_1920x1080_3660kbps HTTP/1.1 
            accept-encoding: gzip, deflate 
            x-bce-date: 2015-03-24T13:37:10Z 
            host: media.bj.baidubce.com 
            accept: */* 
            connection: keep-alive 
            x-bce-request-id: 3807ce30-5264-45f2-9b52-26b78e24a750
            content-type: application/json
            authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2015-03-24T13:37:10Z/1800/host;x-bce-date/3e1bf9f50ae1fca2d704d61567810dde946fff3ca2e455676455a6f5c8cce596 

          Response

          • Response header: No special Header parameter
          • Response parameter: Please remain consistent with [Create Templates/Request/Request Parameters], and add the following fields:
          Field name Field type Field description
          state String Template status,ACTIVE/INACTIVE
          createdTime String Time of UTC format for the creation of template
          • Response example:

            HTTP/1.1 200 OK 
            Transfer-Encoding: chunked 
            x-bce-request-id: 3807ce30-5264-45f2-9b52-26b78e24a750
            Cache-Control: no-cache
            Server: BWS 
            Date: Tue, 24 Mar 2015 13:37:10 GMT 
            Content-Type: application/json;charset=UTF-8 
            
            { 
                "state": "ACTIVE", 
                "createdTime": "2015-03-24T13:34:07Z", 
                "presetName": "bce.video_mp4_1920x1080_3660kbps", 
                "description": "A example preset description", 
                "container": "mp4", 
                "clip": { 
                    "startTimeInSecond": 0, 
                    "durationInSecond": 60 
                }, 
                "audio": { 
                    "bitRateInBps": 256000, 
                    "channels": "auto" 
                }, 
                "video": { 
                    "codec": "h264", 
                "codecOptions": { 
                        "profile": "baseline" 
                }, 
                "bitRateInBps": 3660000, 
                "maxFrameRate": 15, 
                "maxWidth": 1920, 
                "maxHeight": 1080, 
                "sizingPolicy": "keep", 
                "playbackSpeed": 1.5 
                }, 
                "watermarkId": "wmk-fekn2ydgq2fe9f1x" 
            } 

          Query Current User’s Templates and All System Templates

          Interface description

          The user queries all the templates provided by the system and his/her account, the specific system templates can see System Built-in Templates

          Request

          • Request syntax:

            GET /v{version}/preset HTTP/1.1 
            accept-encoding: gzip, deflate 
            x-bce-date: {utc-date-string} 
            connection: keep-alive 
            accept: */* 
            host: media.bj.baidubce.com 
            x-bce-request-id: {bce-request-id} 
            content-type: application/json
            authorization: {bce-authorization-string} 
          • Request header: No special Header parameter
          • Request parameter: None
          • Request example:

            GET /v3/preset HTTP/1.1 
            accept-encoding: gzip, deflate 
            x-bce-date: 2015-03-24T13:37:10Z 
            host: media.bj.baidubce.com 
            accept: */* 
            connection: keep-alive 
            x-bce-request-id: 3807ce30-5264-45f2-9b52-26b78e24a750
            content-type: application/json
            authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2015-03-24T13:37:10Z/1800/host;x-bce-date/3e1bf9f50ae1fca2d704d61567810dde946fff3ca2e455676455a6f5c8cce596 

          Response

          • Response header: No special Header parameter
          • Response parameter: Please remain consistent with [Create Templates/Request/Request Parameters], and add the following fields:
          Field name Field type Field description
          state String Template status,ACTIVE/INACTIVE
          createdTime String Time of UTC format for the creation of template
          • Response example:

            HTTP/1.1 200 OK 
            Transfer-Encoding: chunked 
            x-bce-request-id: 3807ce30-5264-45f2-9b52-26b78e24a750
            Cache-Control: no-cache
            Server: BWS 
            Date: Tue, 24 Mar 2015 13:37:10 GMT 
            Content-Type: application/json;charset=UTF-8 
            
            { 
              "presets": [ 
                { 
                  "presetName": "bce.audio_hls_128kbps", 
                  "description": "hls audio,128kbps", 
                  "container": "hls", 
                  "transmux": false, 
                  "clip": { 
                    "startTimeInSecond": 0 
                  }, 
                  "audio": { 
                    "sampleRateInHz": 44100, 
                    "channels": 2 
                  }, 
                  "createTime": "2015-04-07T12:01:08Z" 
                }, 
                { 
                  "presetName": "bce.audio_hls_160kbps", 
                  "description": "hls audio,160kbps", 
                  "container": "hls", 
                  "transmux": false, 
                  "clip": { 
                    "startTimeInSecond": 0 
                  }, 
                  "audio": { 
                    "sampleRateInHz": 44100, 
                    "channels": 2 
                  }, 
                  "createTime": "2015-04-07T12:01:08Z" 
                }, 
                { 
                  "presetName": "bce.audio_hls_64kbps", 
                  "description": "hls audio,64kbps", 
                  "container": "hls", 
                  "transmux": false, 
                  "clip": { 
                    "startTimeInSecond": 0 
                  }, 
                  "audio": { 
                    "sampleRateInHz": 22050, 
                    "channels": 2 
                  }, 
                  "createTime": "2015-04-07T12:01:08Z" 
                }, 
                { 
                  "presetName": "bce.audio_mp3_128kbps", 
                  "description": "mp3 audio,128kbps", 
                  "container": "mp3", 
                  "transmux": false, 
                  "clip": { 
                    "startTimeInSecond": 0 
                  }, 
                  "audio": { 
                    "sampleRateInHz": 44100, 
                    "channels": 2 
                  }, 
                  "createTime": "2015-04-07T12:01:09Z" 
                }, 
                { 
                  "presetName": "bce.audio_mp3_160kbps", 
                  "description": "mp3 audio,160kbps", 
                  "container": "mp3", 
                  "transmux": false, 
                  "clip": { 
                    "startTimeInSecond": 0 
                  }, 
                  "audio": { 
                    "sampleRateInHz": 44100, 
                    "channels": 2 
                  }, 
                  "createTime": "2015-04-07T12:01:09Z" 
                }, 
                { 
                  "presetName": "bce.audio_mp3_192kbps", 
                  "description": "mp3 audio,192kbps", 
                  "container": "mp3", 
                  "transmux": false, 
                  "clip": { 
                    "startTimeInSecond": 0 
                  }, 
                  "audio": { 
                    "sampleRateInHz": 44100, 
                    "channels": 2 
                  }, 
                  "createTime": "2015-04-07T12:01:09Z" 
                }, 
                { 
                  "presetName": "bce.audio_mp3_320kbps", 
                  "description": "mp3 audio,320kbps", 
                  "container": "mp3", 
                  "transmux": false, 
                  "clip": { 
                    "startTimeInSecond": 0 
                  }, 
                  "audio": { 
                    "sampleRateInHz": 44100, 
                    "channels": 2 
                  }, 
                  "createTime": "2015-04-07T12:01:08Z" 
                }, 
                { 
                  "presetName": "bce.audio_mp3_64kbps", 
                  "description": "mp3 audio,64kbps", 
                  "container": "mp3", 
                  "transmux": false, 
                  "clip": { 
                    "startTimeInSecond": 0 
                  }, 
                  "audio": { 
                    "sampleRateInHz": 22050, 
                    "channels": 2 
                  }, 
                  "createTime": "2015-04-07T12:01:09Z" 
                } 
              ] 
            } 

          Delete assigned Template

          Interface description

          Used to delete the user's template with user-assigned presetName

          Request

          • Request syntax:

            DELETE /v{version}/preset/{presetName} HTTP/1.1 
            accept-encoding: gzip, deflate 
            x-bce-date: {utc-date-string} 
            connection: keep-alive 
            accept: */* 
            host: media.bj.baidubce.com 
            x-bce-request-id: {bce-request-id} 
            content-type: application/json
            authorization: {bce-authorization-string} 
          • Request header: No special Header parameter
          • Request parameter: None
          • Request example:

            DELETE /v3/preset/user-video-mp4-1080p-3660kbps HTTP/1.1 
            accept-encoding: gzip, deflate 
            x-bce-date: 2015-03-24T13:06:02Z 
            connection: keep-alive 
            accept: */* 
            host: media.bj.baidubce.com 
            x-bce-request-id: 6d0b0a36-2ffe-49d4-9d81-333a9ab9417e
            content-type: application/json
            authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2015-03-24T13:06:02Z/1800/host;x-bce-date/02f64774999996903cffa5ae4d6eef436127a96f581a4e8467497e239d824be8 

          Response

          • Response header: No special Header parameter
          • Response parameter: None
          • Response example:

            ```http 
            HTTP/1.1 200 OK 
            x-bce-request-id: 6d0b0a36-2ffe-49d4-9d81-333a9ab9417e
            Cache-Control: no-cache
            ```

            ##Update the Assigned Template

          Interface description

          The user can update the assigned Preset through this interface.

          Request

          • Request syntax:

            PUT /v{version}/preset/{presetName} HTTP/1.1 
            accept-encoding: gzip, deflate 
            x-bce-date: {utc-date-string} 
            connection: keep-alive 
            accept: */* 
            host: media.bj.baidubce.com 
            x-bce-request-id: {bce-request-id} 
            content-type: application/json
            authorization: {bce-authorization-string} 
          • Request header: No special Header parameter
          • Request parameter: Same as template creation request
          • Request example:

            PUT /v3/preset/customlized_preset HTTP/1.1 
            accept-encoding: gzip, deflate 
            x-bce-date: 2020-02-14T15:12:37Z 
            host: media.bj.baidubce.com 
            accept: */* 
            connection: keep-alive 
            x-bce-request-id: 0969b91e-1890-470b-b93b-97939f672e54
            content-type: application/json
            authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2020-02-14T15:12:37Z/1800/host;x-bce-date/7e21c9cf1e4e2cc6921a407a388fe98df122c53b9f509043d841be76eb09a1f9 
            
            { 
                "presetName": "customlized_preset", 
                "description": "A example preset description", 
                "container": "mp4", 
                "clip": { 
                    "startTimeInSecond": 0, 
                    "durationInSecond": 60 
                }, 
                "audio": { 
                    "bitRateInBps": 256000 
                }, 
                "video": { 
                    "codec": "h264", 
                    "codecOptions": { 
                        "profile": "baseline" 
                    }, 
                    "bitRateInBps": 1024000, 
                    "maxFrameRate": 30, 
                    "maxWidthInPixel": 4096, 
                    "maxHeightInPixel": 3072, 
                    "sizingPolicy": "keep", 
                    "playbackSpeed": 1.5 
                }, 
                "watermarkId": "wmk-fekn2ydgq2fe9f1x" 
            } 

          Response

          • Response header: No special Header parameter
          • Response parameter: None
          • Response example:

            HTTP/1.1 200 OK 
            Transfer-Encoding: chunked 
            x-bce-request-id: 0969b91e-1890-470b-b93b-97939f672e54
            Cache-Control: no-cache
            Server: BWS 
            Date: Fri, 14 Feb 2020 07:12:37 GMT 
            Content-Type: application/json;charset=UTF-8 
          Previous
          Pipeline Interface
          Next
          MediaInfo-API