push
The `push` directive in the NGINX RTMP module facilitates stream pushing from the RTMP server to a specified destination URL.
Description
The push directive allows an RTMP stream to be sent to another RTMP endpoint or server. It is typically used in scenarios where a single stream needs to be broadcast to multiple destinations, such as relaying or distributing a live broadcast. The directive can be specified multiple times, allowing for multiple push configurations for a single stream.
Each push directive takes a destination URL as its argument, which should be formatted according to the RTMP URL conventions. This allows for flexible streaming setups where streams can be pushed to dedicated services for transcoding, recording, or rebroadcasting. The directive can be placed within an application block of the NGINX configuration, enabling or disabling the push behavior based on the application's requirements. As streams are published, the server will automatically push the stream to the specified destination(s), maintaining synchronization with the original stream's state.
It's important to note that the push process runs in parallel with the local stream handling, meaning that performance considerations, such as network stability and bandwidth, should be accounted for when configuring push destinations. Failure to successfully push a stream to a designated URL could result in dropped frames or interruptions for the end-users receiving the stream via the pushed endpoint.
Config Example
rtmp {
server {
listen 1935;
application live {
live on;
push rtmp://another-server/live;
}
}
}Ensure the destination URL is correctly specified as invalid URLs will cause push failures.
Monitor the network for interruptions as they can lead to dropped streams at the push endpoint.
Overloading the push destinations with too many streams may result in performance degradation. Don't push to multiple destinations unless necessary.