時間:2020年9月30日,學習FFmpeg!
學習版本:N-99352-gd8ce8e8
下載:
https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
安裝:
1. Type `./configure` to create the configuration. A list of configure options is printed by running `configure --help`.
./configure --prefix=FFmpeg --disable-shared --enable-static --disable-x86asm
在這里為了方便移植,僅僅編譯出了靜態庫,並且把所有的庫安裝在了自定義文件夾FFmpeg里面!
2. Then type `make` to build FFmpeg.
make
3. Type `make install` to install all binaries and libraries you built.
make install
簡單測試:
在ffmpeg根目錄下建立文件夾Example,並添加以下c文件。
#include <stdio.h> #include "../FFmpeg/include/libavformat/avformat.h" #include "../FFmpeg/include/libavcodec/avcodec.h" #include "../FFmpeg/include/libavdevice/avdevice.h" int main() { void * iterate = NULL; const AVOutputFormat *inputFormat = av_muxer_iterate(&iterate); const AVInputFormat *outputFormat = av_demuxer_iterate(&iterate); while (inputFormat) { printf("[In][%15s]\n", inputFormat->name); inputFormat = av_muxer_iterate(&iterate); } while (outputFormat) { printf("[Out][%15s]\n", outputFormat->name); outputFormat = av_demuxer_iterate(&iterate); } return 0; }
編譯:
gcc -o demo demo.c -I../FFmpeg/include -L../FFmpeg/lib/ -lavformat -lavfilter -lavcodec -lswscale -lavutil -lswresample -lm -lpthread -lavdevice -lz -llzma
運行:
./demo