createMediaSuperResolutionJobs.php 6.5 KB

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