首页 > 代码库 > 自制带第三方库的FFmpeg SDK
自制带第三方库的FFmpeg SDK
一、第三方库的编译与安装
1. libfaac
# tar -zxvf faac-1.28.tar.gz
# cd faac-1.28
# ./configure --prefix=/opt/YOUR_SDK_INSTALL_DIRECTORY --enable-static --disable-shared
# make; make install
2. libmp3lame
# tar -zxvf lame-3.98.4.tar.gz
# cd lame-3.98.4
# ./configure --prefix=/opt/YOUR_SDK_INSTALL_DIRECTORY --enable-static --disable-shared
# make; make install
3.libx264
# tar -xvf x264-snapshot-20110818-2245.tar
# ./configure --prefix=/opt/YOUR_SDK_INSTALL_DIRECTORY --enable-static --disable-shared
# make; make install
4. librtmp
# tar -xvf rtmpdump_git0819.tar
# cd rtmpdump
# cd librtmp
# vim Makefile
#prefix=/usr/local
prefix=YOUR_SDK_INSTALL_DIRECTORY
...
#CRYPTO=OPENSSL
CRYPTO=
...
#SO_LDFLAGS_posix=-shared -Wl,-soname,$@
SO_LDFLAGS_posix=-Wl,-soname,$@
...
#SHARED=yes
SHARED=no
【保存并退出】
# make
# cd ..
# vim Makefile
#prefix=/usr/local
prefix=YOUR_SDK_INSTALL_DIRECTORY
【保存并退出】
# make SYS=darwin XDEF=-DNO_SSL CRYPTO= SHARED=
# make; make install
二、FFmpeg SDK的编译与安装
1. 修改FFmpeg 的 configure
# cd ffmpeg
# vim configure
$vim configure
...
#enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
enabled librtmp && { check_lib librtmp/rtmp.h RTMP_Socket -lrtmp -lpolarssl -lwinmm -lws2_32 ||
check_lib librtmp/rtmp.h RTMP_Socket -lrtmp -lssl -lcrypto -lz ||
die "ERROR: librtmp not found or RTMP_Socket() missing, librtmp
version must be >= 2.2.f"; }
【保存并退出】
2. FFmpeg SDK
# vim ffmpeg_configure.sh
#!/bin/sh
./configure \
--prefix=/opt/YOUR_SDK_INSTALL_DIRECTORY \
--enable-gpl --enable-nonfree --enable-version3 \
--disable-shared --enable-static \
--enable-pthreads --enable-runtime-cpudetect \
--enable-zlib --enable-bzlib \
--enable-postproc \
--extra-cflags=‘-I/opt/ffmpeg/sdk/ffmpeg-0.8.10.patched.sdk/include -DREDIRECT_DEBUG_LOG‘ \
--extra-ldflags=‘-L/opt/ffmpeg/sdk/ffmpeg-0.8.10.patched.sdk/lib -gl‘ \
--disable-encoder=aac \
--enable-libfaac --enable-encoder=libfaac \
--enable-libmp3lame --enable-encoder=libmp3lame \
--enable-libx264 --enable-encoder=libx264 \
--enable-librtmp \
--enable-avfilter --enable-filter=movie
【保存并退出】
# chmod +x ffmpeg_configure.sh
# ./ffmpeg_configure.sh
# make; make install
三、应用程序的编译
# gcc output_example.c -g -o output_example
-I/opt/YOUR_SDK_INSTALL_DIRECTORY/include -L/opt/YOUR_SDK_INSTALL_DIRECTORY/lib
-lavformat -lavdevice -lavcodec -lavutil -lavfilter -pthread -ldl -lswscale -lbz2 -lasound
-lmp3lame -lfaac -lx264 -lrtmp -lz -lm
1. libfaac
# tar -zxvf faac-1.28.tar.gz
# cd faac-1.28
# ./configure --prefix=/opt/YOUR_SDK_INSTALL_DIRECTORY --enable-static --disable-shared
# make; make install
2. libmp3lame
# tar -zxvf lame-3.98.4.tar.gz
# cd lame-3.98.4
# ./configure --prefix=/opt/YOUR_SDK_INSTALL_DIRECTORY --enable-static --disable-shared
# make; make install
3.libx264
# tar -xvf x264-snapshot-20110818-2245.tar
# ./configure --prefix=/opt/YOUR_SDK_INSTALL_DIRECTORY --enable-static --disable-shared
# make; make install
4. librtmp
# tar -xvf rtmpdump_git0819.tar
# cd rtmpdump
# cd librtmp
# vim Makefile
#prefix=/usr/local
prefix=YOUR_SDK_INSTALL_DIRECTORY
...
#CRYPTO=OPENSSL
CRYPTO=
...
#SO_LDFLAGS_posix=-shared -Wl,-soname,$@
SO_LDFLAGS_posix=-Wl,-soname,$@
...
#SHARED=yes
SHARED=no
【保存并退出】
# make
# cd ..
# vim Makefile
#prefix=/usr/local
prefix=YOUR_SDK_INSTALL_DIRECTORY
【保存并退出】
# make SYS=darwin XDEF=-DNO_SSL CRYPTO= SHARED=
# make; make install
二、FFmpeg SDK的编译与安装
1. 修改FFmpeg 的 configure
# cd ffmpeg
# vim configure
$vim configure
...
#enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
enabled librtmp && { check_lib librtmp/rtmp.h RTMP_Socket -lrtmp -lpolarssl -lwinmm -lws2_32 ||
check_lib librtmp/rtmp.h RTMP_Socket -lrtmp -lssl -lcrypto -lz ||
die "ERROR: librtmp not found or RTMP_Socket() missing, librtmp
version must be >= 2.2.f"; }
【保存并退出】
2. FFmpeg SDK
# vim ffmpeg_configure.sh
#!/bin/sh
./configure \
--prefix=/opt/YOUR_SDK_INSTALL_DIRECTORY \
--enable-gpl --enable-nonfree --enable-version3 \
--disable-shared --enable-static \
--enable-pthreads --enable-runtime-cpudetect \
--enable-zlib --enable-bzlib \
--enable-postproc \
--extra-cflags=‘-I/opt/ffmpeg/sdk/ffmpeg-0.8.10.patched.sdk/include -DREDIRECT_DEBUG_LOG‘ \
--extra-ldflags=‘-L/opt/ffmpeg/sdk/ffmpeg-0.8.10.patched.sdk/lib -gl‘ \
--disable-encoder=aac \
--enable-libfaac --enable-encoder=libfaac \
--enable-libmp3lame --enable-encoder=libmp3lame \
--enable-libx264 --enable-encoder=libx264 \
--enable-librtmp \
--enable-avfilter --enable-filter=movie
【保存并退出】
# chmod +x ffmpeg_configure.sh
# ./ffmpeg_configure.sh
# make; make install
三、应用程序的编译
# gcc output_example.c -g -o output_example
-I/opt/YOUR_SDK_INSTALL_DIRECTORY/include -L/opt/YOUR_SDK_INSTALL_DIRECTORY/lib
-lavformat -lavdevice -lavcodec -lavutil -lavfilter -pthread -ldl -lswscale -lbz2 -lasound
-lmp3lame -lfaac -lx264 -lrtmp -lz -lm
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。