Stream copying is fast and preserves encoded quality, but arbitrary cut points can depend on preceding keyframes. For precise visible boundaries, decode and re-encode, then inspect the exported frames.
A cut request is not always a self-contained picture
You ask a utility to trim a clip from 00:12.500, and the result includes a little extra footage or opens awkwardly. The command may be copying compressed packets rather than creating a new independently decodable frame at your requested moment.
Many delivery codecs store some frames using information from other frames. Keyframes provide important random-access points, while dependent frames need surrounding decode context. Stream copying avoids decoding and re-encoding, which makes it fast and preserves the copied encoded data. It also limits the operations available. A crop, resize, burned-in subtitle or arbitrary newly encoded first frame cannot be performed just by moving packets into a new file.
Choose the trim according to the job
| You need | Prefer | Reason |
|---|---|---|
| A rough excerpt for internal review | Stream copy, then check playback | Fast and avoids an extra encode |
| The first spoken word on a precise frame | Decode and re-encode | Allows a new encoded boundary |
| A crop or subtitles with the cut | Decode, filter and re-encode | Filtering changes decoded pixels |
| A production handoff | The recipient’s agreed format | Timing and decode behavior need to be predictable |
Some specialized editors perform smart rendering, re-encoding only a boundary region when the codec and workflow allow it. Do not assume every “lossless trim” tool does this. Read its mode description and verify the output rather than interpreting the word lossless as frame accuracy.
A stream-copy example and its limitation
For a compatible source, an illustrative FFmpeg rough-cut command is:
ffmpeg -ss 00:00:12.500 -i input.mp4 -t 8 -map 0:v:0 -map 0:a:0? -c copy rough-cut.mp4This selects the first video stream, includes the first audio stream if present, requests eight seconds and copies the encoded streams. It deliberately does not collect every subtitle, alternate audio track or attachment. Adjust mapping for your file.
FFmpeg documents that input seeking normally moves to a preceding seek point. With stream copy, the extra segment may be preserved instead of decoded and discarded. Exact behavior also depends on timestamps, the container and player handling. Inspect the actual beginning, end and audio alignment. A duration display that says eight seconds is not sufficient proof that the intended first frame is shown.
A measured test: where each trim actually started
The source was synthetic: 30 s, 320 × 180, 25 fps, a frame number burned into every frame, H.264 CRF 20 with a keyframe every 50 frames (2.0 s, scene-cut keyframes disabled, two B-frames) and AAC audio. I requested a start at 12.400 s, which is frame 310, for 8 s. I decoded each result and matched every frame against the source to name the first and last source frame shown. ffmpeg 8.1.1 and MP4 only; other tools write and honor timestamps differently.
ffmpeg -ss 12.4 -i src.mp4 -t 8 -map 0:v:0 -map 0:a:0 -c copy copy_input_seek.mp4
ffmpeg -i src.mp4 -ss 12.4 -t 8 -map 0:v:0 -map 0:a:0 -c copy copy_output_seek.mp4
ffmpeg -ss 12.4 -i src.mp4 -t 8 -map 0:v:0 -map 0:a:0 -c:v libx264 -crf 18 -preset medium -c:a aac -b:a 96k reencode.mp4| Run | Bytes | First frame shown | First frame, edit list ignored | Last frame | Duration |
|---|---|---|---|---|---|
| Copy, -ss before -i | 471,099 | 310 | 300 | 511 | 8.08 s |
| Copy, -ss after -i | 383,308 | 350 | 350 | 511 | 8.058 s (video starts at 1.6 s) |
| Re-encode | 474,496 | 310 | 310 | 509 | 8.000 s |
The input-seek copy stored packets from the keyframe at 12.0 s (first packet timestamp −0.4 s) and an edit list that hides the first 10 frames. A reader that honors it shows frame 310; one that ignores it shows frame 300, which is 0.4 s early. The output-seek copy waited for the next keyframe, frame 350 at 14.0 s, so the video stream began 1.6 s into the file while the audio began at 0.022 s. Only the re-encode started on frame 310 and ended on 509, exactly 200 frames. Its first frame differed from the source by a mean 0.444 gray levels, which is the cost of a new encode. See the results JSON.
Worked arithmetic: frames, keyframes and wasted decode
12.4 s × 25 fps = frame 310. Keyframes every 50 frames fall at frames 300 and 350, so the request sits 10 frames (0.4 s) after a keyframe and 40 frames (1.6 s) before the next. That matches the measured 0.4 s of hidden preroll and 1.6 s late start. With a 2 s GOP, any request can fall as much as 49 frames, 1.96 s, after the previous keyframe. If you want a lossless copy with no preroll at all, snap the start to a listed keyframe time, here 12.000 s or 14.000 s.
Re-encode when the visible boundary matters
For a broadly compatible H.264/AAC delivery copy, try this starting command on a duplicate:
ffmpeg -ss 00:00:12.500 -i input.mp4 -t 8 -map 0:v:0 -map 0:a:0? -c:v libx264 -crf 18 -preset medium -c:a aac -b:a 192k -movflags +faststart exact-cut.mp4Input seeking with transcoding uses accurate seeking by default: the extra decoded segment before the requested position is discarded. The quality value and audio bitrate are examples, not universal delivery specifications. Your FFmpeg build must include the chosen encoders.
The timestamp still has to correspond to a real frame boundary. A 25 fps source has frames 40 milliseconds apart; it cannot contain an actual frame at every possible millisecond. If your edit requires a specific numbered frame, choose that boundary in an editor or use a frame-aware filtering workflow, then verify the first visible frame. Variable frame rate requires extra care because frame intervals differ.
Do not force a new frame rate during a simple trim
Preserve source timing unless a delivery requirement calls for conversion. Adding a new output frame rate can duplicate or drop frames, making the trim test harder to interpret. Do not change 29.97 to 30 just to make the number look tidy.
For dialogue, inspect the cut at the waveform as well as the image. Cutting at a nonzero waveform value can create a click, and encoding may introduce a small audio boundary behavior distinct from the video frame boundary. A very short audio fade in an editor can help when appropriate, but adding that fade requires audio processing. Keep some extra source handles for future edits rather than trimming away every frame outside the chosen excerpt.
If you see this, check that
List the keyframes and inspect the first packets and stream start times of the result.
ffprobe -v error -select_streams v:0 -skip_frame nokey -show_entries frame=pts_time -of csv=p=0 input.mp4
ffprobe -v error -select_streams v:0 -show_entries packet=pts_time,flags -of csv=p=0 cut.mp4 | head -3
ffprobe -v error -show_entries stream=codec_type,start_time,duration -of csv=p=0 cut.mp4- Result starts early in one player but correct in another: an edit list is honored by one and ignored by the other. Re-encode if the file must be safe everywhere.
- Audio plays while the picture is black or frozen: video start_time is later than audio, as in the output-seek copy.
- First packet has a negative timestamp: preroll was kept for decoding.
- Result is two frames longer than requested: stream copy ended on a packet boundary, 202 decoded frames against 200 here.
Common mistakes that follow from the mechanism
Assuming the position of -ss means the same thing for copy and for re-encode. Trusting the duration field as proof of the first frame. Judging the cut in a single player, which may honor a hidden edit list that the next tool in the chain ignores. Expecting a re-encode to start at an arbitrary millisecond instead of a real frame. Re-encoding when a keyframe-aligned copy would have met the job, or the reverse.
Inspect frames, sync and the actual destination player
Import the source and trimmed result into an editor. Compare the intended first frame, last visible frame and a sync event inside the excerpt. Play the first second rather than judging only a paused thumbnail. Also open the file in the player or upload path the recipient will use.
For a controlled exercise, choose a source with a visible clock or a clear action across your cut point. Make both a stream-copy trim and a re-encoded trim from the same request. Compare start behavior, duration and output size. This is a repeatable test on your own files, not a promise that one command behaves identically for every codec. Keep the faster version when it satisfies the task and the precise version when boundary accuracy is material.
Common questions
Does stream copying reduce video quality?
The copied encoded streams are not re-encoded, so it avoids generational encoding loss. Container compatibility and cut-boundary behavior still need checking.
Does re-encoding make any millisecond an exact frame?
No. Video has actual frame boundaries. Re-encoding lets you create a new encoded start at a chosen decoded frame, but it cannot invent a source frame at every timestamp.
Which -ss position gives the safest stream-copy trim?
In this test the position before -i started at the requested frame in a reader that honors the edit list, while the position after -i started at the next keyframe, 1.6 s late. Neither gave a self-contained cut, so verify in the player and the editor you will actually use.
How can I find the keyframe times before cutting?
List them with ffprobe -skip_frame nokey as shown above, then pick a start time that coincides with one if you need a lossless copy without hidden preroll.
Sources & further reading
Written for ToolWillow with original explanations and examples. Consult current product documentation for controls that vary by version.



