概述
为了进行小程序silk语音的转码,需要在服务器上配置ffmpeg的环境。接下来我以centos的linux系统作为基础进行介绍配置的操作。
配置
- lame
wget https://nchc.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.tar.gz
tar -zxvf lame-3.99.tar.gz
cd lame-3.99
./configure --enable-shared && make &&make install
- 1
- 2
- 3
- 4
- 5
- libogg
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
tar -zxvf libogg-1.3.2.tar.gz
cd libogg-1.3.2
./configure && make &&make install
- 1
- 2
- 3
- 4
- 5
- libvorbis
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
# 注意(libvorbis依赖于libogg, 所以libogg必须先于libvorbis安装)
tar -zxvf libvorbis-1.3.3.tar.gz
cd libvorbis-1.3.3
./configure && make &&make install
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- xvid
官网地址
wget http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.gz
cd xvidcore
cd build/generic &&
sed -i 's/^LN_S=@LN_S@/& -f -v/' platform.inc.in &&
./configure --prefix=/usr &&
make
- 1
- 2
- 3
- 4
- 5
- 6
- x264
索引地址
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20050824-2219.tar.bz2
tar -jxvf last_x264.tar.bz2
./configure
make
make install
- 1
- 2
- 3
- 4
- 5
- 6
- libdts
解码器,可以解DVD DTS Audio 格式的文件
包下载地址
./configure
make
make install
- 1
- 2
- 3
- a52
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
./configure
make
make install
- 1
- 2
- 3
- 4
- 5
- faad2
wget
http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz
./configure
make
make install
- 1
- 2
- 3
- 4
- 5
- faac
wget
http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
./configure
make
make install
- 1
- 2
- 3
- 4
- 5
- amr-nb
wget
http://ftp.penguin.cz/pub/users/utx/amr/amrnb-6.1.0.1.tar.bz2
./configure
make
make install
- 1
- 2
- 3
- 4
- amr-wb
wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-6.0.0.1.tar.bz2
./configure
make
make install
- 1
- 2
- 3
- 4
- 安装ffmpeg
wget
http://www.ffmpeg.org/releases/ffmpeg-3.1.tar.gz
tar -zxvf ffmpeg-3.1.tar.gz
cd ffmpeg-3.1
./configure --prefix=/usr/local/ffmpeg3 --enable-libmp3lame --enable-libvorbis --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libxvid --enable-postproc --enable-ffserver --enable-ffplay
make
make install
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
接下来会一堆报错:
- mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*, const char*)’
解决方法:
根据报错的Error信息进入对应的文件目录下修改mpeg4ip.h
修改前
#ifdef __cplusplus
extern "C" {
#endif
char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif
- 1
- 2
- 3
- 4
- 5
- 6
- 7
#ifdef __cplusplus
extern "C++" {
#endif
const char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif
- 1
- 2
- 3
- 4
- 5
- 6
- 7
编译时候出现ERROR的错误对应的提示修复操作方法
yasm错误需要安装yasm
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-0.7.1.tar.gz
cd yasm-0.7.1
./configure --prefix=/usr/local/yasm
make && make install
- 1
- 2
- 3
- 4
- 5
提示: ERROR: libx264 must be installed and version must be >= 0.118.
需要去掉–enable-libx264
我官网安装最新版,依然提示这个错误,暂时不知道解决办法。/usr/local/ffmpeg3/bin/ffmpeg: error while loading shared libraries: libxvidcore.so.4: cannot open shared object file: No such file or directory
我们需要修改/etc/ld.so.conf
内容增加/usr/local/lib/
保存退出后,需要执行ldconfig
进行刷新缓存。
刷新成功进行/usr/local/ffmpeg3/bin/ffmpeg -version
将看到上图内容。
配置环境变量
export PATH=/usr/local/ffmpeg3/bin/:$PATH
env
- 1
- 2
以上环境变量只会对当前一个shell进行匹配,后面的shell就需要再一次声明。因此如果你需要长期使用可以通过下面这篇文章配置环境变量。Linux配置环境变量的3中方法
最后
以上就是鲤鱼大神为你收集整理的Centos部署ffmpeg配置配置环境变量的全部内容,希望文章能够帮你解决Centos部署ffmpeg配置配置环境变量所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复