ffmpeg的配置过程

xiaoxiao2021-02-28  132

1.下载头文件、lib文件和dll文件。

先进入ffmpeg的官网:点击打开链接,不要直接点击页面上最大的那个“download”,而是点击左侧标签中的Download,再点击“Get the packages”中的windows图标,此时在图标下面会出现“Windows Builds”字样,点击进入之后会看到有三种包可以下载,分别是Static,Shared,Dev,我们在这里使用的是后两种,其中Shared中有dll文件,Dev中有头文件和lib文件。

2.将下载好的include文件、lib文件和dll文件复制到工程目录中。

将上一步下载好的包解压,取Shared中的dll文件直接复制到工程目录下(dll文件在bin文件夹中),取Dev中的include文件夹和lib文件夹直接复制到工程目录下。

3.在编译器中进行配置(我这里使用的是VS2013)。

这一步共需要配置三个部分:

⑴配置属性->C/C++->常规->附加包含目录:设置为include。

⑵配置属性->链接器->常规->附加库目录:设置为lib。

⑶配置属性->链接器->输入->附加依赖项:加入下面这几个lib

avcodec.lib avdevice.lib avfilter.lib avformat.lib avutil.lib postproc.lib swresample.lib swscale.lib

4.经过以上三步后ffmpeg的配置就已经完成了。我们可以使用一段代码来测试是否配置成功。测试代码如下:

[cpp] view plain copy print ? #include <stdio.h>  extern "C"  {  #include "include\libavcodec\avcodec.h"  #include "include\libavformat\avformat.h"  #include "include\libavutil\imgutils.h"  };    #define __STDC_CONSTANT_MACROS    int _tmain(int argc, _TCHAR* argv[])  {      printf("%s", avcodec_configuration());          return 0;  }   #include <stdio.h> extern "C" { #include "include\libavcodec\avcodec.h" #include "include\libavformat\avformat.h" #include "include\libavutil\imgutils.h" }; #define __STDC_CONSTANT_MACROS int _tmain(int argc, _TCHAR* argv[]) { printf("%s", avcodec_configuration()); return 0; } 如果输入如下结果则说明配置成功。

5.已经成功配置ffmpeg。

   
转载请注明原文地址: https://www.6miu.com/read-61000.html

最新回复(0)