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.
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.
dash_fragment #
syntax: dash_fragment 1 arg (duration in ms);
Duration in milliseconds; accepts ms / s / m suffixes.
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_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_audio_buffer_size #
syntax: hls_audio_buffer_size 1 arg (size (k/m/g));
Size in bytes; accepts k / m / g suffixes.
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_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_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_variant #
syntax: hls_variant 1+ args;
Adds an HLS variant entry, creating a variant playlist for the stream matched by the given suffix.
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.
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.
ping_timeout #
syntax: ping_timeout 1 arg (duration in ms);
Duration in milliseconds; accepts ms / s / m suffixes.
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_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_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_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_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.
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".
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.
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;
}
}
}