Nginx搭建flv视频网站(关键帧拖动)
1、安装zlib#tar xf zlib-1.2.3.tar.gz#cd zlib-1.2.3#./configure#make && make install2、安装pcre#tar zxvf pcre-7.9.tar.gz#cd pcre-7.9#./configure --prefix=/usr/local/pcre#make && ma...
1、安装zlib
#tar xf zlib-1.2.3.tar.gz #cd zlib-1.2.3 #./configure #make && make install |
2、安装pcre
#tar zxvf pcre-7.9.tar.gz #cd pcre-7.9 #./configure --prefix=/usr/local/pcre #make && make install |
3、安装配置nginx
#tar zxvf nginx-1.5.3.tar.gz #cd nginx-1.5.3 #./configure --with-http_ssl_module --with-pcre=/usr/src/pcre-7.9 --with-zlib=/usr/src/zlib-1.2.3 --prefix=/usr/local/nginx --with-http_flv_module --with-http_stub_status_module |
做到这里出现一个报错,
报错:./configure: error: SSL modules require the OpenSSL library.
原因:添加支持--with-http_ssl_module模块时发现服务器没有安装openssl相关开发库
解决:yum -y install openssl-devel*,重新configure后继续下一步
#make && make install |
4、安装yamdi(添加关键帧的工具)
#tar xzvf yamdi-1.4.tar.gz #cd yamdi-1.4 #make && make install |
使用方法:yamdi -i 源视频 -o 添加关键帧后视频
ps:yamdi -i a.flv -o test.flv
将添加过关键帧的视频文件放到/usr/local/nginx/html/flv文件夹下
5、配置nginx
#cat nginx.conf user nobody; worker_processes 2; error_log /usr/local/nginx/logs/error.log; pid /usr/local/nginx/logs/nginx.pid; events { use epoll; worker_connections 65535; } http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] ' '"$request" $status $bytes_sent ' '"$http_referer" "$http_user_agent" ' '"$gzip_ratio"'; keepalive_timeout 60; server_names_hash_bucket_size 128; client_header_buffer_size 32k; large_client_header_buffers 4 32k; access_log off; gzip on; gzip_min_length 1100; gzip_buffers 4 8k; gzip_types text/plain; output_buffers 1 32k; postpone_output 1460; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m;
sendfile on; tcp_nopush on; tcp_nodelay on;
server { listen 80; server_name 192.168.8.2; root /usr/local/nginx/html/flv/; limit_rate_after 5m; limit_rate 512k; index index.html; charset utf-8; location ~ \.flv { flv; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } |
配置到这里似乎完成了?no,我们还要将其嵌入到页面中去。编辑一个名为test.html的测试页面,内容如下:
#cat test.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> </head> <body> <embed type="application/x-shockwave-flash" id="player2" name="player2" src="player.swf" width="328" height="200" allowscriptaccess="always" allowfullscreen="true" flashvars="file=http://192.168.8.2/test.flv&p_w_picpath=http://192.168.8.2/preview.jpg&autostart=false&type=http&streamer=start"> </embed> </body> </html> |
将test.html文件放到/usr/local/nginx/html/flv文件夹下,访问192.168.8.2/test.html,效果如下图:
大功告成~
转载于:https://blog.51cto.com/cnlinux/1428330
更多推荐
所有评论(0)