通过Nginx搭建flv流媒体服务器。

     
      Nginx中的Flv Stream模块能实现flv流媒体的功能,而且支持flv视频进度条拖拽,以下搭建过程使用的Debian 5.0.7<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

srv75:~# apt-get -y install zlibc libpcre++-dev bzip2 autoconf automake g++ gcc make libssl-dev

2、使用如下命令下载并编译安装Nginx

srv75:~# useradd nginx -s /usr/sbin/nologin

srv75:~# cd /usr/src

srv75:src# wget http://nginx.org/download/nginx-1.0.0.tar.gz

srv75:src# tar -xvzf nginx-1.0.0.tar.gz

srv75:src# cd nginx-1.0.0

srv75:nginx-1.0.0# ./configure --with-http_ssl_module --with-pcre=/usr/local/pcre/   \

--with-zlib=/usr/local/zlib/ --user=nginx --group=nginx \

--prefix=/usr/local/nginx --with-http_flv_module

srv75:nginx-1.0.0# make && make install

3、使用如下命令安装yamdiyadmi的作用是为flv文件添加关键帧,才能实现拖动播放。

srv75:~# apt-get -y install yamdi

4、修改/usr/local/nginx/conf/nginx.conf文件如下内容。

user  nginx nginx;

worker_processes 30;

error_log  /usr/local/nginx/logs/error.log  crit;

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.159.75;

root    /usr/local/nginx/html/flv/;

index   index.html;

charset utf-8;

 

#flv视频文件下载了10M以后开始限速。

limit_rate_after 10m;    

#速度限制为512K

limit_rate 512k; 

 

location ~ \.flv {

flv;

}

error_page   500 502 503 504  /50x.html;

location = /50x.html {

root   html;

}

}

 

}

5、启动Nginx后配置完成后即可,将flv的文件通过如下命令添加关键帧后,放到/usr/local/nginx/html/flv/目录后,只将一个支持拖拽播放的flash播放器(比如JW Player)放到/usr/local/nginx/html/flv/目录就可以播放http://192.168.159.75/output.flv文件了。

srv75:flv# yamdi -i input.flv -o output.flv

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值