NGNIX + RTMP Server Block Example RTMP+M3U8 Streaming

July 2nd, 2015 by
Replace the and rtmp://STREAMURL with your information.
server {
        listen       80;

        location / {
            root   html;
            index  index.html index.htm;

   # path to HLS application service
       location /media_server {
          			 types {
              			 application/ m3u8;
              			 video/mp2t ts;
           			root /home/user/tmp;
          			 add_header Cache-Control no-cache;

rtmp {
   server {
       listen 1935;
       chunk_size 4000;
       # Transcoding (ffmpeg needed)
       application media_server {
           live on;
           hls on;
           hls_path /home/user/tmp/media_server;
           hls_nested on;
           hls_variant _low  BANDWIDTH=640000;
           hls_variant _hi  BANDWIDTH=2140000;
           # ffmpeg static execution
           exec_static /usr/bin/ffmpeg -i rtmp://STREAMURL
               -c:v libx264 -g 50 -preset fast -b:v 4096k -c:a libfdk_aac -ar 44100 -f flv rtmp://
               -c:v libx264 -g 50 -preset fast -b:v 1024k -c:a libfdk_aac -ar 44100 -f flv rtmp://;

Post a Comment

You must be logged in to post a comment.

Cached at: 2024-05-25 11:54:31am