nginx搭建支持flv mp4 seek 实现拖拽

wget http://sourceforge.net/projects/pcre/files/pcre/8.12/pcre-8.12.zip/download

wget http://h264.code-shop.com/download/nginx_mod_h264_streaming-2.2.7.tar.gz

wget http://nginx.org/download/nginx-1.0.0.tar.gz
wget http://sourceforge.net/projects/yamdi/files/yamdi/1.8/yamdi-1.8.tar.gz/download


tar zxvf  yamdi-1.8.tar.gz
cd yamdi-1.8
gcc yamdi.c -o yamdi -O2 -Wall

mv yamdi /usr/bin/
注意我们编译的 yamdi 它起着重要的作用,因为一个FLV视频要能够拖拽播放,这个FLV在其 metadata中有关键桢的信息,但大部分FLV 是没有的。所以,我们要甬道开源的yamdi来为视频添加关键帧信息
命令为
yamdi -i input.flv -o out.flv

yamdi的参数:
-i 指定FLV源文件.
-o 指定输出文件,如果文件名为-,则输出到标准输出设备上,如果不指定也是
-x 插入的metadata信息XML文件。如果输出文件省略了,则只生成metadata信息.
-c 一个写入creator标签的字符串.
-l 添加 onLastSecond 行为.
-h 显示帮助信息.


安装nginx

安装nginx之前必须先安装pcre

pcre编译安装需要gcc gcc-c++

yum install gcc gcc-c++ openssl-devel zlib-devel

unzip pcre-8.12.zip

cd pcre-8.12

./configure

make && make install

tar zxvf  nginx_mod_h264_streaming-2.2.7.tar.gz
tar zxvf nginx-1.0.0.tar.gz
cd nginx-1.0.0
./configure  --user=www --group=www --with-http_sub_module --with-http_flv_module  --add-module=../nginx_mod_h264_streaming-2.2.7 --with-http_dav_module --with-http_stub_status_module --with-http_addition_module
configure会有报错如下:
make[1]: *** [objs/addon/src/ngx_http_h264_streaming_module.o] Error 1
make[1]: Leaving directory `/home/mock/BUILD_ROOT/BUILD/nginx-0.8.38′
make: *** [build] Error 2
解决办法:Vim nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c  将如下几行注释
/* TODO: Win32 */
if (r->zero_in_uri)
{
return NGX_DECLINED;
}
make && make install
nginx配置文件
#nginx.conf
worker_processes 1;
events {
    use epoll;
    worker_connections  65535;

}
http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;
    keepalive_timeout 65;
  server {
    listen 80;
    server_name localhost;
    location / {
      root html;
      index index.html index.htm;
    }

    location ~ /.mp4$ {
      mp4;
    }
    location ~ /.flv$ {
      flv;
    }
    error_page 500 502 503 504 /50x.html;
      location = /50x.html {
      root html;
      }
  }
}
命令测试:
curl -v http://xx.xx.com/resbase/2010/06/baihezhengdan.flv?start=10240000 -o /dev/null
找个支持seek(拖拽)的播放器JWplayer
http://www.longtailvideo.com/support/jw-player-setup-wizard

 

转自 http://hi.baidu.com/hanwei1980/blog/item/45185da9d5a46dea1e17a293.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值