Skip to content

Commit 90061b0

Browse files
authored
Media (#263)
CI
1 parent b4f26cc commit 90061b0

20 files changed

+1403
-47
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/../vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
8+
$cosClient = new Qcloud\Cos\Client(
9+
array(
10+
'region' => $region,
11+
'schema' => 'https', //协议头部,默认为http
12+
'credentials'=> array(
13+
'secretId' => $secretId ,
14+
'secretKey' => $secretKey)));
15+
try {
16+
// 提交动图任务 https://cloud.tencent.com/document/product/436/54001
17+
// start --------------- 使用模版 ----------------- //
18+
$result = $cosClient->createMediaAnimationJobs(array(
19+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
20+
'Tag' => 'Animation',
21+
'QueueId' => 'p81e648af2aee49688xxxxxxxxxxxxxxxx',
22+
'Input' => array(
23+
'Object' => 'video01.mp4'
24+
),
25+
'Operation' => array(
26+
'TemplateId' => 't1de276cbdab16xxxxxxxxxxxxxxxxxxxxx',
27+
'Output' => array(
28+
'Region' => $region,
29+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
30+
'Object' => 'Animation.gif',
31+
),
32+
),
33+
));
34+
// 请求成功
35+
print_r($result);
36+
// end --------------- 使用模版 ----------------- //
37+
38+
// start --------------- 自定义参数 ----------------- //
39+
$result = $cosClient->createMediaAnimationJobs(array(
40+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
41+
'Tag' => 'Animation',
42+
'QueueId' => 'p81e648af2aee49688xxxxxxxxxxxxxxxx',
43+
'Input' => array(
44+
'Object' => 'video01.mp4'
45+
),
46+
'Operation' => array(
47+
'Animation' => array(
48+
'Container' => array(
49+
'Format' => '',
50+
),
51+
'Video' => array(
52+
'Codec' => '',
53+
'Width' => '',
54+
'Height' => '',
55+
'Fps' => '',
56+
'AnimateOnlyKeepKeyFrame' => '',
57+
'AnimateTimeIntervalOfFrame' => '',
58+
'AnimateFramesPerSecond' => '',
59+
'Quality' => '',
60+
),
61+
'TimeInterval' => array(
62+
'Start' => '',
63+
'Duration' => '',
64+
),
65+
),
66+
'Output' => array(
67+
'Region' => $region,
68+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
69+
'Object' => 'Animation.gif',
70+
),
71+
),
72+
));
73+
// 请求成功
74+
print_r($result);
75+
// end --------------- 自定义参数 ----------------- //
76+
} catch (\Exception $e) {
77+
// 请求失败
78+
echo($e);
79+
}

sample/createMediaConcatJobs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'secretId' => $secretId ,
1414
'secretKey' => $secretKey)));
1515
try {
16+
// 提交拼接任务 https://cloud.tencent.com/document/product/436/54013
1617
// start --------------- 使用模版 ----------------- //
1718
$result = $cosClient->createMediaConcatJobs(array(
1819
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket

sample/createMediaJobs.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/../vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
8+
$cosClient = new Qcloud\Cos\Client(
9+
array(
10+
'region' => $region,
11+
'schema' => 'https', //协议头部,默认为http
12+
'credentials'=> array(
13+
'secretId' => $secretId ,
14+
'secretKey' => $secretKey)));
15+
try {
16+
// 多任务接口 https://cloud.tencent.com/document/product/436/58335
17+
$result = $cosClient->CreateMediaJobs(array(
18+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
19+
'Tag' => 'Transcode', // 可选,单一任务时,优先以Operation.Tag为准,当Operation无Tag参数时,该参数生效
20+
'QueueId' => 'paaf4fce5521a40888a303xxxxxxxxxxxxxx',
21+
'CallBack' => '',
22+
'Input' => array(
23+
'Object' => 'example.mp4'
24+
),
25+
'Operation' => array(
26+
array(
27+
'Tag' => 'Transcode',
28+
'TemplateId' => 't04e1ab86554984f1aa17cxxxxxxxxxxxxxx',
29+
'Output' => array(
30+
'Region' => $region,
31+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
32+
'Object' => 'video01.mp4',
33+
),
34+
'WatermarkTemplateId' => array(
35+
't112d18d9b2a9b430e91dxxxxxxxxxxxxxx',
36+
),
37+
),
38+
array(
39+
'Tag' => 'Transcode',
40+
'TemplateId' => 't04e1ab86554984f1aa17xxxxxxxxxxxxxx',
41+
'Output' => array(
42+
'Region' => $region,
43+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
44+
'Object' => 'video02.mp4',
45+
),
46+
'WatermarkTemplateId' => array(
47+
't1bf713bb5c6a5496e859axxxxxxxxxxxxxx',
48+
),
49+
),
50+
),
51+
));
52+
print_r($result);
53+
} catch (\Exception $e) {
54+
// 请求失败
55+
echo($e);
56+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/../vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
8+
$cosClient = new Qcloud\Cos\Client(
9+
array(
10+
'region' => $region,
11+
'schema' => 'https', //协议头部,默认为http
12+
'credentials'=> array(
13+
'secretId' => $secretId ,
14+
'secretKey' => $secretKey)));
15+
try {
16+
// 提交智能封面任务 https://cloud.tencent.com/document/product/436/54017
17+
$result = $cosClient->createMediaSmartCoverJobs(array(
18+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
19+
'Tag' => 'SmartCover',
20+
'QueueId' => 'p81e648afxxxxxxxxxxxxxxxxx',
21+
'Input' => array(
22+
'Object' => 'video01.mp4'
23+
),
24+
'Operation' => array(
25+
'Output' => array(
26+
'Region' => $region,
27+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
28+
'Object' => 'SmartCover-${Number}.jpg',
29+
),
30+
),
31+
));
32+
// 请求成功
33+
print_r($result);
34+
} catch (\Exception $e) {
35+
// 请求失败
36+
echo($e);
37+
}

sample/createMediaSnapshotJobs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'secretId' => $secretId ,
1414
'secretKey' => $secretKey)));
1515
try {
16+
// 提交截图任务 https://cloud.tencent.com/document/product/436/54005
1617
// start --------------- 使用模版 ----------------- //
1718
$result = $cosClient->createMediaSnapshotJobs(array(
1819
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket

sample/createMediaTranscodeJobs.php

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,7 @@
1313
'secretId' => $secretId ,
1414
'secretKey' => $secretKey)));
1515
try {
16-
// 多任务接口
17-
$result = $cosClient->CreateMediaJobs(array(
18-
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
19-
'Tag' => 'Transcode',
20-
'QueueId' => 'paaf4fce5521a40888a3034a5de80f6ca',
21-
'CallBack' => '',
22-
'Input' => array(
23-
'Object' => 'example.mp4'
24-
),
25-
'Operation' => array(
26-
array(
27-
'TemplateId' => 't04e1ab86554984f1aa17c062fbf6c007c',
28-
'Output' => array(
29-
'Region' => $region,
30-
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
31-
'Object' => 'video01.mp4',
32-
),
33-
'WatermarkTemplateId' => array(
34-
't112d18d9b2a9b430e91d3c320f80af341',
35-
),
36-
),
37-
array(
38-
'TemplateId' => 't04e1ab86554984f1aa17c062fbf6c007c',
39-
'Output' => array(
40-
'Region' => $region,
41-
'Bucket' => 'wwj-cq-1253960454', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
42-
'Object' => 'video02.mp4',
43-
),
44-
'WatermarkTemplateId' => array(
45-
't1bf713bb5c6a5496e859aebc4a8973ab5',
46-
),
47-
),
48-
),
49-
));
50-
51-
// 单任务接口
16+
// 提交转码任务 https://cloud.tencent.com/document/product/436/54009
5217
// start --------------- 使用模版 ----------------- //
5318
$result = $cosClient->createMediaTranscodeJobs(array(
5419
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
@@ -64,7 +29,7 @@
6429
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
6530
'Object' => 'video02.mp4',
6631
),
67-
'Watermark' => arrray(
32+
'Watermark' => array(
6833
array(
6934
'Type' => 'Text',
7035
'LocMode' => 'Absolute',
@@ -96,15 +61,6 @@
9661
),
9762
),
9863
));
99-
$result = $cosClient->DescribeMediaJob(array(
100-
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
101-
'Key' => 'j20f7a6be6c5511eca253f3ee9d4082e0',
102-
));
103-
$result = $cosClient->DescribeMediaJobs(array(
104-
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
105-
'Tag' => 'Transcode',
106-
'QueueId' => 'paaf4fce5521a40888a3034a5de80f6ca',
107-
));
10864
// 请求成功
10965
print_r($result);
11066
// end --------------- 使用模版 ----------------- //
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
3+
require dirname(__FILE__) . '/../vendor/autoload.php';
4+
5+
$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
6+
$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
7+
$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
8+
$cosClient = new Qcloud\Cos\Client(
9+
array(
10+
'region' => $region,
11+
'schema' => 'https', //协议头部,默认为http
12+
'credentials'=> array(
13+
'secretId' => $secretId ,
14+
'secretKey' => $secretKey)));
15+
try {
16+
// 提交精彩集锦任务 https://cloud.tencent.com/document/product/436/58337
17+
// start --------------- 使用模版 ----------------- //
18+
$result = $cosClient->createMediaVideoMontageJobs(array(
19+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
20+
'Tag' => 'VideoMontage',
21+
'QueueId' => 'p81e648af2aeexxxxxxxxxxxxxxxxxxx',
22+
'Input' => array(
23+
'Object' => 'video01.mp4'
24+
),
25+
'Operation' => array(
26+
'TemplateId' => 't1fcc3770199e04737axxxxxxxxxxxxxx',
27+
'Output' => array(
28+
'Region' => $region,
29+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
30+
'Object' => 'VideoMontage.mp4',
31+
),
32+
),
33+
));
34+
// 请求成功
35+
print_r($result);
36+
// end --------------- 使用模版 ----------------- //
37+
38+
// start --------------- 自定义参数 ----------------- //
39+
$result = $cosClient->createMediaVideoMontageJobs(array(
40+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
41+
'Tag' => 'VideoMontage',
42+
'QueueId' => 'p81e648af2aeexxxxxxxxxxxxxxxxxxx',
43+
'Input' => array(
44+
'Object' => 'video01.mp4'
45+
),
46+
'Operation' => array(
47+
'VideoMontage' => array(
48+
'Duration' => '',
49+
'Container' => array(
50+
'Format' => '',
51+
),
52+
'Video' => array(
53+
'Codec' => '',
54+
'Width' => '',
55+
'Height' => '',
56+
'Fps' => '',
57+
'Bitrate' => '',
58+
'Crf' => '',
59+
),
60+
'Audio' => array(
61+
'Codec' => '',
62+
'Samplerate' => '',
63+
'Bitrate' => '',
64+
'Channels' => '',
65+
'Remove' => '',
66+
),
67+
),
68+
'Output' => array(
69+
'Region' => $region,
70+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
71+
'Object' => 'VideoMontage.mp4',
72+
),
73+
),
74+
));
75+
// 请求成功
76+
print_r($result);
77+
// end --------------- 自定义参数 ----------------- //
78+
} catch (\Exception $e) {
79+
// 请求失败
80+
echo($e);
81+
}

0 commit comments

Comments
 (0)