时间: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] ", inputFormat->name); inputFormat = av_muxer_iterate(&iterate); } while (outputFormat) { printf("[Out][%15s] ", 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