打印一个视频的视频流
#include
#include
int main(int argc,char* argv[]){
AVFormatContext *fmt_ctx = NULL;
int ret ;
av_log_set_level(AV_LOG_INFO);
av_register_all();
ret = avformat_open_input(&fmt_ctx,"./2.mp4",NULL,NULL);
if(ret < 0){
av_log(NULL,AV_LOG_ERROR,"co %s\n",av_err2str(ret));
return -1;
}
av_dump_format(fmt_ctx,0,"./2.mp4",0);
avformat_close_input(&fmt_ctx);
}
编译命令行
clang -g -o media main1.c `pkg-config --libs libavutil libavformat`
./media
打印结果
(base) wanggangdeMacBook-Pro:Desktop wanggang$ ./media
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './2.mp4':
Metadata:(和ffmpeg 版本有关的)
major_brand : mp42
minor_version : 1
compatible_brands: mp42mp41
creation_time : 2015-06-10T09:30:28.000000Z
Duration: 00:00:20.02,(时长) bitrate: N/A(比特率)
Stream #0:0(eng): Video: h264 视频编码方式 (avc1 / 0x31637661), none,分辨率 750x1334, 比特率 1422 kb/s,帧率 23.98 fps, 时间机 23.98 tbr, 23976 tbn (default)
Metadata:
creation_time : 2015-06-10T09:30:28.000000Z
handler_name : Apple Video Media Handler