> ## Content Index
> Fetch the complete content index at: https://ffmpeguru.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Use the segment muxer to write chunks
- URL: https://ffmpeguru.com/use-the-segment-muxer-to-write-chunks/
- Published: 2026-10-06T09:00:00.000Z
- Updated: 2026-10-13T17:59:50.000Z
- Author: FFmpeguru
- Tags: ffmpeg

![](https://picsum.photos/seed/ffback47/1200/630)

The \`segment\` muxer writes the output as a sequence of files, each containing a fixed duration of the input. It is the right tool for generating chunks for an HLS or DASH playlist, or for breaking a long recording into manageable pieces for a CDN.

## The command

```
ffmpeg -i in.mp4 -c:v libx264 -crf 20 -f segment -segment_time 10 -reset_timestamps 1 chunk_%03d.mp4
```

## What it does

The command encodes the input and writes a new file every 10 seconds. The \`chunk\_%03d.mp4\` template is the filename pattern; \`%03d\` is a zero-padded 3-digit counter. The \`reset\_timestamps 1\` flag resets the timestamp counter at the start of each segment, so each file is a standalone 10-second video. The output is a sequence of MP4 files you can serve from a static host or a CDN.

## Requirements

A muxer built into FFmpeg. The encode runs once, so the CPU cost is the same as a single output. The disk cost is multiplied by the number of segments. For a 1-hour input with 10-second segments, the output is 360 files.

## Things to avoid

- Using the segment muxer for a single output. The muxer is designed for multiple files; for a single output, use the default MP4 muxer.
- Forgetting the \`reset\_timestamps 1\` flag. Without it, each segment starts where the previous one left off, so the concatenation will not be seamless.
- Using a very short segment time. A 1-second segment is fine for low-latency streaming, but it produces a huge number of files and increases the manifest size.
- Expecting the muxer to write an HLS manifest. The muxer writes the segments; the manifest (\`.m3u8\` file) is a separate output. Use the \`hls\` muxer for a single command that writes both.