WaveSpeedAI

How to Trim and Cut Video with FFmpeg: Timestamps, Duration, Split (2026 Guide)

Learn how to trim, cut, and split videos using FFmpeg with precise timestamps and duration controls. Includes fast copy mode, re-encoding, and a free one-click alternative.

By WaveSpeedAI8 min read
How to Trim and Cut Video with FFmpeg: Timestamps, Duration, Split (2026 Guide)

Need to extract a 30-second clip from a long video? Remove the first 10 seconds of a recording? Split a video into multiple parts? FFmpeg can do all of this from the command line—if you know the right flags.

For a clip starting at 1:00, choose based on the cut you need:

# Fast: copies the original streams; the start may not land exactly at 1:00
ffmpeg -ss 00:01:00 -i input.mp4 -t 30 -c copy output.mp4

# Precise: decodes and re-encodes to cut at the requested position
ffmpeg -ss 00:01:00 -i input.mp4 -t 30 -c:v libx264 -c:a aac output.mp4

This guide covers the other common trimming scenarios, plus a quick way to check the file you actually made.

Prerequisites: Install FFmpeg

macOS:

brew install ffmpeg

​Ubuntu/Debian​**:**

sudo apt update && sudo apt install ffmpeg

Windows:

Download FFmpeg from ffmpeg.org, extract it, and add its bin folder to PATH. In PowerShell, put paths containing spaces in quotes:

ffmpeg -ss 00:01:00 -i "C:\Users\Sam\Videos\input clip.mp4" -t 30 -c copy "C:\Users\Sam\Videos\output clip.mp4"

Replace Sam and the filenames with your own. If PowerShell says ffmpeg is not recognized, check the PATH setup before changing the trim command.

Basic Trimming

Cut by Start Time and Duration

Extract about 30 seconds starting at the 1-minute mark without re-encoding:

ffmpeg -ss 00:01:00 -i input.mp4 -t 00:00:30 -c copy output.mp4
  • -ss 00:01:00 — seek to the requested start
  • -t 00:00:30 — write 30 seconds of output
  • -c copy — copy streams without re-encoding

Stream copying is fast and avoids another quality loss. Its starting picture can depend on nearby keyframes, so check the output if the first frame matters.

Cut by Start and End Time

Extract from 1:00 to 2:30:

ffmpeg -ss 00:01:00 -to 00:02:30 -i input.mp4 -c copy output.mp4

Here, both -ss and -to are ​input options​: seek to 1:00 and stop reading at 2:30. The intended interval is 90 seconds, although stream-copy boundaries may vary around keyframes. If the endpoints must be precise, use -c:v libx264 -c:a aac instead of -c copy.

The placement matters. Moving -to after -i changes how it is applied; don’t treat -to as interchangeable with a 90-second -t.

Cut the First N Seconds

Keep only the first 60 seconds:

ffmpeg -i input.mp4 -t 60 -c copy output.mp4

Remove the First N Seconds

Skip the first 10 seconds:

ffmpeg -ss 10 -i input.mp4 -c copy output.mp4

The video starts near the requested point and continues to the end. Re-encode if that opening frame must be exact.

Remove or Keep the Last N Seconds

For a 5-minute video, remove the last 30 seconds by keeping the first 4:30:

ffmpeg -i input.mp4 -t 00:04:30 -c copy output.mp4

If you mean keep only the last 30 seconds, seek backward from the end:

ffmpeg -sseof -30 -i input.mp4 -c copy last30.mp4

The second command is still subject to stream-copy cut behavior.

Fast Copy vs Re-encoding

Fast Mode (-c copy)

ffmpeg -ss 00:01:00 -i input.mp4 -t 30 -c copy output.mp4

Pros: Usually much faster; no re-encoding loss.Cons: The visible start may not match the requested timestamp. A cut near a non-keyframe can also produce an awkward opening in some players.

Precise Mode (re-encode)

ffmpeg -i input.mp4 -ss 00:01:00 -t 30 -c:v libx264 -c:a aac output.mp4

Pros: FFmpeg decodes up to the requested start before writing the new video.Cons: It must process the earlier footage and re-encode the result, which takes longer and can introduce some quality loss.

Best of Both: Input Seeking + Output Re-encoding

ffmpeg -ss 00:01:00 -i input.mp4 -t 30 -c:v libx264 -c:a aac output.mp4

This seeks near 1:00 first, then decodes and discards the extra frames before the requested start. With FFmpeg’s default accurate seeking enabled for transcoding, you usually don’t need the original guide’s manual “seek to 0:58, then trim another 2 seconds” workaround. FFmpeg documents the difference between input and output -ss.

The practical rule: ​codec copying determines whether keyframes constrain your cut​. Putting -ss before -i makes seeking faster; it does not, by itself, make a copied cut precise.

Split Video into Multiple Parts

