Each of these is one ffmpeg command, and you can do all three in one go. The only part that catches people out is trimming fast, without re-encoding: it is instant and lossless, but the cut can only start on a keyframe, and the wrong flag order loses the picture.
A three-second cut, cropped square, before export.
Trim to the part from 3 s to 6 s, exactly:
ffmpeg -ss 3 -to 6 -i input.mp4 -c:v libx264 -crf 18 -c:a aac output.mp4
Crop to a square from the middle of a 1280×720 frame, at double speed:
ffmpeg -i input.mp4 -vf "crop=720:720:280:0,setpts=PTS/2" -af "atempo=2.0" output.mp4
Both re-encode, so the cut is frame-accurate and the filters can work. For a fast lossless trim, see the copy section below.
Trim
Exact cuts: re-encode
ffmpeg -ss 3 -to 6 -i input.mp4 -c:v libx264 -crf 18 -c:a aac output.mp4
-ss is the start and -to the end, both in seconds or as 00:01:23.5. Use
-t 3 instead of -to to give a length. Put before -i, they make ffmpeg seek
in the input, which is fast even on a long file. On our 8-second sample this
gave a file of exactly 3.000 s, 75 frames at 25 fps, and its first frame is the
source frame at 3.00 s, not the one before. -crf 18 keeps the quality close to
the original. The cost is time, and a little quality, because every frame is
compressed again.
Fast cuts: copy the streams
ffmpeg -ss 3 -to 6 -i input.mp4 -c copy output.mp4
-c copy copies the compressed video as it is: no quality loss, done in a
moment. But most frames in a video only make sense relative to the keyframe
before them, so a copied cut has to start at a keyframe. To see where yours are:
ffprobe -v error -select_streams v -skip_frame nokey -show_entries frame=pts_time -of csv=p=0 input.mp4
We cut 3 s to 6 s from a clip with a keyframe every 2 seconds (0, 2, 4, 6), each
way, and measured the results with ffprobe:
| Command | What you get |
|---|---|
-ss 3 -to 6 -i in.mp4 -c copy out.mp4 |
Starts at 3 s in players that honour MP4 edit lists. The file still holds the video from the 2 s keyframe, with that second marked as hidden, and the picture runs 3.2 s |
-ss 3 -to 6 -i in.mp4 -c copy out.mkv |
Starts at the 2 s keyframe: 4.3 s long, a second early. MKV has no way to hide the lead-in |
-i in.mp4 -ss 3 -to 6 -c copy out.mp4 |
Sound from 3 s, picture only from the 4 s keyframe: the first second has no picture |
-ss 3 -to 6 -i in.mp4 -c:v libx264 … out.mp4 |
Exactly 3.000 s, from the right frame |
After -i, a copied cut drops everything before the start and writes no video
until the next keyframe. Our 8-second sample has one keyframe, at 0 s, so
cutting it that way produced a file with sound and no video track at all.
So: -ss before -i, -c copy, save as MP4, and the cut usually plays from
the right place, a little long at the end. A player or editor that ignores MP4
edit lists shows the hidden lead-in. If the cut point matters, re-encode.
On a Mac, for a trim only
QuickTime Player can trim. Open the video, choose Edit > Trim, drag the yellow handles and click Trim, then save. Holding a handle shows single frames for a finer cut. Apple's steps are in Trim a movie or clip in QuickTime Player. It has no crop and no speed control.
Crop
ffmpeg -i input.mp4 -vf "crop=720:720:280:0" -c:a copy output.mp4
crop=w:h:x:y: the width and height to keep, then the top-left corner, counted
from the top left of the frame. 280 is (1280 − 720) / 2, which centres the
square. Leave out x:y and ffmpeg centres it for you, so a vertical 9:16 cut
from landscape footage is:
ffmpeg -i input.mp4 -vf "crop=ih*9/16:ih" -c:a copy output.mp4
On 1280×720 that came out 404×720. H.264 needs even dimensions, and ffmpeg
rounded the 405 down. -c:a copy leaves the sound untouched; the video has to
be re-encoded, because cropping changes every frame.
Change the speed
ffmpeg -i input.mp4 -vf "setpts=PTS/2" -af "atempo=2.0" output.mp4
setpts=PTS/2 halves every frame's timestamp, so the picture plays twice as
fast. It does nothing to the sound, which is what atempo=2.0 is for: it speeds
the audio up without raising the pitch. The 8-second sample came out 4.0 s long,
still at 25 fps (ffmpeg dropped every other frame). To slow down, multiply
instead: setpts=PTS*2 with atempo=0.5.
One atempo takes 0.5 to 100, so a quarter speed fails with
Value 0.250000 for parameter 'tempo' out of range [0.5 - 100]. Chain two:
ffmpeg -i input.mp4 -vf "setpts=PTS*4" -af "atempo=0.5,atempo=0.5" -r 25 output.mp4
That gave 32 s from 8. Without -r 25, slowing 25 fps footage down leaves it at
12.5 or 6.25 frames a second, which looks choppy. -r 25 repeats frames to fill
the gap; it does not invent new ones. No sound wanted? Swap the -af for -an.
All three at once
Filters run in the order you write them, so crop first, then the speed:
ffmpeg -ss 3 -to 6 -i input.mp4 -vf "crop=720:720:280:0,setpts=PTS/2" -af "atempo=2.0" output.mp4
On our sample: a 720×720 file, 1.5 seconds long, cut from 3 s to 6 s and played at double speed.
In the browser
The editor does the same job with a timeline and a crop box, and it re-encodes every time (H.264 for MP4 and MOV, VP8 for WebM). There is no lossless copy mode, so a long file takes real encoding time, even for a trim alone.
- Open the video editor and drop the video on it, or click Choose video.
- Drag the two handles on the Timeline to the start and end you want. The header shows the length of the selection and the length it will export at.
- Under Crop, pick an Aspect ratio (1:1, 4:5, 9:16, 16:9 or 21:9, or Freeform) and drag the box over the part to keep. Rotate & flip is there too.
- Under Speed, pick a Playback speed from 0.25x to 2x, or type up to 4 under Custom. Target duration works it out from the length you want. Preserve pitch keeps voices natural; Change with speed lets them rise and fall like a tape.
- Under Export, choose MP4 · recommended, a Quality, and a Frame rate if you slowed it down. Click Export video, then Download.
At 2x the three-second selection exports at half the length.
The result plays in the panel before you download it.
It runs in your browser's memory, so files up to about 300 MB work best.
Which to use
- Just a shorter copy, quickly:
ffmpeg -ss … -to … -i input.mp4 -c copy output.mp4, or QuickTime Player's Trim on a Mac. - A cut on an exact frame, a crop or a new speed: ffmpeg with re-encoding, using the commands above.
- No ffmpeg, a managed laptop, or you want to see the crop before you commit: the video editor. Your file stays on your computer.
If the result is too big to send, compress it next.