API | 操作名 | 操作描述 |
查询文件信息 | 用于查询媒体文件的信息 |
media bucket unbinded, bucket's host is unavailable
。<?phprequire dirname(__FILE__) . '/../vendor/autoload.php';$secretId = "SECRETID"; //替换为用户的 secretId,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$secretKey = "SECRETKEY"; //替换为用户的 secretKey,请登录访问管理控制台进行查看和管理,https://console.tencentcloud.com/cam/capi$region = "ap-beijing"; //替换为用户的 region,已创建桶归属的region可以在控制台查看,https://console.tencentcloud.com/cos5/bucket$cosClient = new Qcloud\\Cos\\Client(array('region' => $region,'schema' => 'https', //协议头部,默认为http'credentials'=> array('secretId' => $secretId ,'secretKey' => $secretKey)));try {$result = $cosClient->GetMediaInfo(array('Bucket' => 'examplebucket-1250000000', //存储桶名称,由BucketName-Appid 组成,可以在COS控制台查看 https://console.tencentcloud.com/cos5/bucket'Key' => 'exampleobject', //媒体文件对象路径,如folder/movie.mp4'ci-process' => 'videoinfo' //操作类型,固定使用 videoinfo));// 请求成功echo($result);} catch (\\Exception $e) {// 请求失败echo($e);}
参数名 | 参数描述 | 类型 | 是否必填 |
Bucket | 存储桶的名称,命名规则为 BucketName-APPID,此处填写的存储桶名称必须为此格式 | String | 是 |
Key | 对象键(Object 的名称),这里的形式为媒体文件。对象在存储桶中的唯一标识,详情请参见 对象概述 | String | 是 |
ci-process | 操作类型,固定使用 videoinfo | String | 是 |
GuzzleHttp\\Command\\Result Object([RequestId] => NjE0NTkxMWNfYTkyZTJjMGJfNTgyZF84ZDY2NWY=[ContentType] => application/xml[ContentLength] => 1787[MediaInfo] => Array([Stream] => Array([Audio] => Array([Bitrate] => 383.727000[Channel] => 6[ChannelLayout] => 5.1[CodecLongName] => AAC (Advanced Audio Coding)[CodecName] => aac[CodecTag] => 0x6134706d[CodecTagString] => mp4a[CodecTimeBase] => 1/48000[Duration] => 62.314667[Index] => 1[Language] => und[SampleFmt] => fltp[SampleRate] => 48000[StartTime] => 0.000000[Timebase] => 1/48000)[Subtitle] => Array()[Video] => Array([CodecTagString] => avc1[Rotation] => 0.000000[Index] => 0[CodecName] => h264[CodecLongName] => H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10[CodecTimeBase] => 1/12800[CodecTag] => 0x31637661[Profile] => Main[Height] => 720[Width] => 1280[HasBFrame] => 0[RefFrames] => 1[Sar] => 1:1[Dar] => 16:9[PixFormat] => yuv420p[Level] => 31[Fps] => 25.500000[AvgFps] => 25/1[Timebase] => 1/12800[StartTime] => 0.000000[Duration] => 62.280000[Bitrate] => 959.963000[NumFrames] => 1557[Language] => und))[Format] => Array([NumStream] => 2[NumProgram] => 0[FormatName] => mov,mp4,m4a,3gp,3g2,mj2[FormatLongName] => QuickTime / MOV[StartTime] => 0.000000[Duration] => 62.315000[Bitrate] => 1347.820000[Size] => 10498677))[Key] => exampleobject[Bucket] => examplebucket-1250000000[Location] => examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/exampleobject)
本页内容是否解决了您的问题?