如何在Windows XP上正确安装ffmpeg

How to correctly install ffmpeg on windows XP?

本文关键字:安装 ffmpeg XP Windows      更新时间:2023-10-16

我正在Windows上做C++涉及FFmpeg库的项目。问题是我无法将 ffmpeg 库包含在我的项目中。我什至无法运行任何 ffmpeg 教程或示例。我总是收到如下错误:

tutorial01.c:22:28: ffmpeg/avcodec.h: No such file or directory
tutorial01.c:23:29: ffmpeg/avformat.h: No such file or directory

以及许多错误,例如:

tutorial01.c:33: error: `iFrame' undeclared (first use in this function)

我找到了包含以下说明的教程:

//gcc -o tutorial01 tutorial01.c -lavformat -lavcodec -lz
//to build (assuming libavformat and libavcodec are correctly installed
//your system).

经过进一步搜索,我发现我应该从这里获得一个静态构建库版本:http://ffmpeg.zeranoe.com/builds/然后我按照以下说明安装了这个库:

  1. 从 arrozcru 自动构建页面获取最新版本
  2. 将文件夹解压缩到 C:/Program Files/ffmpeg 中
  3. 将 C:/Program Files/ffmpeg/bin 添加到系统的 PATH 环境变量中

但我仍然有同类的编译错误。因此,似乎安装不正确。

我应该怎么做才能将 ffmpeg 库连接到我在 Windows 上的项目?

所以为了总结答案,你需要将 ffmpeg 的 include 和 lib 目录添加到 gcc 的目录路径中。