在CentOS7 下安装 ffmpeg,mplayer,swftools
时间:2017-06-10 12:03 来源:linux.it.net.cn 作者:IT
ffmpeg (官网:http://ffmpeg.org/download.html)
$ wget http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz
解压
$ tar -xvf ffmpeg-release-64bit-static.tar.xz
完成。
$ ./ffmpeg --help 即可。
--------------------------------------------------------------------------------------------------------------
mencoder (mplayer)
Binary Codec Packages (http://svn.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-20071007.tar.bz2)
$ wget http://svn.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2
tar -xvf all-20110131.tar.bz2
mkdir -p /data/tools/mplayer/lib
cp -R all-20110131 /data/tools/mplayer/lib/codecs
需要下载源码并编译安装
yasm (http://yasm.tortall.net/releases/Release1.3.0.html)
$ wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
$ tar -xzvf yasm-1.3.0.tar.gz
$ cd yasm-1.3.0
$ ./configure
$ make check
$ make
$ make install
lame (http://sourceforge.net/projects/lame/ )
$ wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
$ ./configure --enable-shared
$ make
$ make install
下载mplayer
$ wget http://svn.mplayerhq.hu/MPlayer/releases/MPlayer-1.1.1.tar.xz
编译mplayer
./configure --codecsdir=/data/tools/mplayer/lib/codecs --language=zh_CN --prefix=/data/tools/mplayer
make
make install
运行测试
mencoder
ldd mencoder
如果不能执行,则继续,如能能执行,下边操作不用继续设置。
#检查是否有这个文件,如果没有创建
sudo vim /etc/ld.so.conf.d/usr.local.lib.conf
加入
/usr/local/lib
保存退出
使配置文件生效
sudo ldconfig
检查是否生效
strings /etc/ld.so.cache | grep libmp
最后,修改文件夹宿主
chown -R root:root /data/tools/
另外:
如果编译完成后,/home/lifw/all-codecs-20110131 这个里面的解码器是否还需要,如果不需要,是否删除?
------------------------------------------------------------------------
测试脚本命令:
/data/tools/ffmpeg/ffmpeg -i "/home/lifw/a.mp4" -y -r 12 -b 500 -qscale 1 "/home/lifw/a.mp4.flv"
/data/tools/ffmpeg/ffmpeg -i "/home/lifw/a.3gp" -y -r 12 -b 500 -qscale 1 "/home/lifw/a.3gp.flv"
/data/tools/mplayer/bin/mencoder -quiet "/home/lifw/a.3gp" -o "/home/lifw/a.3gp.flv" -vf harddup -af channels=2 -ofps 30.291 -srate 44100 -oac mp3lame -lameopts abr:br=128 -ovc lavc -of lavf -lavfopts format=flv -lavcopts vcodec=flv:vbitrate=512:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:aspect=3/2 -mc 1
-----------------------------------------------------------------------------
swftools 编译安装
1.安装编译c++环境
sudo yum install gcc-c++
2.安装字体编译环境
sudo yum install freetype-devel
3.安装giflib-devel
yum install giflib-devel
4.安装jpeglib
$ wget http://www.ijg.org/files/jpegsrc.v8d.tar.gz
$ tar -xzvf jpegsrc.v8d.tar.gz
$ cd jpegsrc.v8d
$ ./configure
$ make
$ sudo make install
5.将/usr/local/lib添加上全局环境变量中
临时解决办法
ldconfig /usr/local/lib
永久生效办法
#检查是否有这个文件,如果没有创建
sudo vim /etc/ld.so.conf.d/usr.local.lib.conf
加入
/usr/local/lib
保存退出
使配置文件生效
sudo ldconfig
6.编译安装swftools
$ wget http://www.swftools.org/swftools-0.9.2.tar.gz
$ tar -zxvf swftools-0.9.2.tar.gz
$ ./configure
$ make
$ sudo make install
注意:
执行 make install
可能遇到的问题
make[1]: *** [install] 错误 1
make[1]: Leaving directory `/root/swftools-0.9.2/swfs'
make: *** [install] 错误 2
解决方法:
将swfs目录下的Makefile和Makefile.in两个文件中的 -o -L 去掉
7.安装xpdf中文字体
$ wget ftp://ftp.foolabs.com/pub/xpdf/xpdf-chinese-simplified.tar.gz
$ tar -xzvf xpdf-chinese-simplified.tar.gz
$ mv xpdf-chinese-simplified chinese-simplified
字体
$ wget http://ftp.gnu.org/gnu/non-gnu/chinese-fonts-truetype/gkai00mp.ttf.gz
$ wget http://ftp.gnu.org/gnu/non-gnu/chinese-fonts-truetype/gbsn00lp.ttf.gz
$ gunzip -c gkai00mp.ttf.gz > gkai00mp.ttf
$ gunzip -c gbsn00lp.ttf.gz > gbsn00lp.ttf
$ mv gkai00mp.ttf chinese-simplified/CMap/
$ mv gbsn00lp.ttf chinese-simplified/CMap/
编辑配置文件
$ cd /usr/local/share
$ sudo mkdir xpdf
$ sudo cp -R ~/chinese-simplified ./xpdf/
$ sudo vim ./xpdf/chinese-simplified/add-to-xpdfrc
内容如下:
#----- begin Chinese Simplified support package (2011-sep-02)
cidToUnicode Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/Adobe-GB1.cidToUnicode
unicodeMap ISO-2022-CN /usr/local/share/xpdf/chinese-simplified/ISO-2022-CN.unicodeMap
unicodeMap EUC-CN /usr/local/share/xpdf/chinese-simplified/EUC-CN.unicodeMap
unicodeMap GBK /usr/local/share/xpdf/chinese-simplified/GBK.unicodeMap
cMapDir Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/CMap
toUnicodeDir /usr/local/share/xpdf/chinese-simplified/CMap
displayCIDFontTT Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/CMap/gkai00mp.ttf
#fontFileCC Adobe-GB1 /usr/..../gkai00mp.ttf
#----- end Chinese Simplified support package
保存退出
测试
pdf2swf -t "~/a.pdf" -o "~/a.pdf.swf" -s flashversion=9 -s poly2bitmap -s languagedir="/usr/local/share/xpdf/chinese-simplified/";
备份中文字体文件夹
$ cd /usr/local/share/
$ sudo tar -czvf xpdf.tar.gz xpdf/
$ sudo mv xpdf.tar.gz ~/
参考资料:
http://blog.itpub.net/29754888/viewspace-1320143/
http://wiki.swftools.org/wiki/Installation
-----------------------------------------------------------------------------
(责任编辑:IT)
ffmpeg (官网:http://ffmpeg.org/download.html) $ wget http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz 解压 $ tar -xvf ffmpeg-release-64bit-static.tar.xz 完成。 $ ./ffmpeg --help 即可。 -------------------------------------------------------------------------------------------------------------- mencoder (mplayer) Binary Codec Packages (http://svn.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-20071007.tar.bz2) $ wget http://svn.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2 tar -xvf all-20110131.tar.bz2 mkdir -p /data/tools/mplayer/lib cp -R all-20110131 /data/tools/mplayer/lib/codecs 需要下载源码并编译安装 yasm (http://yasm.tortall.net/releases/Release1.3.0.html) $ wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz $ tar -xzvf yasm-1.3.0.tar.gz $ cd yasm-1.3.0 $ ./configure $ make check $ make $ make install lame (http://sourceforge.net/projects/lame/ ) $ wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz $ ./configure --enable-shared $ make $ make install 下载mplayer $ wget http://svn.mplayerhq.hu/MPlayer/releases/MPlayer-1.1.1.tar.xz 编译mplayer ./configure --codecsdir=/data/tools/mplayer/lib/codecs --language=zh_CN --prefix=/data/tools/mplayer make make install 运行测试 mencoder ldd mencoder 如果不能执行,则继续,如能能执行,下边操作不用继续设置。 #检查是否有这个文件,如果没有创建 sudo vim /etc/ld.so.conf.d/usr.local.lib.conf 加入 /usr/local/lib 保存退出 使配置文件生效 sudo ldconfig 检查是否生效 strings /etc/ld.so.cache | grep libmp 最后,修改文件夹宿主 chown -R root:root /data/tools/ 另外: 如果编译完成后,/home/lifw/all-codecs-20110131 这个里面的解码器是否还需要,如果不需要,是否删除? ------------------------------------------------------------------------ 测试脚本命令: /data/tools/ffmpeg/ffmpeg -i "/home/lifw/a.mp4" -y -r 12 -b 500 -qscale 1 "/home/lifw/a.mp4.flv" /data/tools/ffmpeg/ffmpeg -i "/home/lifw/a.3gp" -y -r 12 -b 500 -qscale 1 "/home/lifw/a.3gp.flv" /data/tools/mplayer/bin/mencoder -quiet "/home/lifw/a.3gp" -o "/home/lifw/a.3gp.flv" -vf harddup -af channels=2 -ofps 30.291 -srate 44100 -oac mp3lame -lameopts abr:br=128 -ovc lavc -of lavf -lavfopts format=flv -lavcopts vcodec=flv:vbitrate=512:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:aspect=3/2 -mc 1 ----------------------------------------------------------------------------- swftools 编译安装 1.安装编译c++环境 sudo yum install gcc-c++ 2.安装字体编译环境 sudo yum install freetype-devel 3.安装giflib-devel yum install giflib-devel 4.安装jpeglib $ wget http://www.ijg.org/files/jpegsrc.v8d.tar.gz $ tar -xzvf jpegsrc.v8d.tar.gz $ cd jpegsrc.v8d $ ./configure $ make $ sudo make install 5.将/usr/local/lib添加上全局环境变量中 临时解决办法 ldconfig /usr/local/lib 永久生效办法 #检查是否有这个文件,如果没有创建 sudo vim /etc/ld.so.conf.d/usr.local.lib.conf 加入 /usr/local/lib 保存退出 使配置文件生效 sudo ldconfig 6.编译安装swftools $ wget http://www.swftools.org/swftools-0.9.2.tar.gz $ tar -zxvf swftools-0.9.2.tar.gz $ ./configure $ make $ sudo make install 注意: 执行 make install 可能遇到的问题 make[1]: *** [install] 错误 1 make[1]: Leaving directory `/root/swftools-0.9.2/swfs' make: *** [install] 错误 2 解决方法: 将swfs目录下的Makefile和Makefile.in两个文件中的 -o -L 去掉 7.安装xpdf中文字体 $ wget ftp://ftp.foolabs.com/pub/xpdf/xpdf-chinese-simplified.tar.gz $ tar -xzvf xpdf-chinese-simplified.tar.gz $ mv xpdf-chinese-simplified chinese-simplified 字体 $ wget http://ftp.gnu.org/gnu/non-gnu/chinese-fonts-truetype/gkai00mp.ttf.gz $ wget http://ftp.gnu.org/gnu/non-gnu/chinese-fonts-truetype/gbsn00lp.ttf.gz $ gunzip -c gkai00mp.ttf.gz > gkai00mp.ttf $ gunzip -c gbsn00lp.ttf.gz > gbsn00lp.ttf $ mv gkai00mp.ttf chinese-simplified/CMap/ $ mv gbsn00lp.ttf chinese-simplified/CMap/ 编辑配置文件 $ cd /usr/local/share $ sudo mkdir xpdf $ sudo cp -R ~/chinese-simplified ./xpdf/ $ sudo vim ./xpdf/chinese-simplified/add-to-xpdfrc 内容如下: #----- begin Chinese Simplified support package (2011-sep-02) cidToUnicode Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/Adobe-GB1.cidToUnicode unicodeMap ISO-2022-CN /usr/local/share/xpdf/chinese-simplified/ISO-2022-CN.unicodeMap unicodeMap EUC-CN /usr/local/share/xpdf/chinese-simplified/EUC-CN.unicodeMap unicodeMap GBK /usr/local/share/xpdf/chinese-simplified/GBK.unicodeMap cMapDir Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/CMap toUnicodeDir /usr/local/share/xpdf/chinese-simplified/CMap displayCIDFontTT Adobe-GB1 /usr/local/share/xpdf/chinese-simplified/CMap/gkai00mp.ttf #fontFileCC Adobe-GB1 /usr/..../gkai00mp.ttf #----- end Chinese Simplified support package 保存退出 测试 pdf2swf -t "~/a.pdf" -o "~/a.pdf.swf" -s flashversion=9 -s poly2bitmap -s languagedir="/usr/local/share/xpdf/chinese-simplified/"; 备份中文字体文件夹 $ cd /usr/local/share/ $ sudo tar -czvf xpdf.tar.gz xpdf/ $ sudo mv xpdf.tar.gz ~/ 参考资料: http://blog.itpub.net/29754888/viewspace-1320143/ http://wiki.swftools.org/wiki/Installation ----------------------------------------------------------------------------- (责任编辑:IT) |