Trim video file using FFMPEG

This is a note to self, and hopefully to others, about how to easily and quickly trim videos without recompression.

Often I end up with long video recordings that I want to split or trim. One a side note sometimes people call this “cropping”, but in my world cropping is to cut out parts of the image, that is, a spatial transformation. Splitting and trimming are temporal transformations.

You can of course both split and trim in most video editing software, but these will typically also recompress the file on export. This reduces the quality of the video, and it also takes a long time. A much better solution is to trim losslessly, and fortunately there is a way to do this with the wonder-tool FFMPEG. Being a command line utility (available on most platforms) it has a ton of different options, and I never remember these. So here it goes, this is what I use (on Ubuntu) to trim out parts of a long video file:

This will cut out the section from about 1h19min to 2h18min losslessly, and will only take a few seconds to run.

Published by

alexarje

Alexander Refsum Jensenius is a music researcher and research musician living in Oslo, Norway.