CentOS 6.3(x64) 下文档转换与视频自动转码构架的部署
CentOS 6.3(x64) 下文档转换构架的部署
CentOS 6.3(x64) 下文档转换构架的部署
版权所有:http://www.vodcms.com 撰写人:马哈鱼 时间:2013-3-21 12:36 版本ver 1.0
安装所需库与依赖文件
yum install gcc* automake zlib-devel libjpeg-devel giflib-devel freetype-devel -y
下载&编译pdf转换工具swftools(将pdf转为swf)
wget http://www.swftools.org/swftools-0.9.2.tar.gz
tar zxf swftools-0.9.2.tar.gz
cd swftools-0.9.2
./configure --prefix=/opt/swftools
make && make install
安装openOffice(主要提供将文档转为pdf)
安装依赖文件
yum install openoffice.org-core openoffice.org-headless openoffice.org-base openoffice.org-calc openoffice.org-writer openoffice.org-impress openoffice.org-draw openoffice.org-graphicfilter openoffice.org-pyuno openoffice.org-xsltfilter openoffice.org-math -y
yum install poppler poppler-utils poppler-devel -y
启动openoffice服务
/usr/lib64/libreoffice/program/soffice.bin "--accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" --norestore --nofirststartwizard --nologo --headless &
转换脚本
wget http://downloads.sourceforge.net/project/jodconverter/JODConverter/2.2.2/jodconverter-2.2.2.zip
unzip jodconverter-2.2.2.zip
mv jodconverter-2.2.2 /usr/src
编写文档转到pdf脚本
vi /usr/bin/doc2pdf
java -jar /usr/src/jodconverter-2.2.2/lib/jodconverter-cli-2.2.2.jar -f pdf $1
保存
chmod 755 /usr/bin/doc2pdf
文件转换到测试
doc2pdf test.doc
pdf转到swf命令
/opt/swftools/pdf2swf test.doc test.doc
CentOS 6.3(x64) 流媒体平台的搭建
相关软件下载
wget http://nginx.org/download/nginx-1.2.7.tar.gz
yum install git -y
git clone https://github.com/arut/nginx-rtmp-module.git
tar zxf nginx-1.2.7.tar
cd nginx-1.2.7
yum install pcre pcre-devel openssl-devel -y
./configure --prefix=/op/nginx --with-http_mp4_module --with-http_stub_status_module --add-module=../nginx-rtmp-module
make
make install
到这里软件安装已经完成
下面配置rtmp流服务器。
例如视频存放目录是/vod
在配置文件末尾追加配置
vi /opt/nginx/conf/nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 4086;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 10;
#gzip on;
server {
listen 1982;
server_name localhost;
charset utf-8;
#access_log logs/host.access.log main;
root /vod;
index index.html index.htm;
location / {
limit_rate_after 5m;
limit_rate 500k;
}
location /vod {
root /vod;
limit_rate_after 5m;
limit_rate 500k;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
rtmp {
server {
listen 1935;
chunk_size 4000;
application vod {
play /vod;
}
}
}
保存退出后启动nginx
/opt/nginx/sbin/nginx
IOS点播时候分别用 http://ip:1982/test.mp4
PC点播用 rtmp://ip/vod/mp4:/test.mp4
CENTOS下面转码软件的安装与使用
使用命令行工具进行视频编码转换,首先下载个handbrake。优点是速度快
yum install patch patch-* libtool-* -y
yum install libtool jam rpmdevtools bzip2-devel zlib-devel yasm-devel yasm intltool gcc-c++ make -y
cd /etc/yum.repos.d/
wget http://pkgrepo.linuxtech.net/el6/testing/linuxtech.repo
yum install handbrake-cli -y
转码命令行(下面命令行的意思是把/vod/1.avi的文件转码为h264格式,同时控制画面宽度不大于720像素,并且对文件进行web优化 保存到/vod/1.mp4)
HandBrakeCLI -i /vod/1.avi -o /vod/1.mp4 -e x264 -E faac -6 dpl2 -D 0.0 -f mp4 -4 -X 720 -O
转于 http://www.vodcms.com/archives/346
浙公网安备 33010602011771号