nginx_rtmp 实现mpeg-dash流推送

参考来源  https://habrahabr.ru/post/204666/



一 nginx 配置  

   nginx.conf   内容如下

#user  nobody;
worker_processes  1;

error_log  logs/error.log debug;

events {
    worker_connections  1024;
}

rtmp {
    server {
        listen 1935;

      
        application myapp {
            live on;
            dash on;
            dash_path /tmp/dash;
        }
    }
}


http {
    server {
        listen 8080;

        location /dash {
            root /tmp;
            add_header Cache-Control no-cache;
	    add_header 'Access-Control-Allow-Origin' '*';
        }
         location /dash.js {          //dash.js 安装目录下的baseline.html ,提供播放dash流的例子
           root /home/cyf/Downloads;
         	   
          }
    }
}

开启  /usr/local/nginx/sbin/nginx 

关闭 /usr/local/nginx/sbin/nginx  -s stop

二 ffmpeg 推送流

./ffmpeg -re -i /home/cyf/Videos/tree.mp4 -c copy -f flv rtmp://localhost/myapp/mystream    //不转码
./ffmpeg -re -i /home/cyf/Videos/tree.mp4 -vcodec libx264 -vprofile baseline -g 30 -acodec aac -strict -2 -f flv rtmp://localhost/myapp/mystream  //转码

三 浏览器播放

 使用firefox 
  本地播放 : 直接浏览器输入 http://localhost:8080/dash.js/baseline.html   读取baseline.html内容 其中的mpd url为
http://localhost:8080/dash/mystream.mpd
 远端播放:浏览器打开baseline.html 需要加载dash.all.js

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值