对于音频、视频等多媒体资源,七牛云也提供了丰富的处理指令,包含但不限于以下指令:
本篇从获取音视频元信息入手,顺序讲解各个处理指令。
■ 获取音视频元信息
使用avinfo接口可以非常方便地获取一个音视频资源的相关元信息:
http://.qiniudn.com/?avinfo
或
http:///?avinfo
以美剧《黑名单》第1季第12集的预告片(flv资源)为例,在浏览器中打开如下URL:
http://qiniu-developer.u.qiniudn.com/samples/黑名单-S01E12.flv?avinfo
将返回一个JSON格式组织的元信息对象:
{
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"codec_type": "video",
"codec_time_base": "1001/60000",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 1280,
"height": 720,
...省略过长内容...
},
{
"index": 1,
"codec_name": "aac",
"codec_long_name": "Advanced Audio Coding",
"codec_type": "audio",
"codec_time_base": "1/44100",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "s16",
"sample_rate": "44100",
"channels": 2,
...省略过长内容...
}
],
"format": {
"nb_streams": 2,
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"format_long_name": "QuickTime/MPEG-4/Motion JPEG 2000 format",
"start_time": "0.000000",
"duration": "29.070000",
"size": "8702170",
"bit_rate": "2394818",