Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8217
  • 博文数量: 4
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 12
  • 用 户 组: 普通用户
  • 注册时间: 2015-05-29 09:24
个人简介

学不完的知识,做不完的事!

文章分类

全部博文(4)

文章存档

2015年(4)

我的朋友

分类: 网络与安全

2015-05-29 09:31:55

四、配置Nginx,实现VOD,以RTMP方式播放FLV
1. 设置configure,nginx的补充编译,增加FLV和MP4功能。
# cd cd nginx-1.6.0 
# vim nginx_configure.sh
#!/bin/sh

echo "configure start ..."
./configure --prefix=/opt/nginx \
--add-module=../nginx_mod_h264_streaming-2.2.7 \
--with-http_flv_module \
--with-http_ssl_module \
--with-http_mp4_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-pcre=/opt/nginx_http_rtmp/pcre-8.12 \
--with-zlib=/opt/nginx_http_rtmp/soft_source/zlib-1.2.8 \
--user=www --group=www \
--add-module=../nginx-rtmp-module \
--with-cc-opt=-I/opt/ffmpeg/include \
--with-ld-opt=`-L/opt/ffmpeg/lib -Wl, -rpath=/opt/ffmpeg/lib`
echo "configure end!"
【保存并退出】
# chmod +x nginx_configure.sh
# ./nginx_configure.sh
# make && make install

http_flv_module和http_mp4_module即为对应的解析和seek功能支持。

2. 修改 conf/nginx.conf配置
# vim conf/nginx.conf
... 
worker_rlimit_nofile 51200;
events
{
  use epoll;
  worker_connections  51200;
}

# RTMP点播的配置
rtmp {
  server {
    listen 1935;
    chunk_size 4000;
    application vod {
      play /opt/pub/media/nginx/web/vod;  #点播媒体文件存放目录
    }
  }
}

http
{
  ... 
  # 配置RTMP虚拟机
  # VOD for FLV by RTMP
  server
  {
    listen 8080;
    location /stat
    {
      rtmp_stat all;
      rtmp_stat_stylesheet stat.xsl;
    }

    location /stat.xsl
    {
      root /opt/nginx_http_rtmp/nginx-rtmp-module/;   #在nginx-rtmp-module源码根目录
    }
  }
}

3. 启动Nginx
# /opt/nginx/sbin/nginx

4. 创建嵌入播放器的HTML页面
# cd /opt/pub/media/nginx/web
# vim rtmp_player.html

 
   
 


 

 


【保存并退出】

5. 测试
在浏览器输入栏中输入:

阅读(701) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~