百度智能云

All Product Document

          Multimedia Cloud Processing

          Thumbnail-Preset-API Interface

          Create a Thumbnail Template

          Interface description

          You can create thumbnail Preset through this interface.

          Request

          • Request syntax:

            POST /v{version}/preset/thumbnail 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 Name of the thumbnail template - -
          description String Optional Thumbnail template description - -
          target Object Optional Collection of the target thumbnail information - -
          + format String Optional Format of the target thumbnail jpg、png、mp4、gif、webp jpg
          + sizingPolicy String Optional Size scaling policy of target thumbnail Of keep, shrinkToFit and stretch, 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 keep
          + widthInPixel Number Optional For the width of the target thumbnail, if the actual resolution of the video is lower than the target one, the actual resolution shall prevail for output 10 ~ 2000 600
          + heightInPixel Number Optional For the height of the target thumbnail, if the actual resolution of the video is lower than the target one, the actual resolution shall prevail for output 10 ~ 2000 450
          + frameRate Number Optional The frame rate of motion graph is optional only when the format is mp4, gif and webp, and the mode is manual and split 0.01 ~ 30.0 3.0
          + gifQuality String Optional The quality of gif is optional only when the format is gif, and the mode is manual and split high, medium medium
          + spriteOutputCfg Object Optional The settings of output parameter of Sprite image are optional only when multiple images are extracted (that is, mode=manual/split), and the output is not a motion graph (https://bce.bdstatic.com/p3m/I18N/images/MCT/API Reference/that is, format=jpg/png-1600671218457.) - -
          ++ rows Number Optional CSS sprites splicing line number 1 ~ 100 10
          ++ columns Number Optional Number of spliced lines in Sprite image 1 ~ 100 10
          ++ margin Number Optional Width of the outline border, with the unit: px 1 ~ 1000 0
          ++ padding Number Optional Width of the outline border, with the unit: px 1 ~ 1000 0
          ++ keepCellPic Bool Optional Whether to retain the original drawing of the subgraph true, false true
          ++ spriteKeyTag String Optional The final file name of the tag in the key of the Sprite uploaded to BOS which is used to mark it as a Sprite is {keyPrefix}+{spriteKeyTag}+{Sprite serial number %05d}, and sub-pictures in the Sprite are arranged in the order in the original video. The length of string ranges from 1 to 100 "-SPRITE-"
          capture Object Optional Rules to generate thumbnail - -
          + mode String Optional Mode to generate thumbnail Of auto, manual, split, shot, idl and highlight mode, the auto mode is to intercept a frame with a high entropy value as a thumbnail by the system automatically; the manual mode is to intercept a thumbnail according to the assigned start and end time as well as interval; the split mode is to intercept a thumbnail according to the assigned start and end time as well as numbers; the shot mode is to intercept frame (it does not support to output video format) automatically according to the scenario switch; the idl mode is to intercept a thumbnail by using Baidu IDL (Institute of Deep Learning) intelligent thumbnail algorithm (it only supports to output jpg, png format); the highlight mode is to generate a 0.5s highlight automatically (currently, it is applicable to short videos with portrait screens, and only outputs video format; it defaults to combined effect of forward and reverse playback) auto
          + frameNumber Number Optional The number of thumbnail generated is optional only when mode=split Greater than or equal to 1 1
          + startTimeInSecond Number Optional The start time to generate thumbnail is optional only when mode=manual or mode=split Greater than or equal to 0 0.0
          + endTimeInSecond Number Optional The end time to generate thumbnail is optional only when mode=manual or mode=split, and it shall not be less than the start time Greater than or equal to 0 Video duration
          + intervalInSecond Number Optional The interval to generate thumbnail is optional only when mode=manual Greater than 0 1.0
          + minIntervalInSecond Number Optional The minimum interval to generate thumbnail is optional only when mode=split Greater than 0 1.0
          + skipBlackFrame Boolean Optional Whether to skip black frames, only selectable when mode=manual or split true/false false
          + highlightOutputCfg Object Optional The output control parameter under highlight mode is optional only when mode=highlight - -
          ++ durationInSecond Number Optional Intercepted clip duration, unit: Second 0.1 ~ 7200.0 0.25
          ++ playbackSpeed Number Optional Playback speed; when the value is less than 1.0, it is decelerated video; when the value is higher than 1.0, it is accelerated video 0.05 ~ 20.0 1.0
          ++ frameRate Number Optional Output video frame rate, with the unit of: fps 0.1 ~ 60.0 11.0
          ++ reverseConcat Bool Optional Effect of combining forward and reverse broadcast true, false true
          • Request example:

            POST /v3/preset/thumbnail 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_thumbnail_preset", 
                "description": "An example thumbnail preset description", 
                "container": "mp4", 
                "state": "ACTIVE", 
                "target": { 
                    "format": "jpg", 
                    "sizingPolicy": "keep", 
                    "widthInPixel": 600, 
                    "heightInPixel": 450 
                }, 
                "capture": { 
                    "mode": "manual", 
                    "startTimeInSecond": 0, 
                    "endTimeInSecond": 1 
                } 
            } 

          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 assigned thumbnail template information through presetName

          Request

          • Request syntax:

            GET /v{version}/preset/thumbnail/{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/thumbnail/customlized_thumbnail_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 Thumbnail 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": "customlized_thumbnail_preset", 
                "description": "A example thumbnail preset description", 
                "target": { 
                "format": "jpg", 
                "sizingPolicy": "keep", 
                "widthInPixel": 600, 
                "heightInPixel": 450 
                }, 
                "capture": { 
                    "mode": "manual", 
                    "startTimeInSecond": 0, 
                    "endTimeInSecond": 1 
                } 
            } 

          Delete the assigned Thumbnail Template

          Interface description

          Used to delete the user's thumbnail template with user-defined presetName

          Request

          • Request syntax:

            DELETE /v{version}/preset/thumbnail/{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/thumbnail/customlized_thumbnail_preset 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/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/thumbnail/{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/thumbnail/customlized_thumbnail_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_thumbnail_preset", 
                "description": "An example thumbnail preset description", 
                "target": { 
                "format": "jpg", 
                "sizingPolicy": "keep", 
                "widthInPixel": 600, 
                "heightInPixel": 450 
                }, 
                "capture": { 
                    "mode": "manual", 
                    "startTimeInSecond": 0, 
                    "endTimeInSecond": 1 
                } 
            } 

          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
          Notification Interface
          Next
          Document Update Record