一半君的总结纸

听话只听一半君

CentOS 6.4 没root如何编译 librtmp 和 ffmpeg

按照官网教程过一遍
不同之处有公司用的是中古的csh,所以
设PATH的要用

setenv PATH $HOME/bin:${PATH}

因为没权限用yum 所以 libfreetype 换成

cd ~/ffmpeg_sources
git clone git://git.sv.nongnu.org/freetype/freetype2.git
cd freetype2
sh autogen.sh
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install
make distclean

libspeex换成

cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
tar -xvf speex-1.2rc1.tar.gz
cd speex-1.2rc1
setenv PKG_CONFIG_PATH "$HOME/ffmpeg_build/lib/pkgconfig"
./configure --prefix="$HOME/ffmpeg_build" --enable-static
make
make install
make distclean

然后是重点librtmp

cd ~/ffmpeg_sources
git clone git://git.ffmpeg.org/rtmpdump
cd rtmpdump
make SYS=posix
make install prefix="$HOME/ffmpeg_build" bindir="$HOME/bin" sbindir="$HOME/bin"
make clean

最终…

cd ~/ffmpeg_sources
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
setenv PKG_CONFIG_PATH "$HOME/ffmpeg_build/lib/pkgconfig"
./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264  --enable-libfreetype --enable-libspeex --enable-libtheora --enable-librtmp
make
make install
make distclean
# hash是bash的built-in command,官网这里只是为了防止你之前用过ffmpeg(现在虽然已经装到$HOME/bin了,但是如果hash table里有你之前的ffmpeg,那你输ffmpeg他还是用之前的,直接运行hash可以看现在有什么 当然重开个shell就没了,这里官网只是强迫症了一下)
# hash -r
# . is a synonym for the "source" command in bash
# . ~/.bash_profile

如果想要有 static build,似乎是每个依赖的package都要加 –enable-static –disable-shared ,然后–extra-ldflags –extra-cflags 里面也要加 -static ? 这样就可以了么? 没有试验,感觉应该搞成build script ,一次搞定…. 可以参考这个FFmpeg static build改改

待续…

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: