This document provides an overview of APIs and SDK code samples for animated image job submission.
API | Description |
---|---|
Submitting animated image job | Submits animated image job |
This API is used to submit an animated image job.
public Guzzle\Service\Resource\Model createMediaAnimationJobs(array $args = array());
<?php
require dirname(__FILE__) . '/../vendor/autoload.php';
$secretId = "SECRETID"; // Replace it with your real `secretId`, which can be viewed and managed in the CAM console at https://console.intl.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; // Replace it with your real `secretKey`, which can be viewed and managed in the CAM console at https://console.intl.cloud.tencent.com/cam/capi
$region = "ap-beijing"; // Replace it with your real region information, which can be viewed in the console at https://console.intl.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // Protocol header, which is `http` by default
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createMediaAnimationJobs(array(
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.intl.cloud.tencent.com/cos5/bucket
'Tag' => 'Animation',
'QueueId' => 'p81e648af2aee49688xxxxxxxxxxxxxxxx',
'Input' => array(
'Object' => 'video01.mp4'
),
'Operation' => array(
'TemplateId' => 't1de276cbdab16xxxxxxxxxxxxxxxxxxxxx',
'Output' => array(
'Region' => $region,
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.intl.cloud.tencent.com/cos5/bucket
'Object' => 'Animation.gif',
),
),
));
// Request successful
print_r($result);
} catch (\Exception $e) {
// Request failed
echo($e);
}
<?php
require dirname(__FILE__) . '/../vendor/autoload.php';
$secretId = "SECRETID"; // Replace it with your real `secretId`, which can be viewed and managed in the CAM console at https://console.intl.cloud.tencent.com/cam/capi
$secretKey = "SECRETKEY"; // Replace it with your real `secretKey`, which can be viewed and managed in the CAM console at https://console.intl.cloud.tencent.com/cam/capi
$region = "ap-beijing"; // Replace it with your real region information, which can be viewed in the console at https://console.intl.cloud.tencent.com/cos5/bucket
$cosClient = new Qcloud\Cos\Client(
array(
'region' => $region,
'schema' => 'https', // Protocol header, which is `http` by default
'credentials'=> array(
'secretId' => $secretId ,
'secretKey' => $secretKey)));
try {
$result = $cosClient->createMediaAnimationJobs(array(
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.intl.cloud.tencent.com/cos5/bucket
'Tag' => 'Animation',
'QueueId' => 'p81e648af2aee49688xxxxxxxxxxxxxxxx',
'Input' => array(
'Object' => 'video01.mp4'
),
'Operation' => array(
'Animation' => array(
'Container' => array(
'Format' => '',
),
'Video' => array(
'Codec' => '',
'Width' => '',
'Height' => '',
'Fps' => '',
'AnimateOnlyKeepKeyFrame' => '',
'AnimateTimeIntervalOfFrame' => '',
'AnimateFramesPerSecond' => '',
'Quality' => '',
),
'TimeInterval' => array(
'Start' => '',
'Duration' => '',
),
),
'Output' => array(
'Region' => $region,
'Bucket' => 'examplebucket-1250000000', // Bucket name in the format of `BucketName-Appid`, which can be viewed in the COS console at https://console.intl.cloud.tencent.com/cos5/bucket
'Object' => 'Animation.gif',
),
),
));
// Request successful
print_r($result);
} catch (\Exception $e) {
// Request failed
echo($e);
}
Request
has the following sub-nodes:
Node Name (Keyword) | Parent Node | Description | Type | Required |
---|---|---|---|---|
Tag | Request | Job type. Valid values: Transcode (transcoding), Animation (animated image), SmartCover (intelligent thumbnail), Snapshot (screenshot), Concat (splicing) | String | Yes |
Input | Request | Information of the media file to be processed | Container | Yes |
Operation | Request | Operation rule. Up to six operation rules are supported. | Container | Yes |
QueueId | Request | Queue ID of the job | String | Yes |
CallBack | Request | Callback address | String | No |
Input
has the following sub-nodes:
Node Name (Keyword) | Parent Node | Description | Type | Required |
---|---|---|---|---|
Object | Request.Input | Media filename | String | Yes |
Operation
has the following sub-nodes:
Node Name (Keyword) | Parent Node | Description | Type | Required |
---|---|---|---|---|
Animation | Request.Operation | Job type parameter | Container | No |
TemplateId | Request.Operation | Template ID | String | No |
Output | Request.Operation | Result output address | Container | Yes |
Note:
TemplateId
is used with priority. IfTemplateId
is unavailable, the corresponding job type parameter is used.
Animation
has the following sub-nodes:
Node Name (Keyword) | Parent Node | Description | Type | Required |
---|---|---|---|---|
Container | Request.Operation.Animation | Same as Request.Container in the animated image template creation API CreateMediaTemplate . |
Container | No |
Video | Request.Operation.Animation | Same as Request.Video in the animated image template creation API CreateMediaTemplate . |
Container | No |
TimeInterval | Request.Operation.Animation | Same as Request.TimeInterval in the animated image template creation API CreateMediaTemplate . |
Container | No |
Output
has the following sub-nodes:
Node Name (Keyword) | Parent Node | Description | Type | Required |
---|---|---|---|---|
Region | Request.Operation.Output | Bucket region | String | Yes |
Bucket | Request.Operation.Output | Result storage bucket | String | Yes |
Object | Request.Operation.Output | Output result filename | String | Yes |
GuzzleHttp\Command\Result Object
(
[Body] => GuzzleHttp\Psr7\Stream Object
(
[stream:GuzzleHttp\Psr7\Stream:private] => Resource id #88
[size:GuzzleHttp\Psr7\Stream:private] =>
[seekable:GuzzleHttp\Psr7\Stream:private] => 1
[readable:GuzzleHttp\Psr7\Stream:private] => 1
[writable:GuzzleHttp\Psr7\Stream:private] => 1
[uri:GuzzleHttp\Psr7\Stream:private] => php://temp
[customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
(
)
)
[RequestId] => NjI2MTQHOAIHDOIDUOIA7879ADJOIMDc2YTk=
[ContentType] => application/xml
[ContentLength] => 797
[Bucket] => examplebucket-1250000000
[Location] => examplebucket-1250000000.ci.ap-beijing.myqcloud.com/jobs
[Response] => Array
(
[JobsDetail] => Array
(
[Code] => Success
[CreationTime] => 2022-04-21T19:29:36+0800
[EndTime] => -
[Input] => Array
(
[BucketId] => examplebucket-1250000000
[Object] => video01.mp4
[Region] => ap-beijing
)
[JobId] => j5318zx9c890zx8c0z98c0fa6355174de
[Message] =>
[Operation] => Array
(
[Output] => Array
(
[Bucket] => examplebucket-1250000000
[Object] => Animation.gif
[Region] => ap-beijing
)
[TemplateId] => t1de276cbdz78xcz09xc80zx901af71
[TemplateName] => Animation-gif-1
)
[QueueId] => p81e648af2aeez87c6z78xc7z98xc79ca86
[StartTime] => -
[State] => Submitted
[Tag] => Animation
)
)
)
Was this page helpful?