日期:2014-05-16  浏览次数:20604 次

关于av_open_input_file函数的使用
 AVFormatContext *pFormatCtx;
 const char *filename = "./a.mp4";
    
    
 if(av_open_input_file(&pFormatCtx, filename, NULL, 0, NULL) != 0)
   {
       printf("open video file fail!\n");
    }

打不开文件,报Segmentation fault,我的文件是放在当前目录下的。


------解决方案--------------------
少了一句申请内存,野指针当然要崩溃了
pFormatCtx = avformat_alloc_context();
------解决方案--------------------
1、如果是流的话应该是一段地址才对啊  而且av_open_input_file()可以打开流的吧
2、最新的api好像是avformat_open_input()