Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7774848
  • 博文数量: 701
  • 博客积分: 2150
  • 博客等级: 上尉
  • 技术积分: 13233
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-29 16:28
个人简介

天行健,君子以自强不息!

文章分类

全部博文(701)

文章存档

2019年(2)

2018年(12)

2017年(76)

2016年(120)

2015年(178)

2014年(129)

2013年(123)

2012年(61)

分类: 网络与安全

2014-07-02 14:17:10

四、配置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. 测试
在浏览器输入栏中输入:

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