NGINX-based Media Streaming Server
Switch branches/tags
Clone or download
Pull request Compare This branch is 113 commits ahead of sergey-dryabzhinsky:dev.
ut0mt8 Merge pull request #13 from cotequeiroz/include-order
move ngx_config.h and ngx_core.h to top of ngx_rtp_cenc.c
Latest commit f0ea623 Dec 7, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dash ngx_rtp_cenc.c: move ngx_{config,core}.h to top Dec 6, 2018
doc "exec_record_started" event and "on_record_started" notification adde… Feb 9, 2017
hls Write EXT-X-PROGRAM-DATE-TIME before any EXT-X-DISCONTINUITY Mar 29, 2018
test removed trailing space Nov 30, 2013
.gitignore "exec_record_started" event and "on_record_started" notification adde… Feb 9, 2017
AUTHORS Authors ? Jun 1, 2017
DAI.md Link Oct 10, 2018
DRM.md Typo Oct 10, 2018
LICENSE updated year Jan 15, 2014
README.md clarification Oct 10, 2018
TODO.md Add some doc and time_hack Oct 10, 2018
config renaming aes_ctr to cenc May 16, 2018
ngx_rtmp.c Support Dynamic Module NGINX ≥ 1.9.11 Apr 8, 2016
ngx_rtmp.h Revert "Add event-based handle of reload/exit signal" May 18, 2017
ngx_rtmp_access_module.c Fix multiple fallthrough warnings Dec 2, 2017
ngx_rtmp_amf.c Fix multiple fallthrough warnings Dec 2, 2017
ngx_rtmp_amf.h updated copyright line Nov 3, 2013
ngx_rtmp_auto_push_module.c Get changes from @arut arut@c0bf381 Nov 25, 2016
ngx_rtmp_bandwidth.c removed trailing spaces Nov 30, 2013
ngx_rtmp_bandwidth.h added audio and video bw to stat Dec 23, 2013
ngx_rtmp_bitop.c implemented avc sps parser & improved dash & stats Dec 20, 2013
ngx_rtmp_bitop.h implemented avc sps parser & improved dash & stats Dec 20, 2013
ngx_rtmp_cmd_module.c Revert "Add event-based handle of reload/exit signal" May 18, 2017
ngx_rtmp_cmd_module.h Max request length and args length increase Apr 21, 2016
ngx_rtmp_codec_module.c Merge pull request sergey-dryabzhinsky#138 from sergey-dryabzhinsky/f… Jul 6, 2016
ngx_rtmp_codec_module.h Store audio and video bitrate in variables of type double Feb 26, 2016
ngx_rtmp_control_module.c fixed errors in control output; now returning http 206 instead of emp… Mar 4, 2014
ngx_rtmp_core_module.c Revert "Add event-based handle of reload/exit signal" May 18, 2017
ngx_rtmp_eval.c Fix multiple fallthrough warnings Dec 2, 2017
ngx_rtmp_eval.h merged exec pull feature Nov 26, 2013
ngx_rtmp_exec_module.c exec_record_started is now called when the first frame is written in … Feb 10, 2017
ngx_rtmp_flv_module.c implemented default buflen setting Jan 16, 2014
ngx_rtmp_handler.c Another try fixing timestamp mess Oct 20, 2017
ngx_rtmp_handshake.c OpenSSL-1.1 support Apr 13, 2017
ngx_rtmp_init.c Fix multiple fallthrough warnings Dec 2, 2017
ngx_rtmp_limit_module.c removed trailing spaces Nov 30, 2013
ngx_rtmp_live_module.c Merge branch 'dev' of https://github.com/sergey-dryabzhinsky/nginx-rt… Aug 7, 2017
ngx_rtmp_live_module.h type error fix: accroding to the code details, ngx_rtmp_live_app_conf… Jun 10, 2016
ngx_rtmp_log_module.c Update: Nov 30, 2015
ngx_rtmp_mp4_module.c fixed skipping first key frame in mp4 streamer Apr 24, 2014
ngx_rtmp_netcall_module.c Update notfy parameters handle: Apr 21, 2016
ngx_rtmp_netcall_module.h removed trailing spaces Nov 30, 2013
ngx_rtmp_notify_module.c Fix multiple fallthrough warnings Dec 2, 2017
ngx_rtmp_play_module.c Revert "Add event-based handle of reload/exit signal" May 18, 2017
ngx_rtmp_play_module.h removed trailing spaces Nov 30, 2013
ngx_rtmp_proxy_protocol.c fixed compilation with old nginx Apr 3, 2014
ngx_rtmp_proxy_protocol.h added proxy protocol support Mar 31, 2014
ngx_rtmp_receive.c removed trailing spaces Nov 30, 2013
ngx_rtmp_record_module.c exec_record_started is now called when the first frame is written in … Feb 10, 2017
ngx_rtmp_record_module.h exec_record_started is now called when the first frame is written in … Feb 10, 2017
ngx_rtmp_relay_module.c Update: Nov 30, 2015
ngx_rtmp_relay_module.h removed trailing spaces Nov 30, 2013
ngx_rtmp_send.c Use nginx interval functions, Remove unused var Jan 5, 2016
ngx_rtmp_shared.c Hack for circular chain by @heftig Jul 26, 2016
ngx_rtmp_stat_module.c Connection info not always available. Show zero port if not. Jan 31, 2016
ngx_rtmp_streams.h updated copyright line Nov 3, 2013
ngx_rtmp_version.h Next dev version Mar 1, 2016
stat.xsl Merge pull request sergey-dryabzhinsky#24 from sergey-dryabzhinsky/sh… Jul 5, 2015

