Nginx-rtmp-module

NGINX-based Media Streaming Server

Download .zip Download .tar.gz View on GitHub

Wiki manual

https://github.com/arut/nginx-rtmp-module/wiki

Features

  • Live streaming of video/audio

  • Video on demand (FLV)

  • Stream relay support for distributed streaming: push & pull models

  • Recording published streams in FLV file

  • H264/AAC support

  • Online transcoding with FFmpeg (experimental; Linux only)

  • HLS (HTTP Live Streaming) support (experimental; libavformat >= 53.31.100)

  • HTTP callbacks on publish/play/record

  • Advanced buffering techniques to keep memory allocations at a minimum level for faster streaming and low memory footprint

  • Works with Flash RTMP clients as well as ffmpeg/rtmpdump/flvstreamer etc (see examples in test/ subdir)

  • Statistics in XML/XSL in machine- & human- readable form

Build:

cd to NGINX source directory & run this:

./configure --add-module=/path/to.nginx-rtmp-module
make
make install

Examples of nginx.conf

Simple Live Streaming

rtmp {
    server {
        listen 1935;
        application mytv {

            # enable live streaming
            live on;

            # record first 1K of stream
            record all;
            record_path /tmp/av;
            record_max_size 1K;

            # append current timestamp to each flv
            record_unique on;
        }
    }
}

Transcoding

application big {
    live on;
    exec /usr/bin/ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec flv -acodec copy -s 32x32 -f flv rtmp://localhost:1935/small/${name};
}

application small {
    live on;
    # Video with reduced resolution comes here from ffmpeg
}

Pushing stream

application mypush {
    live on;

    # Every stream published here
    # is automatically pushed to 
    # these two machines
    push rtmp1.example.com;
    push rtmp2.example.com:1934;
}

Pulling stream

application mypull {
    live on;

    # Pull all streams from remote machine
    # and play locally
    pull rtmp://rtmp3.example.com pageUrl=www.example.com/index.html;
}

Video on demand

application vod {
    play /var/flvs;
}

HLS (HTTP Live Streaming)

application hls {
    hls on;
    hls_path /tmp/app;
    hls_fragment 5s;
}

Donation

If you want to support the project use the following services

PayPal

Yandex Money

Webmoney

Purse id: Z289359932625

Contacts

Project author: Roman Arutyunyan

arut@qip.ru (e-mail and jabber)

arutyunyan.roman@gmail.com

Project blog: rarut.wordpress.com