Creating an Animated GIF Task
Function
This API is used to create an animated GIF task to convert a complete video file or part of a video file into an animated GIF file. Ensure that an input media file is stored in an OBS bucket in the same region as MPC and the permission for accessing the OBS bucket has been granted to MPC.
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/animated-graphics
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain the project ID, see Obtaining a Project ID . |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
User token The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Authorization |
No |
String |
Authentication information. This parameter is mandatory when AK/SK-based authentication is used. |
X-Project_Id |
No |
String |
Project ID. This parameter is mandatory when AK/SK-based authentication is used. It is same as the project ID in path parameters. |
X-Sdk-Date |
No |
String |
Time when the request is sent. This parameter is mandatory when AK/SK-based authentication is used. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
input |
No |
ObsObjInfo object |
Input file information.
NOTE:
Videos in M3U8 format cannot be converted to animated GIFs, perform synchronous parsing or snapshot capturing. |
output |
No |
ObsObjInfo object |
Output file information |
user_data |
No |
String |
Custom user data |
output_param |
No |
AnimatedGraphicsOutputParam object |
Animated GIF parameter. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
bucket |
Yes |
String |
OBS bucket name |
location |
Yes |
String |
Region where an OBS bucket is located. It must be the same as the region where MPC is deployed. |
object |
Yes |
String |
OBS object path, which complies with the OSS Object definition.
|
file_name |
No |
String |
File name
When it is used as the output file name:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
format |
Yes |
String |
Format of an output file. Currently, only GIF format is supported. |
width |
Yes |
Integer |
Width of an output animated file The value is -1, 0, or a multiple of 2 from 32 to 3,840.
NOTE:
|
height |
Yes |
Integer |
Height of an output animated file The value is -1, 0, or a multiple of 2 from 32 to 2,160.
NOTE:
|
start |
Yes |
Integer |
Start time Unit: ms |
end |
Yes |
Integer |
End time Unit: ms The maximum difference between end and start is 60 seconds. |
frame_rate |
No |
Integer |
Frame rate of the animated GIF. Value range: 1 to 75 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
task_id |
String |
Task ID. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code |
error_msg |
String |
Error description |
Example Requests
Creates an animated GIF task to convert a complete video file or part of a video file into an animated GIF file.
POST https://{endpoint}/v1/{project_id}/animated-graphics { "input" : { "bucket" : "example-bucket", "location" : "region01", "object" : "example-path/input.mp4" }, "output" : { "bucket" : "example-bucket", "location" : "region01", "object" : "example-path/output", "file_name" : "test_mpc.gif" }, "output_param" : { "format" : "gif", "width" : 480, "height" : 360, "frame_rate" : 15, "start" : 100, "end" : 250 } }
Example Responses
Status code: 200
Animated GIF task created successfully.
{ "task_id" : 100211 }
Status code: 400
Failed to create an animated GIF task.
{ "error_code" : "MPC.10202", "error_msg" : "Invalid request parameter." }
Status Codes
Status Code |
Description |
---|---|
200 |
Animated GIF task created successfully. |
400 |
Failed to create an animated GIF task. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot