Options

The segment muxer supports the following options:

'increment_tc 1|0'

if set to 1, increment timecode between each segment If this is selected, the input need to have a timecode in the first video stream. Default value is 0.

'reference_stream specifier'

Set the reference stream, as specified by the string specifier. If specifier is set to auto, the reference is chosen automatically. Otherwise it must be a stream specifier (see the "Stream specifiers" chapter in the ffmpeg manual) which specifies the reference stream. The default value is auto.

'segment_format format'

Override the inner container format, by default it is guessed by the filename extension.

'segment_format_options options_list'

Set output format options using a :-separated list of key=value parameters. Values containing the : special character must be escaped.

'segment_list name'

Generate also a listfile named name. If not specified no listfile is generated.

'segment_list_flags flags'

Set flags affecting the segment list generation.

It currently supports the following flags:

'cache'

Allow caching (only affects M3U8 list files).

'live'

Allow live-friendly file generation.

'segment_list_size size'

Update the list file so that it contains at most size segments. If 0 the list file will contain all the segments. Default value is 0.

'segment_list_entry_prefix prefix'

Prepend prefix to each entry. Useful to generate absolute paths. By default no prefix is applied.

'segment_list_type type'

Select the listing format.

The following values are recognized:

'flat'

Generate a flat list for the created segments, one segment per line.

'csv, ext'

Generate a list for the created segments, one segment per line, each line matching the format (comma-separated values):

segment_filename,segment_start_time,segment_end_time

segment_filename is the name of the output file generated by the muxer according to the provided pattern. CSV escaping (according to RFC4180) is applied if required.

segment_start_time and segment_end_time specify the segment start and end time expressed in seconds.

A list file with the suffix ".csv" or ".ext" will auto-select this format.

'ext' is deprecated in favor or 'csv'.

'ffconcat'

Generate an ffconcat file for the created segments. The resulting file can be read using the FFmpeg demuxer.

A list file with the suffix ".ffcat" or ".ffconcat" will auto-select this format.

'm3u8'

Generate an extended M3U8 file, version 3, compliant with .

A list file with the suffix ".m3u8" will auto-select this format.

If not specified the type is guessed from the list file name suffix.

'segment_time time'

Set segment duration to time, the value must be a duration specification. Default value is "2". See also the 'segment_times' option.

Note that splitting may not be accurate, unless you force the reference stream key-frames at the given time. See the introductory notice and the examples below.

'segment_atclocktime 1|0'

If set to "1" split at regular clock time intervals starting from 00:00 o'clock. The time value specified in 'segment_time' is used for setting the length of the splitting interval.

For example with 'segment_time' set to "900" this makes it possible to create files at 12:00 o'clock, 12:15, 12:30, etc.

Default value is "0".

'segment_clocktime_offset duration'

Delay the segment splitting times with the specified duration when using 'segment_atclocktime'.

For example with 'segment_time' set to "900" and 'segment_clocktime_offset' set to "300" this makes it possible to create files at 12:05, 12:20, 12:35, etc.

Default value is "0".

'segment_clocktime_wrap_duration duration'

Force the segmenter to only start a new segment if a packet reaches the muxer within the specified duration after the segmenting clock time. This way you can make the segmenter more resilient to backward local time jumps, such as leap seconds or transition to standard time from daylight savings time.

Default is the maximum possible duration which means starting a new segment regardless of the elapsed time since the last clock time.

'segment_time_delta delta'

Specify the accuracy time when selecting the start time for a segment, expressed as a duration specification. Default value is "0".

When delta is specified a key-frame will start a new segment if its PTS satisfies the relation:

PTS >= start_time - time_delta

This option is useful when splitting video content, which is always split at GOP boundaries, in case a key frame is found just before the specified split time.

In particular may be used in combination with the 'ffmpeg' option force_key_frames. The key frame times specified by force_key_frames may not be set accurately because of rounding issues, with the consequence that a key frame time may result set just before the specified time. For constant frame rate videos a value of 1/(2*frame_rate) should address the worst case mismatch between the specified time and the time set by force_key_frames.

'segment_times times'

Specify a list of split points. times contains a list of comma separated duration specifications, in increasing order. See also the 'segment_time' option.

'segment_frames frames'

Specify a list of split video frame numbers. frames contains a list of comma separated integer numbers, in increasing order.

This option specifies to start a new segment whenever a reference stream key frame is found and the sequential number (starting from 0) of the frame is greater or equal to the next value in the list.

'segment_wrap limit'

Wrap around segment index once it reaches limit.

'segment_start_number number'

Set the sequence number of the first segment. Defaults to 0.

'strftime 1|0'

Use the strftime function to define the name of the new segments to write. If this is selected, the output segment name must contain a strftime function template. Default value is 0.

'break_non_keyframes 1|0'

If enabled, allow segments to start on frames other than keyframes. This improves behavior on some players when the time between keyframes is inconsistent, but may make things worse on others, and can cause some oddities during seeking. Defaults to 0.

'reset_timestamps 1|0'

Reset timestamps at the beginning of each segment, so that each segment will start with near-zero timestamps. It is meant to ease the playback of the generated segments. May not work with some combinations of muxers/codecs. It is set to 0 by default.

'initial_offset offset'

Specify timestamp offset to apply to the output packet timestamps. The argument must be a time duration specification, and defaults to 0.

'write_empty_segments 1|0'

If enabled, write an empty segment if there are no packets during the period a segment would usually span. Otherwise, the segment will be filled with the next packet written. Defaults to 0.

Make sure to require a closed GOP when encoding and to set the GOP size to fit your segment time constraint.