Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Breaking up video

Fundamentally there are two main kinds of operations people want to do with ffmpeg: short clips and chunking up video.

The former is easiest to do by just re-encoding the video, assuming the clips are short. This means you can select any arbitrary points to encode from/to, and while the operation will take a minute if you set the quality properly there should not be a significant loss.

The latter is more complicated. Trying to re-encoding hours of video at a high quality is time-consuming and a waste. In this case, you want to trim along keyframes so that you don't have to re-encode the video at all (assuming we're dealing with x264 here anyway). For the non-technical, keyframes are just locations where the video data is specified from scratch, as opposed to referencing frames elsewhere in the video.

Get ffmpeg