Need to cut a clip from a long video or join multiple files together? FFmpeg handles both with simple commands. Here's how. Once your clips are ready, you might also want to compress them to reduce file size.
Trim a Video
Fast Trim (No Re-encoding)
Use -ss for start time and -to for end time. Adding -c copy skips re-encoding, making it nearly instant:
ffmpeg -ss 00:01:00 -to 00:02:30 -i input.mp4 -c copy output.mp4This extracts the clip from 1:00 to 2:30.
Trim by Duration
Use -t to specify duration instead of end time:
ffmpeg -ss 00:00:30 -i input.mp4 -t 60 -c copy output.mp4This extracts 60 seconds starting from 0:30.
Precise Trim (With Re-encoding)
-c copy is fast but may cut at the nearest keyframe, causing a few seconds of imprecision. For exact cuts:
ffmpeg -ss 00:01:00 -to 00:02:30 -i input.mp4 -c:v libx264 -c:a aac output.mp4Remove a Section from the Middle
To remove a section (e.g., keep 0:00–1:00 and 2:00–end), trim each part then merge:
# Step 1: Extract the parts
ffmpeg -i input.mp4 -to 00:01:00 -c copy part1.mp4
ffmpeg -i input.mp4 -ss 00:02:00 -c copy part2.mp4
# Step 2: Merge (see below)Merge Multiple Videos
Method 1: Concat Demuxer (Recommended)
Create a text file listing the videos:
# filelist.txt
file 'part1.mp4'
file 'part2.mp4'
file 'part3.mp4'Then merge:
ffmpeg -f concat -safe 0 -i filelist.txt -c copy output.mp4This is fast and lossless when all files share the same codec and resolution.
Method 2: Concat Filter (Different Formats)
When files have different codecs or resolutions, use the concat filter:
ffmpeg -i part1.mp4 -i part2.mp4 \
-filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1" \
output.mp4This re-encodes the video, so it's slower but handles mixed formats. If you need to convert formats before merging, see how to convert video format with FFmpeg.
Extract a Single Frame
Grab a frame at a specific timestamp:
ffmpeg -ss 00:00:05 -i input.mp4 -frames:v 1 frame.pngSplit into Equal Parts
Split a video into 30-second segments:
ffmpeg -i input.mp4 -c copy -segment_time 30 -f segment output_%03d.mp4Quick Reference
| Task | Key Parameters |
|---|---|
| Trim (fast) | -ss, -to, -c copy |
| Trim (precise) | -ss, -to, -c:v libx264 |
| Trim by duration | -ss, -t |
| Merge (same codec) | -f concat, -c copy |
| Merge (mixed) | -filter_complex concat |
| Split | -segment_time, -f segment |
Try It Online
Don't want to deal with command lines? Use FFHub to trim and merge videos right in your browser.
Related Articles
- How to Compress Video with FFmpeg - Reduce file size after trimming with CRF, presets, and codec selection
- How to Add Subtitles to Video with FFmpeg - Burn or embed subtitles into your edited videos
- How to Convert Video Format with FFmpeg - Convert between containers and codecs for maximum compatibility

