All Projects → Tinywan → Rtmp Ts Dash Webrtc

Tinywan / Rtmp Ts Dash Webrtc

👾 音视频解决方案 Audio and video solutions(AV1)

Projects that are alternatives of or similar to Rtmp Ts Dash Webrtc

Awesome Live Stream
Webrtc && Nginx && DASH && Quic 学习资料收集,持续更新中
Stars: ✭ 290 (+124.81%)
Mutual labels:  ffmpeg, dash, webrtc, hls, rtmp, nginx
Janus Webrtc Gateway Docker
Perfect Docker Image for Media Streaming Expert User ( https://github.com/meetecho/janus-gateway )
Stars: ✭ 582 (+351.16%)
Mutual labels:  ffmpeg, dash, webrtc, hls, rtmp, nginx
smart rtmpd
RTMP server, smart, compact, high performance(c, c++), high concurrency, easy to maintain, easy to deploy, (supports multiple operating systems Windows and Linux, ARM, FreeBSD)
Stars: ✭ 159 (+23.26%)
Mutual labels:  ffmpeg, hls, rtmp, dash
Html5 Dash Hls Rtmp
🌻 HTML5播放器、M3U8直播/点播、RTMP直播、低延迟、推流/播流地址鉴权
Stars: ✭ 1,805 (+1299.22%)
Mutual labels:  dash, webrtc, hls, rtmp
Rtp Streamer
rtp record and rtp streamer
Stars: ✭ 60 (-53.49%)
Mutual labels:  ffmpeg, webrtc, rtmp
Python Ffmpeg Video Streaming
📼 Package media content for online streaming(DASH and HLS) using FFmpeg
Stars: ✭ 269 (+108.53%)
Mutual labels:  ffmpeg, dash, hls
Abr Broadcaster
A real time encoder for Adaptive Bitrate Broadcast
Stars: ✭ 80 (-37.98%)
Mutual labels:  ffmpeg, dash, hls
Awesome Video
A curated list of awesome streaming video tools, frameworks, libraries, and learning resources.
Stars: ✭ 397 (+207.75%)
Mutual labels:  ffmpeg, dash, hls
Monibuca
🧩 Monibuca is a Modularized, Extensible framework for building Streaming Server
Stars: ✭ 307 (+137.98%)
Mutual labels:  webrtc, hls, rtmp
Iptv
一键安装管理 FFmpeg / nginx / openresty / xray / v2ray / armbian / proxmox / cloudflare partner,workers / ibm cloud foundry 脚本
Stars: ✭ 481 (+272.87%)
Mutual labels:  ffmpeg, hls, nginx
Ffmpeg
Mirror of https://git.ffmpeg.org/ffmpeg.git
Stars: ✭ 27,382 (+21126.36%)
Mutual labels:  ffmpeg, hls, rtmp
Zlmediakit
WebRTC/RTSP/RTMP/HTTP/HLS/HTTP-FLV/WebSocket-FLV/HTTP-TS/HTTP-fMP4/WebSocket-TS/WebSocket-fMP4/GB28181 server and client framework based on C++11
Stars: ✭ 5,248 (+3968.22%)
Mutual labels:  hls, rtmp, webrtc
Dockerfiles
Optimized media, analytics and graphics software stack images. Use the dockerfile(s) in your project or as a recipe book for bare metal installation.
Stars: ✭ 98 (-24.03%)
Mutual labels:  ffmpeg, rtmp, webrtc
wsa
WSA(Websocket Streaming Agent) is a stream server target for mp4/h264 streaming over websocket
Stars: ✭ 35 (-72.87%)
Mutual labels:  hls, rtmp, dash
Docker Nginx Rtmp
🐋 A Dockerfile for nginx-rtmp-module + FFmpeg from source with basic settings for streaming HLS. Built on Alpine Linux.
Stars: ✭ 608 (+371.32%)
Mutual labels:  ffmpeg, hls, rtmp
Ffplayout Engine
python and ffmpeg based playout
Stars: ✭ 128 (-0.78%)
Mutual labels:  ffmpeg, hls, rtmp
Php Practice
🌹 一天一点点,积少成多...
Stars: ✭ 351 (+172.09%)
Mutual labels:  ffmpeg, hls, rtmp
Digital video introduction
A hands-on introduction to video technology: image, video, codec (av1, vp9, h265) and more (ffmpeg encoding).
Stars: ✭ 12,184 (+9344.96%)
Mutual labels:  ffmpeg, dash, hls
Php Ffmpeg Video Streaming
📼 Package media content for online streaming(DASH and HLS) using FFmpeg
Stars: ✭ 246 (+90.7%)
Mutual labels:  ffmpeg, dash, hls
Analysisavp
音视频学习,相关文件格式/协议分析。h264 nalu aac adts flv
Stars: ✭ 38 (-70.54%)
Mutual labels:  ffmpeg, webrtc, rtmp

NGINX MPEG-TS Live Module & Dash JS

目录

  • 典型业务场景
  • 解决方案架构
  • 直播流程
  • 流媒体直播功能
  • WEB 直播技术
    • RTSP 协议
    • RTMP 协议
    • HLS 协议
    • HLS 与 RTMP 对比
  • 环境搭建
  • NGINX-RTMP-TS-DASH 直播方案
  • HTML5 标准
  • HLS 标准
  • WebRTC 标准
  • 参考资料

直播流程

  • 视频直播:采集、前处理、编码、传输、解码、渲染

  • 采集: 一般是由客户端(IOS、安卓、PC或其它工具,如OBS)完成的,iOS是比较简单的,Android则要做些机型适配工作,PC最麻烦各种奇葩摄像头驱动。

  • 前期处理: 主要是处理直播美颜,美颜算法需要用到GPU编程,需要懂图像处理算法的人,没有好的开源实现,要自己参考论文去研究。难点不在于美颜效果,而在于GPU占用和美颜效果之间找平衡。

  • 编码: 要采用硬编码,软编码720p完全没希望,勉强能编码也会导致CPU过热烫到摄像头。编码要在分辨率,帧率,码率,GOP等参数设计上找到最佳平衡点。

  • 传输: 一般交给了CDN服务商,如:阿里云、腾讯云。

  • 解码: 是对之前编码的操作,进行解码,在 web 里需要解码是hls。

  • 渲染: 主要用播放器来解决,web中常用到的播放器有video.js,更多:html5-dash-hls-rtmp

  • 下面是腾讯云直播方案的整个流程图:

    Markdown

流媒体直播功能

  • 支持的直播流输入协议是

    • RTMP 用于拉取和发布的流
    • RTSP 为拉和宣布的流
    • 用于HTTP和UDP流的 MPEG-TS
    • SRT 用于听,拉和集合模式
    • UDT 用于听,拉和集合模式
    • HLS 为拉流
  • 单路路实时编码流传递(RTMP)

Markdown

  • 多路实时编码流传递(RTMP)

Markdown

环境搭建

  • 服务与模块

    • 1、Openresty下载

      https://openresty.org/download/openresty-1.11.2.3.tar.gz
      
    • 2、nginx-ts-module下载

      git clone https://github.com/arut/nginx-ts-module.git
      
    • 3、ffmpeg 下载安装

  • 动态编译安装

    • 1、Openresty环境配置

      apt-get install libreadline-dev libncurses5-dev libpcre3-dev \
      libssl-dev perl make build-essential
      
    • 2、动态编译安装

      ./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module \
      --with-http_iconv_module --add-dynamic-module=/root/nginx-ts-module
      ...
      make -j4
      ...
      sudo make install
      
    • 3、配置文件

      • nginx.conf

        # vim /opt/openresty/nginx/conf/nginx.conf
        error_log  logs/error.log;
        
        pid        logs/nginx.pid;
        
        load_module "/opt/openresty/nginx/modules/ngx_http_ts_module.so"; # 加载模块
        
        events {
        }
        
        http {
            server {
                listen 8000;
        
                location / {
                    root html;
                }
        
                location /publish/ {
                    ts;
                    ts_hls path=/var/media/hls segment=10s;
                    ts_dash path=/var/media/dash segment=10s;
        
                    client_max_body_size 0;
                }
        
                location /play/ {
                    add_header Cache-Control no-cache;
                    add_header 'Access-Control-Allow-Origin' '*' always;
                    add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
                    add_header 'Access-Control-Allow-Headers' 'Range';
        
                    types {
                        application/x-mpegURL m3u8;
                        application/dash+xml mpd;
                        video/MP2T ts;
                        video/mp4 mp4;
                    }
                    alias /var/media/;
                }
            }
        }
        
      • 流媒体存放文件夹建立

        cd /var & makedir media
        cd media & makedir hls & makedir dash
      
    • 4、FFmpeg推流 ​

      ffmpeg -re -i rtmp://live.hkstv.hk.lxdns.com/live/hks -bsf:v h264_mp4toannexb \
      -c copy -f mpegts http://127.0.0.1:8000/publish/sintel
      
    • 5、客户端播放

      <script src="http://cdn.dashjs.org/latest/dash.all.min.js"></script>
      <style>
          video {
              width: 640px;
              height: 360px;
          }
      </style>
      <div>
          <video data-dashjs-player autoplay src="http://1127.0.0.1:8000/play/dash/sintel/index.mpd" 
              controls></video>
      </div>
      
    • 6、如果不使用 ffmpeg 直接拉流到http://127.0.0.1:8000/publish/sintel 服务的解决方案?

      • (1)nginx-rtmp-module下载

        git clone https://github.com/arut/nginx-rtmp-module.git

      • (2)和安装nginx-ts-module模块一样动态编译安装既可以,最后别忘记了的在配置文件load nginx-rtmp-module.so文件

      • (3)按照这个顺序:OBS => nginx-rtmp => nginx-ts推流,OBS也可以是别的网络推流设备

      • (4)通过以上我们可以不直接使用ffmpeg 去推流了,而是在Windows端口可以通过OBS很简单的去推流了

      • (5)使用VLC播放器测试,结果OK!

    • 7、总结,一切顺利通过。

  • 通过SSL加密和公开HLS媒体的来源(HLS)

Markdown

NGINX-RTMP-TS-DASH 直播方案

  • HLS、MPEG-DASH多路输入/输出流(HLS、MPEG-DASH)

Markdown

  • 编译安装

    • 1、下载nginx-rtmp-module模块:

      git clone https://github.com/arut/nginx-rtmp-module.git
      
    • 2、配置 --with-http_xslt_module 时提示 the HTTP XSLT module requires the libxml2/libxslt libraries,安装以下: ​

      sudo apt-get install libxml2 libxml2-dev libxslt-dev
      sudo apt-get install libgd2-xpm libgd2-xpm-dev
      
    • 3、通过configure命令生成Makefile文件,为下一步的编译做准备:

      ./configure --prefix=/opt/openresty --with-luajit --without-http_redis2_module --with-http_iconv_module \ 
      --with-http_stub_status_module --with-http_xslt_module --add-dynamic-module=/root/nginx-ts-module \
      --add-dynamic-module=/root/nginx-rtmp-module
      
    • 4、如果报下面的错误

      platform: linux (linux)
          you need to have ldconfig in your PATH env when enabling luajit.
      

      是因为找不到命令ldconfig, 这个命令一般是在/sbin/目录下的,所以先执行export PATH=$PATH:/sbin

    • 5、如果出现:./configure: error: the HTTP XSLT module requires the libxml2/libxslt 错误,安装以下:

      sudo apt-get install libxml2 libxml2-dev libxslt-dev
      
  • nginx.conf 配置

    # vim /opt/openresty/nginx/conf/nginx.conf
    user  www;
    worker_processes  1;
    
    error_log  logs/error.log;
    
    pid        logs/nginx.pid;
    
    load_module "/opt/openresty/nginx/modules/ngx_http_ts_module.so";
    load_module "/opt/openresty/nginx/modules/ngx_rtmp_module.so";
    
    events {
        worker_connections  1024;
    }
     
     http {
         server {
             listen 8000;
     
             # This URL provides RTMP statistics in XML
             location /stat {
                rtmp_stat all;
                rtmp_stat_stylesheet stat.xsl;
             }
     
             location /stat.xsl {
                root html;
             }
     
             location /hls {
                 # Serve HLS fragments
                add_header Cache-Control no-cache;
                add_header 'Access-Control-Allow-Origin' '*' always;
                add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
                add_header 'Access-Control-Allow-Headers' 'Range';
            
                types {
                    application/vnd.apple.mpegurl m3u8;
                    video/mp2t ts;
                }
            
                root /tmp;
             }
    
             location /dash {
                 # Serve DASH fragments
                 add_header Cache-Control no-cache;
                 add_header 'Access-Control-Allow-Origin' '*' always;
                 add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
                 add_header 'Access-Control-Allow-Headers' 'Range';
     
                 types {
                     application/dash+xml mpd;
                     video/mp4 mp4;
                 }
    
                 root /tmp;
             }
         }
     }
    
     rtmp {
         listen 1935;
         chunk_size 4000;
         idle_streams off;
         ping 30s;
         notify_method get;
    
         server {
             listen 1935;
             chunk_size 4000;
     
             drop_idle_publisher 10s;
             idle_streams off;
            
             application live {
                 live on;
             }
     
             application hls {
                 live on;
                 hls on;
                 hls_path /tmp/hls;
             }
     
             # MPEG-DASH is similar to HLS
             application dash {
                 live on;
                 dash on;
                 dash_path /tmp/dash;
             }
         }
     }
    
  • 拷贝xml文件:cp /root/nginx-rtmp-module/stat.xsl /opt/openresty/nginx/html

  • 流状态查看:http://127.0.0.1:8000/stat

  • OBS推流地址:rtmp://127.0.0.1/dash/123

  • VLC观看RTMP直播流:rtmp://127.0.0.1/dash/123

  • DASH格式HTTP播放

    <script src="http://cdn.dashjs.org/latest/dash.all.min.js"></script>
    <style>
        video {
            width: 640px;
            height: 360px;
        }
    </style>
    <div>
        <video data-dashjs-player autoplay src="http://127.0.0.1:8000/dash/123.mpd" controls></video>
    </div>
    
  • 功能特点
    支持RTMP、HTTP-FLV、HLS、HTML5等协议,面向Windows、iOS、Android等终端提供稳定流畅的视频直播、点播服务,支持微信直播和微信点播, 可部署在局域网和互联网,实现私有云和公有云应用,单设备高并发。

    • 多屏播放 支持Flash、HTML5播放,兼容Windows、Android、iOS、Mac等操作系统;
    • 转码、上传 转码、上传一体化设计,使视频资源转码后可立即面向互联网进行发布;
    • 嵌入、分享 上传视频后一键生成视频地址,以供用户分享、嵌入到网站、软件系统中;
    • 丰富接口 提供编程语言无关化的RESTful API接口,可以很简单的进行二次开发;
  • 强大的WEB管理系统
    采用业界优秀的流媒体框架模式设计,服务运行轻量、高效、稳定、可靠、易维护,是移动互联网时代贴近企业点播、直播需求的一款流媒体方案,可以形成一套完整的视频直播、录播解决方案,满足用户在各种行业场景的流媒体业务需求。

    • 1、视频上传
    • 2、点播管理
    • 3、直播流管理
    • 4、正在直播
    • 5、分享集成
    • 6、接口在线调试
  • 应用场景
    视频门户网站、会议活动现场直播、网络电视台、远程监控、在线实时课堂、 科研方向等。

HLS 协议标准

参考资料

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].