vs2015+ffmpeg開發環境配置【轉】

本文轉載自:http://blog.csdn.net/hustlx/article/details/51014307post


1.在http://ffmpeg.zeranoe.com/builds/  下載最新的ffmpeg的dev版和share版,注意下載的時候嚴格區分x64和x86,取決於你vs2015調試的解決方案平臺用什麼,若是安裝了錯誤的版本將會出現一堆沒法解析的錯誤。

包含三個版本:Static、Shared以及Dev
• Static   --- 包含3個應用程序:ffmpeg.exe , ffplay.exe , ffprobe.exe,體積都很大,相關的DLL已經被編譯到exe裏面去了。
• Shared --- 除了ffmpeg.exe , ffplay.exe , ffprobe.exe以外還有一些DLL,exe體積很小,在運行時到相應的DLL中調用功能。
• Dev      --- 開發者(developer)版本,裏面包含了庫文件xxx.lib以及頭文件xxx.h,這個版本不含exe文件
    把dev版本與share版本都下下來解壓,dev版本文件夾中的Include和lib目錄整個兒複製到VS項目目錄下。接着將share版本文件夾中bin目錄下對應的全部dll複製到項目路徑下,以下圖所示:

2.在工程屬性》C/C++》常規》附加包含目錄:$(ProjectDir)include

好比在個人項目中:C:\Users\yckj\Documents\Visual Studio2015\Projects\watermarkUI\include

點擊應用,

在工程屬性》連接器》常規》附加庫目錄:$(ProjectDir)lib。

C:\Users\yckj\Documents\Visual Studio2015\Projects\watermarkUI\lib
點擊應用,

   最後點擊肯定

 3,在要用到ffmpeg庫的頭文件中加入:

[cpp]  view plain  copy
 
  1. extern "C"  
  2. {  
  3. #include "include\libavcodec\avcodec.h"  
  4. #include "include\libavformat\avformat.h"  
  5. #include "include\libavutil\channel_layout.h"  
  6. #include "include\libavutil\common.h"  
  7. #include "include\libavutil\imgutils.h"  
  8. #include "include\libswscale\swscale.h"   
  9. #include "include\libavutil\imgutils.h"      
  10. #include "include\libavutil\opt.h"         
  11. #include "include\libavutil\mathematics.h"      
  12. #include "include\libavutil\samplefmt.h"   
  13. };  
  14. #pragma comment(lib, "avcodec.lib")  
  15. #pragma comment(lib, "avformat.lib")  
  16. #pragma comment(lib, "avdevice.lib")  
  17. #pragma comment(lib, "avfilter.lib")  
  18. #pragma comment(lib, "avutil.lib")  
  19. #pragma comment(lib, "postproc.lib")  
  20. #pragma comment(lib, "swresample.lib")  
  21. #pragma comment(lib, "swscale.lib")  

這樣你的ffmpeg庫就應該配置成功了。
 
4
相關文章
相關標籤/搜索