Skip to content

Commit 5408e16

Browse files
authored
Media2 (#266)
* 媒体接口 * 媒体处理
1 parent 40e51ef commit 5408e16

16 files changed

+1290
-0
lines changed

sample/createMediaAnimationJobs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
'Object' => 'Animation.gif',
3131
),
3232
),
33+
'CallBack' => '',
3334
));
3435
// 请求成功
3536
print_r($result);
@@ -69,6 +70,7 @@
6970
'Object' => 'Animation.gif',
7071
),
7172
),
73+
'CallBack' => '',
7274
));
7375
// 请求成功
7476
print_r($result);
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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/65999
17+
$result = $cosClient->createMediaDigitalWatermarkJobs(array(
18+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
19+
'Tag' => 'DigitalWatermark',
20+
'QueueId' => 'p81e648af2aee496885707caxxxxxxxxxxxx',
21+
'Input' => array(
22+
'Object' => 'video01.mp4'
23+
),
24+
'Operation' => array(
25+
'DigitalWatermark' => array(
26+
'Message' => '123456789ab',
27+
'Type' => 'Text',
28+
'Version' => 'V1',
29+
),
30+
'Output' => array(
31+
'Region' => $region,
32+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
33+
'Object' => 'DigitalWatermark.mp4',
34+
),
35+
),
36+
'CallBack' => '',
37+
));
38+
// 请求成功
39+
print_r($result);
40+
} catch (\Exception $e) {
41+
// 请求失败
42+
echo($e);
43+
}
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/66007
17+
$result = $cosClient->createMediaExtractDigitalWatermarkJobs(array(
18+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
19+
'Tag' => 'ExtractDigitalWatermark',
20+
'QueueId' => 'p81e648af2aee496885707caxxxxxxxxx',
21+
'Input' => array(
22+
'Object' => 'DigitalWatermark.mp4'
23+
),
24+
'Operation' => array(
25+
'ExtractDigitalWatermark' => array(
26+
'Type' => 'Text',
27+
'Version' => 'V1',
28+
),
29+
),
30+
'CallBack' => '',
31+
));
32+
// 请求成功
33+
print_r($result);
34+
} catch (\Exception $e) {
35+
// 请求失败
36+
echo($e);
37+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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/67194
17+
// start --------------- 使用模版 ----------------- //
18+
$result = $cosClient->createMediaPicProcessJobs(array(
19+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
20+
'Tag' => 'PicProcess',
21+
'QueueId' => 'pcf4d6d9e5e734asd0as8d09as8d09a8d0',
22+
'Input' => array(
23+
'Object' => 'test01.png'
24+
),
25+
'Operation' => array(
26+
'TemplateId' => 't1648745f76c354e8ad8a09sd890ad80a8d',
27+
'Output' => array(
28+
'Region' => $region,
29+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
30+
'Object' => 'picprocess.jpg',
31+
),
32+
),
33+
'CallBack' => '',
34+
));
35+
// 请求成功
36+
print_r($result);
37+
// end --------------- 使用模版 ----------------- //
38+
39+
40+
// start --------------- 自定义参数 ----------------- //
41+
$result = $cosClient->createMediaPicProcessJobs(array(
42+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
43+
'Tag' => 'PicProcess',
44+
'QueueId' => 'pcf4d6d9e5e734asd0as8d09as8d09a8d0',
45+
'Input' => array(
46+
'Object' => 'test01.png'
47+
),
48+
'Operation' => array(
49+
'PicProcess' => array(
50+
'IsPicInfo' => '',
51+
'ProcessRule' => '',
52+
),
53+
'Output' => array(
54+
'Region' => $region,
55+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
56+
'Object' => 'picprocess.jpg',
57+
),
58+
),
59+
'CallBack' => '',
60+
));
61+
// 请求成功
62+
print_r($result);
63+
// end --------------- 自定义参数 ----------------- //
64+
} catch (\Exception $e) {
65+
// 请求失败
66+
echo($e);
67+
}

sample/createMediaSDRtoHDRJobs.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
// 提交 SDR to HDR 任务 https://cloud.tencent.com/document/product/436/60754
17+
$result = $cosClient->createMediaSDRtoHDRJobs(array(
18+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
19+
'Tag' => 'SDRtoHDR',
20+
'QueueId' => 'p81e648af2aee496885a8d09a8s09d8a0sd6',
21+
'Input' => array(
22+
'Object' => 'video01.mp4'
23+
),
24+
'Operation' => array(
25+
'TranscodeTemplateId' => '',
26+
'WatermarkTemplateId' => '',
27+
'SDRtoHDR' => array(
28+
'HdrMode' => 'HLG',
29+
),
30+
'Output' => array(
31+
'Region' => $region,
32+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
33+
'Object' => 'SDRtoHDR.flv',
34+
),
35+
),
36+
'CallBack' => '',
37+
));
38+
// 请求成功
39+
print_r($result);
40+
} catch (\Exception $e) {
41+
// 请求失败
42+
echo($e);
43+
}

sample/createMediaSegmentJobs.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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/67186
17+
$result = $cosClient->createMediaSegmentJobs(array(
18+
'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
19+
'Tag' => 'Segment',
20+
'QueueId' => 'p81e648af2aee496885707ca0xxxxxxxxx',
21+
'Input' => array(
22+
'Object' => 'video01.mp4'
23+
),
24+
'Operation' => array(
25+
'Segment' => array(
26+
'Format' => 'mkv',
27+
'Duration' => '5',
28+
'HlsEncrypt' => array(
29+
'IsHlsEncrypt' => 'false',
30+
'UriKey' => '',
31+
),
32+
),
33+
'Output' => array(
34+
'Region' => $region,
35+
'Bucket' => 'examplebucket-125000000',
36+
'Object' => 'Segment-trans${Number}.mkv',
37+
),
38+
),
39+
'CallBack' => '',
40+
));
41+
// 请求成功
42+
print_r($result);
43+
} catch (\Exception $e) {
44+
// 请求失败
45+
echo($e);
46+
}

sample/createMediaSmartCoverJobs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
'Object' => 'SmartCover-${Number}.jpg',
2929
),
3030
),
31+
'CallBack' => '',
3132
));
3233
// 请求成功
3334
print_r($result);

0 commit comments

Comments
 (0)