API | Operation | Description |
Getting the screenshot of media file at some time point | Gets the screenshot of media file at some time point |
public SnapshotResponse generateSnapshot(SnapshotRequest request);
Parameter | Description | Type | Required |
bucketName | String | Yes | |
Input | Media file location information. | Container | Yes |
Time | Screenshot time point in seconds. | Float | Yes |
Output | Screenshot storage location information. | Container | Yes |
Width | Screenshot width. Default value: 0. | Int | No |
Height | Screenshot height. Default value: 0. If Width and Height are both 0 , the width and height of the video are used. If one of them is 0 , the other value is used to automatically adapt to the aspect ratio of the video. | Int | No |
Format | Screenshot format. Valid values: jpg, png. Default value: jpg. | String | No |
Mode | Frame capturing method. keyframe: Capture the last keyframe before the specified time point. exactframe: Capture the frame at a specified time point. Default value: exactframe. | String | No |
Rotate | Image rotation method. auto: Rotate automatically according to the video rotation information. off: Do not rotate. Default value: auto. | String | No |
Input
has the following sub-nodes:Parameter | Parent Node | Description | Type | Required |
Object | Request.Input | Filename | String | Yes |
Output
has the following sub-nodes:Parameter | Parent Node | Description | Type | Required |
Region | Request.Output | Bucket region | String | Yes |
Bucket | Request.Output | File bucket | String | Yes |
Object | Request.Output | Filename | String | Yes |
CosClientException
or CosServiceException
exception. For more information, see Troubleshooting.//1. Create a screenshot request objectSnapshotRequest request = new SnapshotRequest();//2. Add request parameters as detailed in the API documentationrequest.setBucketName("examplebucket-1250000000");request.getInput().setObject("1.mp4");request.getOutput().setBucket("examplebucket-1250000000");request.getOutput().setRegion("ap-chongqing");request.getOutput().setObject("test/1.jpg");request.setTime("15");//3. Call the API to get the screenshot response objectSnapshotResponse response = client.generateSnapshot(request);
Apakah halaman ini membantu?