解决 ffmpeg 在 avformat_alloc_output_context2 或者 av_guess_format 获取失败的问题
2015-01-12 18:02
621 查看
解决 ffmpeg 在 avformat_alloc_output_context2 或者 av_guess_format获取失败的问题:
avformat_alloc_output_context2 本质上是调用了 av_guess_format,这个函数会从所编译的ffmpeg库支持的muxer中查找与文件名有关联的container类型。如:
char *filename = “test.mp4”;
AVFormatContext *oc;
avformat_alloc_output_context2(&oc,NULL, NULL, filename);
将会在所支持的muxer中查找MP4类型的容器,而当查找不到时,传入的 AVFormatContext *oc将不能被初始化,出现以上情况,可能是以下原因:
1、 未调用 av_register_all(); 初始化ffmpeg。
2、 编译ffmpeg的时候未将所需要的muxer给包含进来,这需要重新编译ffmpeg。如需要MP4类型的muxer则在编译时加上 --enable-muxer= MP4包含MP4,或者 --enable-muxers 包含所有ffmpeg支持的类型(这样编译出来的avformat会比较大),然后重新编译ffmpeg就OK了。
avformat_alloc_output_context2 本质上是调用了 av_guess_format,这个函数会从所编译的ffmpeg库支持的muxer中查找与文件名有关联的container类型。如:
char *filename = “test.mp4”;
AVFormatContext *oc;
avformat_alloc_output_context2(&oc,NULL, NULL, filename);
将会在所支持的muxer中查找MP4类型的容器,而当查找不到时,传入的 AVFormatContext *oc将不能被初始化,出现以上情况,可能是以下原因:
1、 未调用 av_register_all(); 初始化ffmpeg。
2、 编译ffmpeg的时候未将所需要的muxer给包含进来,这需要重新编译ffmpeg。如需要MP4类型的muxer则在编译时加上 --enable-muxer= MP4包含MP4,或者 --enable-muxers 包含所有ffmpeg支持的类型(这样编译出来的avformat会比较大),然后重新编译ffmpeg就OK了。
相关文章推荐
- 解决 avformat_alloc_context无法识别的问题
- ffmpeg——avformat_alloc_output_context2
- FFmpeg 错误 C4996: "avcodec_alloc_frame"或者"av_free_packet"等函数被声明为已否决的解决方法
- ffmpeg源码简析(五)编码——avformat_alloc_output_context2(),avcodec_encode_video2()
- FFmpeg数据结构解释(AVCodecContext,AVStream,AVFormatContext)
- FFMPEG-数据结构(AVCodecContext,AVStream,AVFormatContext)
- FFMPEG-数据结构解释(AVCodecContext,AVStream,AVFormatContext)
- 解决ext htmleditor 回车,或者居中,设置一下字体颜色,就信息保存失败问题
- FFmpeg源代码简单分析:avformat_alloc_output_context2()
- CXF获取客户端IP(解决WebServiceContext为null问题)
- QC解决登陆时提示 setup_a.cab this file didn't pass signature checking或者初始化失败问题
- FFMPEG-数据结构解释(AVCodecContext,AVStream,AVFormatContext)
- FFMpeg分析2:AVInputFormat和AVOutputFormat
- FFMPEG-数据结构解释(AVCodecContext,AVStream,AVFormatContext)
- FFmpeg源代码简单分析:avformat_alloc_output_context2()
- (转)FFMPEG-数据结构解释(AVCodecContext,AVStream,AVFormatContext)
- FFMPEG-数据结构解释(AVCodecContext,AVStream,AVFormatContext)
- ffmpeg avformat_open_input返回失败的解决办法
- ffmpeg avformat_open_input返回失败的解决办法
- 遇到问题---java获取网络文件大小失败getContentLength()为-1 完整解决方法