createMediaSuperResolutionJobs.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. // 提交超分辨率任务 https://cloud.tencent.com/document/product/436/67210
  15. // start --------------- 使用模版 ----------------- //
  16. $result = $cosClient->createMediaSuperResolutionJobs(array(
  17. 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
  18. 'Tag' => 'SuperResolution',
  19. 'Input' => array(
  20. 'Object' => 'video01.mp4'
  21. ),
  22. 'Operation' => array(
  23. 'TemplateId' =>'t19ea5e0c0b7054d7b904axxxxxxxxxxx',
  24. 'TranscodeTemplateId' =>'t0b612860a293f41078xxxxxxxxxxx',
  25. 'WatermarkTemplateId' =>'t185e2e24551b24259a02xxxxxxxxxxx',
  26. 'DigitalWatermark' => array(
  27. 'Message' => 'xxx',
  28. 'Type' => 'Text',
  29. 'Version' => 'V1',
  30. 'IgnoreError' => 'true',
  31. ),
  32. 'Output' => array(
  33. 'Region' => $region,
  34. 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
  35. 'Object' => 'SuperResolution.flv',
  36. ),
  37. // 'UserData' => 'xxx', // 透传用户信息
  38. // 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
  39. ),
  40. 'CallBack' => '',
  41. ));
  42. // 请求成功
  43. print_r($result);
  44. // end --------------- 使用模版 ----------------- //
  45. // start --------------- 自定义参数 ----------------- //
  46. $result = $cosClient->createMediaSuperResolutionJobs(array(
  47. 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
  48. 'Tag' => 'SuperResolution',
  49. 'Input' => array(
  50. 'Object' => 'video01.mp4'
  51. ),
  52. 'Operation' => array(
  53. 'SuperResolution' => array(
  54. 'Resolution' => '',
  55. 'EnableScaleUp' => '',
  56. ),
  57. 'Transcode' => array(
  58. 'Tag' => '',
  59. 'Name' => '',
  60. 'Container' => array(
  61. 'Format' => '',
  62. ),
  63. 'Video' => array(
  64. 'Codec' => '',
  65. 'Width' => '',
  66. 'Height' => '',
  67. 'Fps' => '',
  68. 'Remove' => '',
  69. 'Profile' => '',
  70. 'Bitrate' => '',
  71. 'Crf' => '',
  72. 'Gop' => '',
  73. 'Preset' => '',
  74. 'Bufsize' => '',
  75. 'Maxrate' => '',
  76. 'HlsTsTime' => '',
  77. 'Pixfmt' => '',
  78. 'LongShortMode' => '',
  79. ),
  80. 'TimeInterval' => array(
  81. 'Start' => '',
  82. 'Duration' => '',
  83. ),
  84. 'Audio' => array(
  85. 'Codec' => '',
  86. 'Samplerate' => '',
  87. 'Bitrate' => '',
  88. 'Channels' => '',
  89. 'Remove' => '',
  90. 'KeepTwoTracks' => '',
  91. 'SwitchTrack' => '',
  92. 'SampleFormat' => '',
  93. ),
  94. 'TransConfig' => array(
  95. 'AdjDarMethod' => '',
  96. 'IsCheckReso' => '',
  97. 'ResoAdjMethod' => '',
  98. 'IsCheckVideoBitrate' => '',
  99. 'VideoBitrateAdjMethod' => '',
  100. 'IsCheckAudioBitrate' => '',
  101. 'AudioBitrateAdjMethod' => '',
  102. 'DeleteMetadata' => '',
  103. 'IsHdr2Sdr' => '',
  104. 'HlsEncrypt' => array(
  105. 'IsHlsEncrypt' => '',
  106. 'UriKey' => '',
  107. ),
  108. ),
  109. ),
  110. 'Watermark' => array(
  111. 'Type' => '',
  112. 'Pos' => '',
  113. 'LocMode' => '',
  114. 'Dx' => '',
  115. 'Dy' => '',
  116. 'StartTime' => '',
  117. 'EndTime' => '',
  118. 'Image' => array(
  119. 'Url' => '',
  120. 'Mode' => '',
  121. 'Width' => '',
  122. 'Height' => '',
  123. 'Transparency' => '',
  124. 'Background' => '',
  125. ),
  126. 'Text' => array(
  127. 'FontSize' => '',
  128. 'FontType' => '',
  129. 'FontColor' => '',
  130. 'Transparency' => '',
  131. 'Text' => '',
  132. ),
  133. ),
  134. 'DigitalWatermark' => array(
  135. 'Message' => '',
  136. 'Type' => '',
  137. 'Version' => '',
  138. 'IgnoreError' => '',
  139. ),
  140. 'Output' => array(
  141. 'Region' => $region,
  142. 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket
  143. 'Object' => 'SuperResolution.flv',
  144. ),
  145. // 'UserData' => 'xxx', // 透传用户信息
  146. // 'JobLevel' => '0', // 任务优先级,级别限制:0 、1 、2。级别越大任务优先级越高,默认为0
  147. ),
  148. 'CallBack' => '',
  149. ));
  150. // 请求成功
  151. print_r($result);
  152. // end --------------- 自定义参数 ----------------- //
  153. } catch (\Exception $e) {
  154. // 请求失败
  155. echo($e);
  156. }