首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >libavformat / ffmpeg c程序“不合适的输入格式”

libavformat / ffmpeg c程序“不合适的输入格式”
EN

Stack Overflow用户
提问于 2013-10-02 19:41:46
回答 1查看 589关注 0票数 2

你好,我正在尝试使用C库编码视频。由于某些原因,当我试图创建格式上下文时,会遇到以下错误:

[NULL @ 0x7ff574006600] Requested output format 'mp4' is not a suitable output format

我知道我的ffmpeg是用x264标志编译的,这是一个简单的

ffmpeg -i test.mov test.mp4

效果很好。我还链接到所有生成的pch文件,而libav*库中的其他所有文件都正常工作。下面是一个完整的工作示例,其中包含了“我要收到的错误”:

代码语言:javascript
复制
#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;

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-11-15 16:25:53

你得打电话

代码语言:javascript
复制
av_register_all();

在分配输出上下文之前。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19145443

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档