国产与第三方库FFmpeg SDK

时间:2023-03-08 16:45:14

一个、编译并安装第三方库

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

版权声明:本文博客原创文章,博客,未经同意,不得转载。