rtmp #

playing from local filesystem or HTTP

Source: upstream source

Directives

access_log #

syntax: access_log 1 arg;

Sets access log parameters and file path, or disables logging with access_log off.

ack_window #

syntax: ack_window 1 arg (integer);

Integer value.

allow #

syntax: allow 1 arg;

Permits publishing or playing from a specified address, subnet, or all addresses.

application #

syntax: application 1 arg;

These features are not supported execs static pulls * auto_push ### RTMP URL format rtmp://rtmp.example.com/app[/name] app - should match one of application {} blocks in config name - interpreted by each application can be empty ### Multi-worker live streaming Module supports multi-worker live streaming through automatic stream pushing to nginx workers.

buffer #

syntax: buffer 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

buflen #

syntax: buflen 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

busy #

syntax: busy 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

chunk_size #

syntax: chunk_size 1 arg (integer);

Integer value.

dash #

syntax: dash 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

dash_cleanup #

syntax: dash_cleanup 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

dash_fragment #

syntax: dash_fragment 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

dash_nested #

syntax: dash_nested 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

dash_path #

syntax: dash_path 1 arg (string);

Stores a single string value.

dash_playlist_length #

syntax: dash_playlist_length 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

deny #

syntax: deny 1 arg;

Restricts publishing or playing from a specified address, subnet, or all addresses.

drop_idle_publisher #

syntax: drop_idle_publisher 1 arg;

Drops a publisher connection that has been idle, sending no audio/video data, within a specified timeout.

exec #

syntax: exec 1+ args;

{ ngx_string("exec_block"), NGX_RTMP_APP_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS|NGX_CONF_TAKE1, ngx_rtmp_exec_block, NGX_RTMP_APP_CONF_OFFSET, 0, NULL },

exec_kill_signal #

syntax: exec_kill_signal 1 arg;

Sets the signal used to terminate exec-spawned processes, defaulting to SIGKILL.

exec_options #

syntax: exec_options 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

exec_play #

syntax: exec_play 1+ args;

Specifies an external command with arguments to execute on the play event.

exec_play_done #

syntax: exec_play_done 1+ args;

Specifies an external command with arguments to execute on the play_done event.

exec_publish #

syntax: exec_publish 1+ args;

Specifies an external command with arguments to execute on the publish event.

exec_publish_done #

syntax: exec_publish_done 1+ args;

Specifies an external command with arguments to execute on the publish_done event.

exec_pull #

syntax: exec_pull 1+ args;

Specifies an external command with arguments to execute on play, launching it when the first client connects and terminating it when the last disconnects.

exec_push #

syntax: exec_push 1+ args;

Specifies an external command with arguments to execute on every stream published, terminating the process when publishing stops.

exec_record_done #

syntax: exec_record_done 1+ args;

Specifies an external command with arguments to execute when recording finishes.

exec_static #

syntax: exec_static 1+ args;

Runs a specified command at nginx startup, similar to exec but without substitution support since no session context exists.

hls #

syntax: hls 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

hls_audio_buffer_size #

syntax: hls_audio_buffer_size 1 arg (size (k/m/g));

Size in bytes; accepts k / m / g suffixes.

hls_base_url #

syntax: hls_base_url 1 arg (string);

Stores a single string value.

hls_cleanup #

syntax: hls_cleanup 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

hls_continuous #

syntax: hls_continuous 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

hls_fragment #

syntax: hls_fragment 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

hls_fragment_naming #

syntax: hls_fragment_naming 1 arg (enum);

Pick one of an enumerated set of values.

hls_fragment_naming_granularity #

syntax: hls_fragment_naming_granularity 1 arg (integer);

Integer value.

hls_fragment_slicing #

syntax: hls_fragment_slicing 1 arg (enum);

Pick one of an enumerated set of values.

hls_fragments_per_key #

syntax: hls_fragments_per_key 1 arg (integer);

Integer value.

hls_key_path #

syntax: hls_key_path 1 arg (string);

Stores a single string value.

hls_key_url #

syntax: hls_key_url 1 arg (string);

Stores a single string value.

hls_keys #

syntax: hls_keys 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

hls_max_audio_delay #

syntax: hls_max_audio_delay 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

hls_max_fragment #

