gop_max_frame_count
The `gop_max_frame_count` directive limits the number of frames in a Group of Pictures (GOP) for video streaming.
Description
The gop_max_frame_count directive is utilized within the NGINX RTMP module to control the maximum number of frames within a Group of Pictures (GOP) for video streams. This configuration is significant in video streaming as it affects how video is encoded and streamed, impacting both latency and quality. A GOP consists of a keyframe followed by a sequence of inter-frames, and the number of frames can dictate the accessibility of individual frames within a stream, especially when seeking or scrubbing in the video.
Setting this directive appropriately can optimize performance for various types of streaming content. For example, reducing the maximum frame count might help in scenarios where low latency is crucial, as smaller GOPs can provide quicker access to new content and reduce the delay between content updates. However, it may also increase bandwidth use and computational load, as more keyframes may be needed in bursts of high activity, potentially affecting overall video quality when very low GOP sizes are utilized.
The argument for gop_max_frame_count should specify a positive integer indicating the maximum count of frames in a GOP. If not set, the encoder's default behavior will apply, which varies depending on the exact encoder being used. Careful adjustment is recommended based on streaming requirements and the capabilities of the encoding hardware or software being implemented.
Config Example
application live {
gop_max_frame_count 30;
}Setting this value too low may lead to increased CPU usage due to frequent keyframe generation.
Overly large values can increase latency in the stream.