你好,我正在尝试使用C库编码视频。由于某些原因,当我试图创建格式上下文时,会遇到以下错误:
[NULL @ 0x7ff574006600] Requested output format 'mp4' is not a suitable output format
我知道我的ffmpeg是用x264标志编译的,这是一个简单的
ffmpeg -i test.mov test.mp4
效果很好。我还链接到所有生成的pch文件,而libav*库中的其他所有文件都正常工作。下面是一个完整的工作示例,其中包含了“我要收到的错误”:
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/avutil.h>
#include <libswscale/swscale.h>
#include <libavutil/opt.h>
#include <libswscale/swscale.h>
#include <libavutil/imgutils.h>
#include <stdio.h>
int main() {
AVFormatContext * output = NULL;
// now lets initialize the actual format element
if (avformat_alloc_output_context2(&output, NULL, "mp4", "test.mp4") < 0) {
printf("%s", "INVALID");
}
return 0;
}发布于 2013-11-15 16:25:53
你得打电话
av_register_all();在分配输出上下文之前。
https://stackoverflow.com/questions/19145443
复制相似问题