【问题标题】:ffmpeg - missing avformat headersffmpeg - 缺少 avformat 标头
【发布时间】:2021-04-10 02:11:59
【问题描述】:

我按照步骤here to compile FFmpeg. 而且没有问题。它运作良好。但我不明白一些事情。 我的主目录下有两个文件夹。 --ffmpeg_sources --ffmpeg_build

在 ffmpeg_sources/libavformat 中我有多个标头

aiff.h
apetag.h
argo_asf.h
asfcrypt.h
asf.h
ast.h
av1.h
avc.h
avformat.h
avi.h
avio.h
avio_internal.h
avlanguage.h
ogg.h
...

但 ffmpeg_build/avformat 有 3 个标头。

avformat.h
avio.h
version.h

顺便说一句,这是我的 usr/include/x86_64-linux-gnu/libavformat

avformat.h
avio.h
version.h

为什么这两个文件中不是所有的标题? 例如:我想使用“ogg_read_packet”,但是当我尝试include <libavformat/oggdec.h> 时,我得到cannot open source file "libavformat/oggdec.h"C/C++(1696) 错误。

【问题讨论】:

    标签: c ffmpeg


    【解决方案1】:

    构建和使用库不是一回事。

    看看libavformat/oggdec.h 和libavformat/oggdec.c。您应该已经意识到,没有办法直接使用ogg_read_packet 函数。

    1. 头文件中没有声明
    2. 函数在源文件中声明为静态

    如果您想使用特定编解码器(此处为 ogg)进行编码/解码,您必须找到编码器(avcodec_find_encoder 或 avcodec_find_encoder_by_name)或解码器(avcodec_find_decoder 或 avcodec_find_decoder_by_name)并将其链接到AVCodecContext 通过avcodec_open2。

    然后使用here 描述的“编码”函数进行编码,并使用here 描述的“解码”函数进行解码。

    更多信息:

    简而言之,使用公共接口。只有“上帝”知道 FFmpeg 的内部结构。

    【讨论】:

      猜你喜欢
      • 2021-08-25
      • 1970-01-01
      • 2013-08-19
      • 1970-01-01
      • 2012-10-27
      • 2012-06-06
      • 2015-10-11
      • 2021-06-23
      相关资源
      最近更新 更多