out_cork

The 'out_cork' directive controls the output buffering for RTMP streams in the NGINX RTMP module.

Syntaxout_cork on | off;
Defaultoff
Context
Arguments1

Description

The 'out_cork' directive is used to optimize the performance of live streaming by managing how output buffers are handled. When enabled, this directive reduces the amount of data that is sent over the network during the streaming process. It works by holding back the data that would typically be sent immediately, allowing the buffering process to accumulate more data before actually transmitting it. This can greatly reduce the overhead and latency associated with sending out small packets of data continuously.

This directive is particularly useful in scenarios where the stream's bitrate varies, as it ensures that the network operates more efficiently by sending fewer larger packets as opposed to many small ones. It is not enabled by default and requires an explicit configuration to take effect. Its usage can lead to improved performance for high-bitrate streams and can also help manage situations where network capacity is a concern.

Additionally, the 'out_cork' directive can be toggled on or off depending on the application's requirements, allowing for flexible stream management. It is beneficial for applications that stream high-volume content as it helps balance the load and enhance the viewer's experience by minimizing delays encountered during the streaming process.

Config Example

application live {
    live on;
    out_cork on;
}

Ensure the directive is set within the correct context (e.g., inside an application block).

Using 'out_cork' may lead to increased latency in certain situations, so test performance accordingly.

Monitor network conditions to ensure that buffering is effectively managed. No physical data transfer will occur while buffering is active, which might lead to perceived lag.

← Back to all directives