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

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

文章分类

全部博文(4)

文章存档

2015年(4)

我的朋友

分类: 网络与安全

2015-05-29 09:32:02

五、配置Nginx, 实现LIVE、以RTMP方式进行直播
1. 配置conf/nginx.conf
...
rtmp {
  server {
    listen 1935;
    chunk_size 4000;
    application vod {
      play /opt/pub/media/nginx/web/vod;
    }

    # Setting for LIVE
    application live {
      live on;
    }
  }
}
http
{
  ...
  # LIVE and VOD 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/;
    }
  }
}

2. 重新加载Nginx
# /opt/nginx/sbin/nginx -s reload

3. 准备网页 rtmp_live.html
下载播放器jwplayer,并新建网页


 



 

 



4. 在浏览器输中输入


5. 用nginx-rtmp-module自带的一个例子修改,在test/rtmp-publisher目录下player.html

  RTMP Player

  

  

Flash not installed

访问/player.html


6. 使用ffmpeg推流
用ffmpeg产生一个模拟直播源,向rtmp服务器推送
# ./ffmpeg –i/usr/local/nginx/vod/flvs/a.flv-strict -2 -c:v libx264 -c:a aac -f flv rtmp://192.168.1.4/live/test

注意,
源文件必须是H.264+AAC编码的。
192.168.1.4是运行nginx的服务器IP,
live是applicatioin,
test是直播缓存流文件,需要与配置文件中的直播缓存文件名一样。

六、配置Nginx 支持HLS
暂时没有做测试,可见其它网文;
阅读(1108) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~