c - ffmpeg - 缺少 avformat header

标签 c ffmpeg

我按照步骤 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 个 header 。
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)错误。

最佳答案

构建和使用库不是一回事。
看看 libavformat/oggdec.hlibavformat/oggdec.c 。您应该已经意识到,没有办法直接使用 ogg_read_packet 函数。

  • 头文件中没有声明
  • 函数在源文件中声明为静态

  • 如果您想使用特定的编解码器(此处为 ogg)进行编码/解码,您必须找到一个编码器(avcodec_find_encoderavcodec_find_encoder_by_name)或解码器(avcodec_find_decoderavcodec_find_decoder_by_name)并通过 AVCodecContext 将其链接到 avcodec_open2
    然后使用 here 描述的“编码”函数进行编码,使用 here 描述的“解码”函数进行解码。
    欲了解更多信息:
  • FFmpeg Documentation
  • FFmpeg Examples

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

    关于c - ffmpeg - 缺少 avformat header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65560061/

    相关文章:

    c - 地址预订并写入文件

    c++ - 使用注入(inject)的 DLL 代码干扰 Win32 消息循环 (SetWindowsHookEx)

    ffmpeg - 使用 FFmpeg 从大电影创建缩略图需要太长时间

    c - 缓慢的 pthread 消费者

    c - OpenSSL 函数 EVP_PKEY_keygen 中的内存泄漏

    c - 使用 ansi C 中的字典将完整的字符串解析为单词

    c# - 从 ffmpeg 标准输出的单个流中获取多个图像

    audio - FFMPEG 是否有 "guard"反对剪辑?

    android - 用于 android 的 ffmpeg(使用教程 : "ffmpeg and Android.mk")

    ffmpeg - 我可以在 MPEG TS 容器中拥有原始视频流吗