syntax: hls_max_fragment 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

hls_muxdelay #

syntax: hls_muxdelay 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

hls_nested #

syntax: hls_nested 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

hls_path #

syntax: hls_path 1 arg (string);

Stores a single string value.

hls_playlist_length #

syntax: hls_playlist_length 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

hls_sync #

syntax: hls_sync 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

hls_type #

syntax: hls_type 1 arg (enum);

Pick one of an enumerated set of values.

hls_variant #

syntax: hls_variant 1+ args;

Adds an HLS variant entry, creating a variant playlist for the stream matched by the given suffix.

idle_streams #

syntax: idle_streams 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

interleave #

syntax: interleave 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

listen #

syntax: listen 1 arg;

Adds a listening socket to nginx for accepting RTMP connections on a given address, port, or unix path.

live #

syntax: live 1 arg (on/off flag);

These features are not supported execs static pulls * auto_push ### RTMP URL format rtmp://rtmp.example.com/app[/name] app - should match one of application {} blocks in config name - interpreted by each application can be empty ### Multi-worker live streaming Module supports multi-worker live streaming through automatic stream pushing to nginx workers.

log_format #

syntax: log_format 2+ args;

Creates a named logging format using variables such as $remote_addr, $app, $name, and $command.

max_connections #

syntax: max_connections 1 arg (integer);

Integer value.

max_message #

syntax: max_message 1 arg (size (k/m/g));

Size in bytes; accepts k / m / g suffixes.

max_streams #

syntax: max_streams 1 arg (integer);

Integer value.

meta #

syntax: meta 1 arg (enum);

Pick one of an enumerated set of values.

netcall_buffer #

syntax: netcall_buffer 1 arg (size (k/m/g));

Size in bytes; accepts k / m / g suffixes.

netcall_timeout #

syntax: netcall_timeout 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

notify_method #

syntax: notify_method 1 arg;

Sets the HTTP method used for notification callbacks, defaulting to POST.

notify_relay_redirect #

syntax: notify_relay_redirect 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

notify_update_strict #

syntax: notify_update_strict 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

notify_update_timeout #

syntax: notify_update_timeout 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

on_connect #

syntax: on_connect 1 arg;

Sets an HTTP callback issued asynchronously when a client issues the connect command.

on_disconnect #

syntax: on_disconnect 1 arg;

Sets a server-level callback URL notified when an RTMP client disconnects.

on_done #

syntax: on_done 1 arg;

Sets a callback triggered when play or publish terminates, without checking the HTTP status code.

on_play #

syntax: on_play 1 arg;

Issues an HTTP callback when a client requests playback, where a 2xx response continues the session and 3xx redirects the stream.

on_play_done #

syntax: on_play_done 1 arg;

Behaves like on_done but fires only for the play end event.

on_publish #

syntax: on_publish 1 arg;

Issues an HTTP callback when a client issues the publish command, behaving like on_play.

on_publish_done #

syntax: on_publish_done 1 arg;

Behaves like on_done but fires only for the publish end event.

on_record_done #

syntax: on_record_done 1 arg;

Sets the callback fired when a recorder finishes recording.

on_update #

syntax: on_update 1 arg;

Sets an update callback that fires periodically at the interval given by notify_update_timeout.

out_cork #

syntax: out_cork 1 arg (size (k/m/g));

Size in bytes; accepts k / m / g suffixes.

out_queue #

syntax: out_queue 1 arg (size (k/m/g));

Size in bytes; accepts k / m / g suffixes.

ping #

syntax: ping 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

ping_timeout #

syntax: ping_timeout 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

play #

syntax: play 1+ args;

Plays an FLV or MP4 file from a specified directory or HTTP location.

play_local_path #

syntax: play_local_path 1 arg (string);

Stores a single string value.

play_restart #

syntax: play_restart 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

play_temp_path #

syntax: play_temp_path 1 arg (string);

Stores a single string value.

play_time_fix #

syntax: play_time_fix 1 arg (on/off flag);

time fixes are needed for flash clients

publish_notify #

syntax: publish_notify 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

publish_time_fix #

syntax: publish_time_fix 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

pull #

syntax: pull 1+ args;

Creates a pull relay that fetches a remote stream and makes it available locally.

