rtmp
The 'rtmp' directive enables the RTMP (Real-Time Messaging Protocol) server configuration for live streaming in NGINX.
Description
The 'rtmp' directive is the core configuration block for setting up a Real-Time Messaging Protocol (RTMP) server within NGINX. It is used in the main context, indicating that it is a foundational aspect of the server configuration. By declaring the 'rtmp' block, administrators can define settings specific to RTMP streaming, such as specifying listening ports, chunk sizes, and application configurations. This directive allows the server to handle multiple aspects of streaming, including live broadcasts and recorded video playback through various applications defined within the RTMP block.
Within the 'rtmp' directive, users can define multiple 'application' blocks, which represent distinct RTMP applications that may cater to different streams or streaming purposes. Each application can have its own settings, such as enabling live streaming, setting policies for publishing and playing streams, and managing recording options. The flexibility of defining separate applications allows for streamlined management of different streaming needs, from live broadcasts to video on demand.
Moreover, the 'rtmp' directive can be complemented with other directives unique to the RTMP module, such as 'live', 'allow publish', and 'record', to further customize the server’s behavior in accordance with the specific requirements of the streaming setup.
Config Example
rtmp {
server {
listen 1935;
chunk_size 4096;
application live {
live on;
record all;
record_path /tmp/av;
record_max_size 1M;
allow publish all;
allow play all;
}
}
}Ensure the RTMP module is correctly compiled with NGINX since this directive won't work without it.
Remember to configure firewall rules to allow traffic on the RTMP port (default is 1935).
Misconfiguring application block names can lead to confusion; ensure names are unique and accurately reflect their intended use.