README.md

NGINX-based Media Streaming Server

nginx-rtmp-module (dash enhanced version)

Forked from https://github.com/sergey-dryabzhinsky/ which was the most up to date version (until now)

Notable new features :

  • add the possibility to make adaptative streaming (show below configuration, using ffmpeg to trancode in 3 variants, and produce one manifest). note the "max" flag which indicate which representation should have max witdh and height and so use it to create the variant manifest. you can also use any encoder to directly push the variant.
  • add the support of using repetition in manifest to shorten them (option dash_repetition) (thanks to Streamroot)
  • add the support of common-encryption; currently working DRM are ClearKey/Widevine/Playready (see specific doc here)
  • add the support of ad insertion break event, from rtmp AMF message to dash (InbandEvent in manifest and emsg box in mp4 fragment, see doc here)

See original doc here for full list of options.

  rtmp {
    server {
    listen 1935;
   
    application ingest {
      live on;
      exec /usr/bin/ffmpeg -i rtmp://localhost/$app/$name \
           -c:a libfdk_aac -b:a 64k -c:v libx264 -preset fast -profile:v baseline -vsync cfr -s 1024x576 -b:v 1024K -bufsize 1024k \
           -f flv rtmp://localhost/dash/$name_hi \
           -c:a libfdk_aac -b:a 64k -c:v libx264 -preset fast -profile:v baseline -vsync cfr -s 640x360 -b:v 832K -bufsize 832k \
           -f flv rtmp://localhost/dash/$name_med \
           -c:a libfdk_aac -b:a 64k -c:v libx264 -preset fast -profile:v baseline -vsync cfr -s 320x180 -b:v 256K -bufsize 256k \
           -f flv rtmp://localhost/dash/$name_low
    }
      
    application dash {
      live on;
      dash on;
      dash_nested on; 
      dash_repetition on;
      dash_path /dev/shm/dash;
      dash_fragment 4; # 4 second is generaly a good choice for live
      dash_playlist_length 120; # keep 120s of tail
      dash_cleanup on;
      dash_variant _low bandwidth="256000" width="320" height="180";
      dash_variant _med bandwidth="832000" width="640" height="360";
      dash_variant _hi bandwidth="1024000" width="1024" height="576" max;
    }
  }

   server {
      listen 443 ssl;
      location / {
        root /var/www;
        add_header Cache-Control no-cache;
        add_header 'Access-Control-Allow-Origin' '*';
      }
      location /dash/live/index.mpd {
        alias /dev/shm/dash/live/index.mpd;
        add_header 'Access-Control-Allow-Origin' '*';
        add_header Cache-Control 'public, max-age=0, s-maxage=2';
      }
      location /dash/live {
        alias /dev/shm/dash/live;
        add_header 'Access-Control-Allow-Origin' '*';
        add_header Cache-Control 'public, max-age=600, s-maxage=600';
      }

      server_name live.site.net;
      ssl_certificate /etc/letsencrypt/live/live.site.net/fullchain.pem;
      ssl_certificate_key /etc/letsencrypt/live/live.sit.net/privkey.pem;

    }
}