centos 7 minal 搭建ffmpeg+segmenter环境
在centos上安装软件 最方便的方式就是使用yum , 自动解决依赖关系, 没有那么麻烦!
需要手动添加yum源配置/etc/yum.repos.d/dag.repo:
[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/RedHat/el$releasever/en/$basearch/dag
gpgcheck=0
enabled=1
yum -y install ffmpeg
我这里使用源码编译安装, 需要耐心和细心点才能完成。
1.安装autoconf
cd /App/src
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz
tar xvf autoconf-2.69.tar.xz
cd autoconf-2.69
./configure
make
make install
2. 安装automake
cd /App/src
wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.xz
tar xvf automake-1.15.tar.xz
cd automake-1.15
./configure
make
make install
3. 安装libtool(FAAC需要)
cd /App/src
wget http://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xz
tar xvf libtool-2.4.6.tar.xz
cd libtool-2.4.6
./configure
make
make install
4. 安装yasm支持汇编优化(FFmpeg需要)
cd /App/src
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make
make install
5. 添加动态链接库配置
echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf
6. 安装MP3支持库LAME
cd /App/src
wget http://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make
make install
7. 安装AAC支持库FAAC
make时报错:mpeg4ip.h:126: 错误:对‘char* strcasestr(const char*, const char*)’的新声明
需要修改common/mp4v2/mpeg4ip.h第123行至129行内容:
#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
cd /App/src
wget http://jaist.dl.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2
tar xvf faac-1.28.tar.bz2
cd faac-1.28
./bootstrap
./configure --with-mp4v2
#按前文修改mpeg4ip.h内容
make
make install
8. 安装AMR支持库opencore-amr
cd /App/src
wget http://jaist.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
tar xvf opencore-amr-0.1.3.tar.gz
cd opencore-amr-0.1.3
./configure
make
make install
9. 安装通用音乐音频编码格式支持库libvorbis
# libvorbis需要libogg,先安装libogg库
cd /App/src
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz
tar xvf libogg-1.3.2.tar.xz
cd libogg-1.3.2
./configure
make
make install
cd /App/src
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz
tar xvf libvorbis-1.3.5.tar.xz
cd libvorbis-1.3.5
./configure
make
make install
10. 安装x264库支持H.264视频转码
cd /App/src
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-shared
make
make install
11. 安装Xvid库支持MPEG-4转码
cd /App/src
wget http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.bz2
tar xvf xvidcore-1.3.3.tar.bz2
cd xvidcore/build/generic
./configure
make
make install
12. 安装Theora视频压缩支持库
cd /App/src
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.xz
tar xvf libtheora-1.1.1.tar.xz
cd libtheora-1.1.1
./configure
make
make install
13. 安装NUT支持库
安装时64位Linux系统需要修改文件config.mak
在最后一个CFLAGS下一行增加:
CFLAGS += -fPIC
否则安装FFmpeg make时报错:
/usr/local/lib/libnut.a: could not read symbols: Bad value
cd /App/src
svn co svn://svn.mplayerhq.hu/nut/src/trunk libnut
cd libnut
./configure
make
make install
14. 安装VP8/VP9编解码支持库
cd /App/src
git clone http://git.chromium.org/webm/libvpx.git
cd libvpx
./configure --enable-shared
make
make install
15. 安装FFmpeg最新版
cd /App/src
wget http://ffmpeg.org/releases/ffmpeg-2.6.3.tar.bz2
tar xvf ffmpeg-2.6.3.tar.bz2
cd ffmpeg-2.6.3
./configure --enable-version3 --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --enable-libnut --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-shared
make
make install
ldconfig
16. 安装segmenter
git clone https://github.com/johnf/m3u8-segmenter
cd m3u8-segmenter
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure
make
make install
ln -s /usr/local/bin/m3u8-segmenter /usr/local/bin/segmenter
三、 编译安装注意事项
1. 可能发现编译FFmpeg或者其他支持库时,即使相关的所有依赖也编译安装上了,仍然make报错,主要的原因还是由于依赖的库版本冲突,编译时调用的是yum安装时自动下载安装的旧版本依赖库。此时的方法就是卸掉所有yum安装的旧版本FFmpeg和相关的依赖软件包或者重新找台新的纯净的系统重新开始安装,或者使用Ubuntu Server最新版,一般Ubuntu Server最新版FFmpeg版本还是比较新的,直接执行命令 sudo apt-get install ffmpeg 会自动安装FFmpeg和相关依赖。
2. 有爱专研的或者受制于手头无多余机器的,只能老老实实得卸载旧软件,从头开始编译安装。如何去除旧版本yum安装的相关软件?我们可以借助yum deplist命令先找出所有相关依赖软件包,然后卸载除了公共软件包外的所有软件包。此方法也适用于安装其它软件时遇到类似同样的问题。
yum deplist ffmpeg | grep -v ffmpeg | grep provider | awk '{print $2}' | sort -u
从中挑出非公共软件包的软件包名卸载:
rpm -e --nodeps a52dec dirac dirac-libs faac gsm lame libtheora opencore-amr SDL x264
rpm -e --nodeps $(rpm -qa | grep -i ffmpeg)

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
centos安装oracleJDK
从oracle网站获取下载地址 #jdk地址#=http://www.oracle.com/technetwork/java/javase/downloads/index.html页面中找到要下载的jdk右击,复制链接地址。 wget wget –no-cookies –header “Cookie: oraclelicense=accept-securebackup-cookie;” #jdk地址# 解压jdk tar -xzvf jdk-8u77-linux-x64.tar.gz 移动jdk到/usr/local,建立软连接 mv jdk1.8.0_77/ /usr/local ln -s /usr/local/jdk1.8.0_77/ /usr/local/jdk 编辑/etc/profile vim /etc/profile 加入jdk的配置 JAVA_HOME=/usr/local/jdk PATH= PATH: {JAVA_HOME}/bin export JAVA_HOME PATH 立即生效source source /etc/profile 查看是否安装jdk成功 j...
- 下一篇
CentOS安装Python3
最近在折腾Python,鉴于Python2与Python3的纠结,直接开搞Python3。在CentOS上搞项目,分享下centOS的安装过程。 Python官网:https://www.python.org/,由于官网只为Linux提供了源码,所以通过源码安装。 Step 1. 安装openssl静态库 一定要先安装openssl静态库,若未安装静态库会导致python3自带的pip3安装失败 [plain]view plain copy $yuminstall-yopenssl-static [plain]view plain copy [python]view plain copy step 2. 编译 [plain]view plain copy 便宜Python3的源码,首先要安装GCC,之后再解压代码包,配置安装路径就OK了 1.安装GCC [plain]view plain copy yuminstall-ygcc [plain]view plain copy 2.解压源码包 我下载的是3.5.1版本 [plain]view plain copy $t...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- CentOS7设置SWAP分区,小内存服务器的救世主
- SpringBoot2更换Tomcat为Jetty,小型站点的福音
- CentOS8安装MyCat,轻松搞定数据库的读写分离、垂直分库、水平分库
- CentOS6,CentOS7官方镜像安装Oracle11G
- Jdk安装(Linux,MacOS,Windows),包含三大操作系统的最全安装
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- SpringBoot2全家桶,快速入门学习开发网站教程
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果
- CentOS7安装Docker,走上虚拟化容器引擎之路
- CentOS8编译安装MySQL8.0.19