pull_reconnect #

syntax: pull_reconnect 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

push #

syntax: push 1+ args;

Creates a push relay that publishes the local stream to a remote server, using the same syntax as pull.

push_reconnect #

syntax: push_reconnect 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

record #

syntax: record 1+ args (bitmask);

Bitmask — combine several keywords.

record_append #

syntax: record_append 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

record_interval #

syntax: record_interval 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

record_lock #

syntax: record_lock 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

record_max_frames #

syntax: record_max_frames 1 arg (size (k/m/g));

Size in bytes; accepts k / m / g suffixes.

record_max_size #

syntax: record_max_size 1 arg (size (k/m/g));

Size in bytes; accepts k / m / g suffixes.

record_notify #

syntax: record_notify 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

record_path #

syntax: record_path 1 arg (string);

Stores a single string value.

record_suffix #

syntax: record_suffix 1 arg (string);

Stores a single string value.

record_unique #

syntax: record_unique 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

recorder #

syntax: recorder 1 arg;

Declares a recorder block, allowing multiple recorders to be created within a single application.

relay_buffer #

syntax: relay_buffer 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

respawn #

syntax: respawn 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

respawn_timeout #

syntax: respawn_timeout 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

rtmp #

syntax: rtmp no args;  ·  context: main

These features are not supported execs static pulls * auto_push ### RTMP URL format rtmp://rtmp.example.com/app[/name] app - should match one of application {} blocks in config name - interpreted by each application can be empty ### Multi-worker live streaming Module supports multi-worker live streaming through automatic stream pushing to nginx workers.

rtmp_auto_push #

syntax: rtmp_auto_push 1 arg (on/off flag);  ·  context: main

Boolean directive — set to "on" or "off".

rtmp_auto_push_reconnect #

syntax: rtmp_auto_push_reconnect 1 arg (duration in ms);  ·  context: main

Duration in milliseconds; accepts ms / s / m suffixes.

rtmp_control #

syntax: rtmp_control 1+ args;  ·  context: http, server, location

Activates the control module for managing RTMP streams programmatically.

rtmp_socket_dir #

syntax: rtmp_socket_dir 1 arg (string);  ·  context: main

Stores a single string value.

rtmp_stat #

syntax: rtmp_stat 1+ args;  ·  context: http, server, location

Enables display of streaming and recording statistics.

rtmp_stat_stylesheet #

syntax: rtmp_stat_stylesheet 1 arg (string);  ·  context: http, server, location

Stores a single string value.

server #

syntax: server no args;

Declares an RTMP server instance within the rtmp block.

session_relay #

syntax: session_relay 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

so_keepalive #

syntax: so_keepalive on | off (on/off flag);

Boolean directive — set to "on" or "off".

stream_buckets #

syntax: stream_buckets 1 arg (string);

Stores a single string value.

sync #

syntax: sync 1 arg;

Synchronizes audio and video streams by sending an absolute frame when their timestamp difference exceeds the given timeout.

timeout #

syntax: timeout 1 arg (duration in ms);

Duration in milliseconds; accepts ms / s / m suffixes.

wait_key #

syntax: wait_key 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

wait_video #

syntax: wait_video 1 arg (on/off flag);

Boolean directive — set to "on" or "off".

Example

worker_processes  1;

error_log  logs/error.log debug;

events {
    worker_connections  1024;
}

rtmp {
    server {
        listen 1935;

        application myapp {
            live on;

            #record keyframes;
            #record_path /tmp;
            #record_max_size 128K;
            #record_interval 30s;
            #record_suffix .this.is.flv;

            #on_publish http://localhost:8080/publish;
            #on_play http://localhost:8080/play;
            #on_record_done http://localhost:8080/record_done;
        }
    }
}

http {
    server {
        listen      8080;

        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            root /path/to/nginx-rtmp-module/;
        }

        location /control {
            rtmp_control all;
        }

        #location /publish {
        #    return 201;
        #}

        #location /play {
        #    return 202;
        #}

        #location /record_done {
        #    return 203;
        #}

        location /rtmp-publisher {
            root /path/to/nginx-rtmp-module/test;
        }

        location / {
            root /path/to/nginx-rtmp-module/test/www;
        }
    }
}

↑ back to index