Xcode 搭建FFmpeg開發環境
theme: channing-cyan
首先我是一個Android 開發工程師,最近在做音視訊開發的學習,對於必學框架API-FFmpeg,所涉及的語言都是C語言或者C++語言,在Mac 電腦上,FFmpeg 的學習更加方便
Mac 下安裝FFmpeg
FFmpeg的學習看其原始碼時需要下載他的倉庫,直接讀原始碼,其他場景下的編譯都是自己根據自己的需求進行編譯的,但是在Mac 中不需要進行編譯就可以學習FFmpeg的各個API
brew install ffmpeg
Xcode 建立一個Commond Line Tools 專案,選擇C++/C都可
配置Xcode中ffmpeg的開發環境
第一步,Header、Library路徑
通過brew安裝之後,ffmpeg需要的標頭檔案和lib檔案都會安裝到/usr/local/X的位置
第二步 新增動態連結庫
直接從/usr/local/lib中拖進去即可
測試
```C++ // // main.cpp // media_project // // Created by mtkj on 2022/12/3. //
if defined(__cplusplus)
extern "C" {
endif
include "libavcodec/avcodec.h"
if defined(__cplusplus)
}
endif
include
using namespace std;
int main(int argc, const char * argv[]) { // insert code here... std::cout << "Hello, World!\n"; //列印FFmpeg 的配置資訊(編譯配置項) cout << "avcodec_configuration : " << avcodec_configuration() << endl; return 0;
}
```
可能出現的錯誤
解決方式:關掉沙盒,啟用動態連結,設定Enable Hardened Runtime 為NO
配置正確驗證
「其他文章」