ffmpeg获取视频mediainfo信息

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qqqq245425070/article/details/84668588

c代码

#include <libavutil/log.h>
#include <libavformat/avformat.h>

int main(int argc ,char* argv[]){

	int result ;
	AVFormatContext *fmt_ctx = NULL;
	
	av_log_set_level(AV_LOG_INFO);
	av_register_all();
	
	result = avformat_open_input(&fmt_ctx,"./test.mp4",NULL,NULL);
	if(result < 0){
		av_log(NULL,AV_LOG_ERROR,"can't open file : %s \n",av_err2str(result));
		return -1;
	}

	av_dump_format(fmt_ctx,0,"./test.mp4",0);

	avformat_close_input(&fmt_ctx);
	return 0;
}

代码结果截图

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qqqq245425070/article/details/84668588