createMediaSegmentVideoBodyJobs.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. require dirname(__FILE__, 2) . '/vendor/autoload.php';
  3. $secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
  4. $secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.cloud.tencent.com/cam/capi
  5. $region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.cloud.tencent.com/cos5/bucket
  6. $cosClient = new Qcloud\Cos\Client(
  7. array(
  8. 'region' => $region,
  9. 'scheme' => 'https', //协议头部,默认为http
  10. 'credentials'=> array(
  11. 'secretId' => $secretId,
  12. 'secretKey' => $secretKey)));
  13. try {
  14. // 提交视频人像抠图任务
  15. // start --------------- 使用模版 暂不支持模版ID ----------------- //
  16. $result = $cosClient->createMediaSegmentVideoBodyJobs(array(
  17. 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
  18. 'Tag' => 'SegmentVideoBody',
  19. 'Input' => array(
  20. 'Object' => 'input/test.mp4',
  21. ),
  22. 'Operation' => array(
  23. 'TemplateId' => '',
  24. 'Output' => array(
  25. 'Region' => $region,
  26. 'Bucket' => 'examplebucket-125000000',
  27. 'Object' => 'output/out.mp4',
  28. ),
  29. // 'UserData' => '',
  30. // 'JobLevel' => '',
  31. ),
  32. // 'CallBack' => '',
  33. // 'CallBackFormat' => '',
  34. // 'CallBackType' => '',
  35. // 'CallBackMqConfig' => array(
  36. // 'MqRegion' => '',
  37. // 'MqMode' => '',
  38. // 'MqName' => '',
  39. // ),
  40. ));
  41. // 请求成功
  42. print_r($result);
  43. // end --------------- 使用模版 ----------------- //
  44. // start --------------- 自定义参数 ----------------- //
  45. $result = $cosClient->createMediaSegmentVideoBodyJobs(array(
  46. 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
  47. 'Tag' => 'SegmentVideoBody',
  48. 'Input' => array(
  49. 'Object' => 'input/test.mp4',
  50. ),
  51. 'Operation' => array(
  52. 'SegmentVideoBody' => array(
  53. 'Mode' => 'Mask',
  54. 'SegmentType' => '',
  55. 'BackgroundGreen' => '',
  56. 'BackgroundBlue' => '',
  57. 'BackgroundLogoUrl' => '',
  58. 'BinaryThreshold' => '',
  59. 'RemoveRed' => '',
  60. 'RemoveGreen' => '',
  61. 'RemoveBlue' => '',
  62. ),
  63. 'Output' => array(
  64. 'Region' => $region,
  65. 'Bucket' => 'examplebucket-125000000',
  66. 'Object' => 'output/out.mp4',
  67. ),
  68. // 'UserData' => '',
  69. // 'JobLevel' => '',
  70. ),
  71. // 'CallBack' => '',
  72. // 'CallBackFormat' => '',
  73. // 'CallBackType' => '',
  74. // 'CallBackMqConfig' => array(
  75. // 'MqRegion' => '',
  76. // 'MqMode' => '',
  77. // 'MqName' => '',
  78. // ),
  79. ));
  80. // 请求成功
  81. print_r($result);
  82. // end --------------- 自定义参数 ----------------- //
  83. } catch (\Exception $e) {
  84. // 请求失败
  85. echo($e);
  86. }