Trim a video without re-encoding using -c copy
Cut a section out of a video in FFmpeg 7.1 without re-encoding by combining -ss, -to and -c copy, at the price of keyframe-aligned start points.
Stream copy moves the compressed packets from one file to another and never touches a decoder, so a cut takes about as long as the disk needs to read and write it. This is FFmpeg 7.1 on a normal H.264 and AAC MP4.
ffmpeg -ss 00:01:00 -to 00:02:30 -i input.mp4 -c copy clip.mp4Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for helpBoth streams are listed as (copy), which is how you confirm nothing was decoded. The catch is that a copied H.264 stream can only start on a keyframe, because every frame after it depends on that frame. If 00:01:00 falls between keyframes, FFmpeg starts at the previous keyframe or, depending on the muxer, writes a few leading frames that cannot be decoded, and many players show a frozen picture for the first moment. Run ffprobe -skip_frame nokey -select_streams v -show_entries frame=pts_time -of csv input.mp4 to list the keyframe times first.
When -ss is an input option, as here, -to counts from the new start in current releases, so the clip above is 90 seconds long. See the FFmpeg manual on -ss and -to. If the cut has to land on an exact frame, you must re-encode, or use the two-step cut in the row on combining input and output seeking.