Skip to content

Directives

winshining edited this page Dec 4, 2017 · 31 revisions

Table of Contents

This table is only for the new added directives in this module, for details of other directives, please refer to nginx-rtmp-module directives.

HTTP Live FLV

flv_live

Syntax: flv_live on|off
Context: location
Enable playing a live flv stream in this location.

location /live {
    flv_live on;
}

chunked

Syntax: chunked on|off
Context: location
Add a Transfer-Encoding: chunked HTTP header when sending response to the player and enable HTTP chunked transmission, otherwise Expires: -1 HTTP header is sent. Note that not all players support HTTP chunked transmission.

location /live {
    flv_live on;
    chunked on;
}

Gop Cache

gop_cache

Syntax: gop_cache on|off
Context: application
Cache GOP(s) (Group Of Pictures) when a stream is being published, once a play is coming, send the cached GOP(s) at first. This decreases the time waiting for the first picture of a video to be displayed.

application myapp {
    ...
    gop_cache on;
}

pure_audio_threshold

Syntax: pure_audio_threshold value
Context: rtmp, server, application
If none video packet has been received after value audio packet(s) is/are received, the published stream is thought to be a pure audio stream.

pure_audio_threshold 200;

Virtual Host

server_name

Syntax: server_name *.domain.suffix|prefix.domain.*|prefix.domain.suffix|regexp
Context: server
The functionality of server_name directive is as same as in the http block.

server_name prefix.domain.suffix;

Reverse Proxy

proxy_pass

Syntax: proxy_pass rtmp://host[:port/appInstance]
Context: application
Set the reverse proxy, the functionality of proxy_pass is similar as in the http block. However, it is very experimental now and it is not very practical in the real world. Suppose that reverse proxying 3000 streams with every stream has a 2MB band width, that will occupy about 6GB band width in all. Without the redirection (so many players don't support the feature), the reverse proxy server will suffer both input and output load.

proxy_pass rtmp://localhost:1975/mytest;

or combined with upstream:

proxy_pass rtmp://backend;

upstream

Syntax: upstream {...}
Context: rtmp
Set upstream strategy for reverse proxy, now only round robin is supported.

upstream backend {
    server localhost:1975;
    server localhost:1985;
}
Clone this wiki locally