Trim a video without re-encoding with ffmpeg

Cut a clip out of a long recording in a second, with no quality loss.

SNP 035 #397 Filed ffmpeg cmd

shell
ffmpeg -ss 00:01:30 -to 00:02:45 -i recording.mp4 -c copy clip.mp4

-c copy copies the streams as they are, so it's instant and lossless. The catch: it can only cut on keyframes, so the start may be off by up to a few seconds.

If you need the cut to land exactly where you said, let it re-encode:

shell
ffmpeg -ss 00:01:30 -to 00:02:45 -i recording.mp4 -c:v libx264 -crf 18 -c:a copy clip.mp4