pull

The "pull" directive allows NGINX to pull a stream from a specified RTMP source.

Syntaxpull rtmp://source_server/app/stream_name;
Defaultnone
Context
Arguments1+

Description

The pull directive in the NGINX RTMP module is used to configure a server to pull a live stream from an external RTMP server. This is particularly useful when you want to relay a stream from another source into your NGINX server for distribution. The directive takes one or more arguments representing the RTMP URL of the source, which can include application and stream name segments. Additionally, the directive can handle multiple pull arguments in the configuration to pull multiple streams simultaneously.

When a stream is pulled, the NGINX server establishes a connection to the source server and begins receiving the stream data. Each pull operation is independent, allowing for flexibility in streaming setup and management. This feature is essential for scenarios where centralizing multiple streams from different sources is necessary. The pulled stream can then be broadcasted to connected clients or further processed as needed.

It's important to consider that the pull operation is subject to network conditions, and thus the performance can vary depending on the latency and bandwidth between the NGINX server and the source RTMP server. Additionally, appropriate resource allocation on the NGINX server is required to handle the incoming stream without dropping packets or causing delays.

Config Example

rtmp {
    server {
        listen 1935;

        application live {
            live on;
            pull rtmp://external-source/app/stream;
        }
    }
}

Be cautious of network latency; if the source RTMP server is slow or unstable, it will affect the quality of the pulled stream.

Ensure that the NGINX server has sufficient resources to handle the incoming stream, especially under load.

Incorrect RTMP URL format will lead to stream connection failures.

← Back to all directives