gop_cache

The `gop_cache` directive enables GOP (Group of Pictures) caching for video streaming in NGINX.

Syntaxgop_cache on | off;
Defaultoff
Context
Arguments1

Description

The gop_cache directive is utilized within the NGINX RTMP context to enhance the performance of video streaming by caching video frames based on the GOP structure. By defining a GOP structure, the server can optimize which frames are held in memory to reduce latency during live streaming and ensure that clients receive the most relevant frames when playing back video content. The primary use of this directive is within applications where real-time delivery and efficient bandwidth usage are critical, such as live sports or events where high-quality video streaming is mandatory. When enabled, the cache is maintained up to a limit specified by the configuration, and it is important to manage this cache effectively to prevent memory issues, particularly in long-running streams.

Config Example

gop_cache on;

For gop_cache to function optimally, ensure that the stream uses a suitable GOP structure; improper GOP settings can lead to unexpected cache behavior.

Excessive caching can lead to increased memory usage, so monitor memory allocation when enabling GOP caching in high-load scenarios.

← Back to all directives