代码一样,编译没问题,运行Bus Error :10

来源:5-8 FFmpeg打印音视频Meta信息

萌萌的爹地

2018-10-16

写回答

3回答

李超

2018-10-18

AVFormatContext *fmt_cxt; 需要初始化 AVFormatContext *fmt_cxt = NULL;

1
0

萌萌的爹地

提问者

2018-10-16

#include <libavutil/log.h> 2 #include <libavformat/avformat.h> 3 4 int main(int argc, char* argv[]) 5 { 6 7 int ret; 8 // 词缩写,一般三个字符,两个词之间下划线 9 AVFormatContext *fmt_cxt; 10 11 12 // 日志级别 13 av_log_set_level(AV_LOG_INFO); 14 // 已弃用,注册所有的编解码器、协议 15 av_register_all(); 16 17 /* 18 打开上下文 19 传入指针的地址,分配空间, 20 第三个参数输入文件的格式,NULL:根据后缀名解析,否则指定 21 第四个参数,命令行参数传递 22 */ 23 ret = avformat_open_input(&fmt_cxt,"./out2.mp4",NULL,NULL); 24 if (ret<0){ 25 av_log(NULL,AV_LOG_INFO,"Can't open file:%s\n",av_err2str(ret)); 26 return -1; 27 } 28 29 // 打印,二参数:流的索引值,三参数:多媒体文件的名字,四参数:输入流0/输出流1 30 av_dump_format(fmt_cxt,0,"./out2.mp4",0); 31 // 关闭多媒体文件 32 avformat_close_input(&fmt_cxt); 33 34 return 0; 35 }



0
0

李超

2018-10-16

第次执行都报这个错误吗?你执行的是哪个程序?

0
4
萌萌的爹地
题目是:打印meta信息
2018-10-16
共4条回复

经典再升级-FFmpeg5.0核心技术精讲,打造音视频播放器

学好FFmpeg核心技术,做高效,高薪,有竞争力的音视频工程师

2726 学习 · 814 问题

查看课程