|
| 1 | +<?php |
| 2 | + |
| 3 | +require dirname(__FILE__, 2) . '/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/460/84775 |
| 17 | + // start --------------- 使用模版 ----------------- // |
| 18 | + $result = $cosClient->createMediaVideoEnhanceJobs(array( |
| 19 | + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket |
| 20 | + 'Tag' => 'VideoEnhance', |
| 21 | + 'Input' => array( |
| 22 | + 'Object' => 'test.mp4', |
| 23 | + ), |
| 24 | + 'Operation' => array( |
| 25 | + 'TemplateId' => '', // 画质增强模板 ID |
| 26 | + 'Output' => array( |
| 27 | + 'Region' => $region, |
| 28 | + 'Bucket' => 'examplebucket-125000000', |
| 29 | + 'Object' => 'tmp/output.mp4', |
| 30 | + ), |
| 31 | +// 'UserData' => 'xxx', |
| 32 | +// 'JobLevel' => '0', |
| 33 | +// 'WatermarkTemplateId' => array( |
| 34 | +// 'WatermarkTemplateId-1', |
| 35 | +// 'WatermarkTemplateId-2', |
| 36 | +// ), |
| 37 | +// 'Watermark' => array( |
| 38 | +// array( |
| 39 | +// 'Type' => '', |
| 40 | +// 'Pos' => '', |
| 41 | +// 'LocMode' => '', |
| 42 | +// 'Dx' => '', |
| 43 | +// 'Dy' => '', |
| 44 | +// 'StartTime' => '', |
| 45 | +// 'EndTime' => '', |
| 46 | +// 'Image' => array( |
| 47 | +// 'Url' => '', |
| 48 | +// 'Mode' => '', |
| 49 | +// 'Width' => '', |
| 50 | +// 'Height' => '', |
| 51 | +// 'Transparency' => '', |
| 52 | +// 'Background' => '', |
| 53 | +// ), |
| 54 | +// 'Text' => array( |
| 55 | +// 'FontSize' => '', |
| 56 | +// 'FontType' => '', |
| 57 | +// 'FontColor' => '', |
| 58 | +// 'Transparency' => '', |
| 59 | +// 'Text' => '', |
| 60 | +// ), |
| 61 | +// 'SlideConfig' => array( |
| 62 | +// 'SlideMode' => '', |
| 63 | +// 'XSlideSpeed' => '', |
| 64 | +// 'YSlideSpeed' => '', |
| 65 | +// ), |
| 66 | +// ), |
| 67 | +// ), |
| 68 | +// 'DigitalWatermark' => array( |
| 69 | +// 'Message' => '', |
| 70 | +// 'Type' => '', |
| 71 | +// 'Version' => '', |
| 72 | +// 'IgnoreError' => '', |
| 73 | +// 'State' => '', |
| 74 | +// ), |
| 75 | + ), |
| 76 | +// 'CallBack' => '', |
| 77 | +// 'CallBackFormat' => '', |
| 78 | +// 'CallBackType' => '', |
| 79 | +// 'CallBackMqConfig' => array( |
| 80 | +// 'MqRegion' => '', |
| 81 | +// 'MqMode' => '', |
| 82 | +// 'MqName' => '', |
| 83 | +// ), |
| 84 | + )); |
| 85 | + // 请求成功 |
| 86 | + print_r($result); |
| 87 | + // end --------------- 使用模版 ----------------- // |
| 88 | + |
| 89 | + // start --------------- 自定义参数 ----------------- // |
| 90 | + $result = $cosClient->createMediaVideoEnhanceJobs(array( |
| 91 | + 'Bucket' => 'examplebucket-125000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.cloud.tencent.com/cos5/bucket |
| 92 | + 'Tag' => 'VideoEnhance', |
| 93 | + 'Input' => array( |
| 94 | + 'Object' => 'test.mp4', |
| 95 | + ), |
| 96 | + 'Operation' => array( |
| 97 | + // 画质增强参数 |
| 98 | + 'VideoEnhance' => array( |
| 99 | + 'Transcode' => array( |
| 100 | + 'Container' => array( |
| 101 | + 'Format' => 'mp4', |
| 102 | + ), |
| 103 | + 'Video' => array( |
| 104 | + 'Codec' => 'H.264', |
| 105 | + 'Width' => '1280', |
| 106 | + 'Height' => '920', |
| 107 | + 'Fps' => '30', |
| 108 | + ), |
| 109 | + 'Audio' => array( |
| 110 | + 'Codec' => 'aac', |
| 111 | + 'Samplerate' => '44100', |
| 112 | + 'Bitrate' => '128', |
| 113 | + 'Channels' => '4', |
| 114 | + ), |
| 115 | + ), |
| 116 | + 'SuperResolution' => array( |
| 117 | + 'Resolution' => 'sdtohd', |
| 118 | + 'EnableScaleUp' => 'true', |
| 119 | + 'Version' => 'Enhance', |
| 120 | + ), |
| 121 | + 'SDRtoHDR' => array( |
| 122 | + 'HdrMode' => 'HDR10', |
| 123 | + ), |
| 124 | + 'ColorEnhance' => array( |
| 125 | + 'Contrast' => '50', |
| 126 | + 'Correction' => '100', |
| 127 | + 'Saturation' => '100', |
| 128 | + ), |
| 129 | + 'MsSharpen' => array( |
| 130 | + 'SharpenLevel' => '5', |
| 131 | + ), |
| 132 | + 'FrameEnhance' => array( |
| 133 | + 'FrameDoubling' => 'true', |
| 134 | + ), |
| 135 | + ), |
| 136 | + 'Output' => array( |
| 137 | + 'Region' => $region, |
| 138 | + 'Bucket' => 'examplebucket-125000000', |
| 139 | + 'Object' => 'tmp/output.mp4', |
| 140 | + ), |
| 141 | +// 'UserData' => 'xxx', |
| 142 | +// 'JobLevel' => '0', |
| 143 | +// 'WatermarkTemplateId' => array( |
| 144 | +// 'WatermarkTemplateId-1', |
| 145 | +// 'WatermarkTemplateId-2', |
| 146 | +// ), |
| 147 | +// 'Watermark' => array( |
| 148 | +// array( |
| 149 | +// 'Type' => '', |
| 150 | +// 'Pos' => '', |
| 151 | +// 'LocMode' => '', |
| 152 | +// 'Dx' => '', |
| 153 | +// 'Dy' => '', |
| 154 | +// 'StartTime' => '', |
| 155 | +// 'EndTime' => '', |
| 156 | +// 'Image' => array( |
| 157 | +// 'Url' => '', |
| 158 | +// 'Mode' => '', |
| 159 | +// 'Width' => '', |
| 160 | +// 'Height' => '', |
| 161 | +// 'Transparency' => '', |
| 162 | +// 'Background' => '', |
| 163 | +// ), |
| 164 | +// 'Text' => array( |
| 165 | +// 'FontSize' => '', |
| 166 | +// 'FontType' => '', |
| 167 | +// 'FontColor' => '', |
| 168 | +// 'Transparency' => '', |
| 169 | +// 'Text' => '', |
| 170 | +// ), |
| 171 | +// 'SlideConfig' => array( |
| 172 | +// 'SlideMode' => '', |
| 173 | +// 'XSlideSpeed' => '', |
| 174 | +// 'YSlideSpeed' => '', |
| 175 | +// ), |
| 176 | +// ), |
| 177 | +// ), |
| 178 | +// 'DigitalWatermark' => array( |
| 179 | +// 'Message' => '', |
| 180 | +// 'Type' => '', |
| 181 | +// 'Version' => '', |
| 182 | +// 'IgnoreError' => '', |
| 183 | +// 'State' => '', |
| 184 | +// ), |
| 185 | + ), |
| 186 | +// 'CallBack' => '', |
| 187 | +// 'CallBackFormat' => '', |
| 188 | +// 'CallBackType' => '', |
| 189 | +// 'CallBackMqConfig' => array( |
| 190 | +// 'MqRegion' => '', |
| 191 | +// 'MqMode' => '', |
| 192 | +// 'MqName' => '', |
| 193 | +// ), |
| 194 | + )); |
| 195 | + // 请求成功 |
| 196 | + print_r($result); |
| 197 | + // end --------------- 自定义参数 ----------------- // |
| 198 | +} catch (\Exception $e) { |
| 199 | + // 请求失败 |
| 200 | + echo($e); |
| 201 | +} |
0 commit comments