#include<libavutil/log.h>#include<libavformat/avformat.h>intmain(){int ret;
AVFormatContext *fmt_ctx =NULL;//格式上下文av_log_set_level(AV_LOG_INFO);//av_register_all();4.0版本后就不需要显式调用,ffmpeg会自动调用
ret =avformat_open_input(&fmt_ctx,"./test.mp4",NULL,NULL);//媒体流信息放入ctx中if(ret <0){av_log(NULL,AV_LOG_ERROR,"cant open file:%s\n",av_err2str(ret));return-1;}av_dump_format(fmt_ctx,0,"./test.mp4",0);//输出流信息avformat_close_input(&fmt_ctx);//关闭文件,不然容易内存泄漏return0;