hls_audio_buffer_size

Sets the audio buffer size for live audio streaming in the NGINX RTMP module.

Syntaxhls_audio_buffer_size size;
Defaultnone
Context
Arguments1

Description

The hls_audio_buffer_size directive is utilized within the NGINX RTMP module to specify the buffer size allocated for audio data during HLS streaming. This buffer size is crucial for managing how much audio data is temporarily stored before being sent to the client, which directly affects latency and smoothness of playback. By tuning this value, administrators can optimize the performance of audio streaming based on the specific requirements of their streaming setup, such as network conditions and client capabilities.

The parameter accepts a single integer value, which defines the size of the audio buffer in bytes. Choosing an appropriate buffer size is important as smaller values may lead to increased CPU usage and potential audio glitches, especially in unstable network conditions or under heavy load, while larger values can introduce unwanted latency. Administrators should consider their audience's expected network performance and select a buffer size that strikes a balance between responsiveness and stability during streaming sessions.

This directive can significantly impact the user experience during live broadcasts, especially in environments with variable network performance. Scaling the audio buffer dynamically or adjusting it during peak streaming times can help maintain good audio quality. However, users must be cautious not to set the buffer too high post-configuration, as this could lead to delays in audio playback, which is particularly detrimental in live performance scenarios.

Config Example

hls_audio_buffer_size 2097152;  # Set buffer size to 2MB

Setting the buffer size too low can result in audio dropouts or glitches during playback.

A very high buffer size can introduce latency, potentially leading to a lag in audio synchronization with video streams.

Ensure the buffer size chosen does not exceed the available memory to prevent performance degradation.

← Back to all directives