Split into Equal Parts

Split a 10-minute video into segments targeting two minutes each:

ffmpeg -i input.mp4 -map 0 -c copy -f segment -segment_time 120 -reset_timestamps 1 segment_%03d.mp4

This creates segment_000.mp4, segment_001.mp4, and so on. “120 seconds” is a target, not a guarantee when copying streams. The segment muxer starts a new segment at an available keyframe, so individual lengths can differ. FFmpeg’s segment muxer documentation explains that exact split points require aligned keyframes.

Split at Specific Timestamps

# Part 1: start to approximately 2:00
ffmpeg -i input.mp4 -t 00:02:00 -c copy part1.mp4

# Part 2: approximately 2:00 to 5:00 (three minutes)
ffmpeg -ss 00:02:00 -i input.mp4 -t 00:03:00 -c copy part2.mp4

# Part 3: approximately 5:00 to end
ffmpeg -ss 00:05:00 -i input.mp4 -c copy part3.mp4

I used -t 00:03:00 for Part 2 because ​5:00 − 2:00 = 3:00​. With -c copy, inspect the joins before publishing; independently copied parts can begin around, rather than exactly on, those boundaries. Re-encode when exact, seamless cuts matter.

Extract and Remove Audio

Extract Audio Track Only

If the source audio is compatible with M4A, such as AAC:

ffmpeg -i input.mp4 -vn -c:a copy audio.m4a
  • -vn — exclude video

If stream copying fails because the source audio codec is incompatible with the container, encode it instead:

ffmpeg -i input.mp4 -vn -c:a aac audio.m4a

Extract as MP3

ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 320k audio.mp3

Remove Audio (Keep Video Only)

ffmpeg -i input.mp4 -an -c:v copy output_silent.mp4
  • -an — exclude audio

Common Errors and Fixes

Trimmed video starts with a frozen frame or glitch

This can happen when -c copy starts near a point the video cannot decode cleanly on its own. Re-encode the cut:

ffmpeg -ss 00:01:00 -i input.mp4 -t 30 -c:v libx264 -c:a aac output.mp4

Audio and video go out of sync after trimming

First play the original file to check whether it was already out of sync. If the problem appears only in a copied cut, try the re-encoding command above and inspect the new result. -avoid_negative_ts make_zero shifts output timestamps together; it is ​not a general audio-sync repair​.

“Non-monotonous ​DTS​” warnings

A warning alone does not prove the output is broken. Play the beginning and end of the file. If playback or seeking is faulty, try re-encoding and inspect the source timestamps. -fflags +genpts can help particular missing-presentation-timestamp cases, but it is not a universal fix for this warning.

Trimming is inaccurate ​by​​ several seconds

Check whether you used -c copy. FFmpeg can seek near a keyframe and retain packets around that point. For a precise start, re-encode. Moving -ss after -i while still copying streams does not guarantee a clean, frame-accurate video.

Verify the Clip You Made

Check both the source and the result:

ffprobe -v error -show_entries format=duration -of csv=p=0 input.mp4
ffprobe -v error -show_entries format=duration -of csv=p=0 output.mp4

ffprobe prints each container’s duration in seconds. For the 30-second examples, expect the output to be around 30 seconds; stream-copy boundaries can make it differ. Also inspect the first visible frame and listen near the beginning and end. Duration alone cannot tell you whether the clip starts on the intended image or whether its audio is in sync. See the ffprobe documentation for more fields you can inspect.

When the Footage Needs Repair, Not a Trim

A cut cannot repair compression blocks or an out-of-focus source. If those defects are already in the footage, a separate restoration step may help: WaveSpeedAI’s Video Restorer offers decompression and defocus-deblur modes for supported short clips. It does not fix bad cut points or audio-sync errors, and it cannot guarantee recovery of detail that is completely lost.

For a healthy source that simply needs a shorter clip, use the FFmpeg commands above.

FAQ

What’s the difference between ​-t​​​ and ​-to​?-t specifies a ​duration​: -t 30 means 30 seconds. -to specifies a ​stop position​. Where you place it—before or after -i—affects whether it applies to input or output. Don’t use -t and -to together for the same input or output; FFmpeg gives -t priority.

Can I trim without losing quality? Yes. Use -c copy to avoid re-encoding. The trade-off is that the cut may not begin on the exact frame you requested.

How do I find the exact duration of a video? Use the ffprobe command in “Verify the Clip You Made.” It reports the file’s recorded duration; inspect playback as well if the source has unusual timestamps.

Can I trim multiple files at once? Yes. For many independent files, a shell loop is straightforward:

for file in *.mp4; do
  ffmpeg -i "$file" -t 30 -c copy "trimmed_$file"
done

This keeps the first 30 seconds of each MP4 in the current directory. As with any copied cut, check files whose exact endpoint matters.


Previous posts:

Share