Configure NUT Index Interval and Frame Flags with FFmpeg

This article explains how to configure the index interval and manage frame flags within the NUT container using FFmpeg. You will learn how the NUT container structures its index using syncpoints, how to control these index intervals using encoder Group of Pictures (GOP) settings, and how to write the index table and influence frame-level flags using specific FFmpeg command-line arguments.

The NUT container is a highly flexible, low-overhead multimedia container. Because NUT’s index points are tied directly to syncpoints (which accompany keyframes), configuring the “index interval” in a NUT file is achieved by controlling the keyframe interval of the video encoder.

Setting the Index Interval (Syncpoint Frequency)

To set a specific interval for your index points, you must define the GOP size using the -g option. This forces the encoder to produce keyframes at fixed intervals, which in turn forces the NUT muxer to write syncpoints and index entries at those exact intervals.

To guarantee a strict, fixed index interval (for example, every 60 frames), you should also disable scene-change detection to prevent the encoder from inserting extra, irregular keyframes.

Use the following command structure:

ffmpeg -i input.mp4 -c:v libx264 -g 60 -keyint_min 60 -sc_threshold 0 -c:a aac output.nut

In this command: * -g 60: Sets the maximum keyframe interval to 60 frames. * -keyint_min 60: Sets the minimum keyframe interval to 60 frames. * -sc_threshold 0: Disables scene-change keyframe insertion, ensuring a perfectly uniform index interval.

Enabling or Disabling the Index Table

By default, the FFmpeg NUT muxer writes an index at the end of the file to allow for fast and efficient seeking. If you want to explicitly control this behavior, you can use the -write_index private muxer option.

To explicitly force the creation of the index:

ffmpeg -i input.mp4 -c:v libx264 -write_index 1 output.nut

To disable the index entirely (which reduces file overhead but makes seeking slower):

ffmpeg -i input.mp4 -c:v libx264 -write_index 0 output.nut

Configuring Frame Flags

Frame flags in a NUT container (such as keyframe flags, prediction direction, and data size flags) are determined automatically by the muxer based on the properties of the packets delivered by the encoder.

You can influence these container flags by adjusting your codec’s frame-type output settings: