CGJU
CGJU
May 20, 2026 ยท 6 min read

FFmpeg Video Editing Overview

FFmpeg is a powerful cross-platform audio/video processing tool that covers virtually all video editing needs. Compared to traditional desktop editing software, FFmpeg works via the command line, enabling batch automated processing and finding wide application in video production workflows.

This article systematically introduces core FFmpeg video editing operations, including timeline trimming, precise cutting, multi-segment concatenation, playback speed adjustment, video reverse, cropping and rotation โ€” each with detailed command examples and parameter explanations.

Timeline Trimming: ss and to Parameters

Video trimming is the most basic and commonly used editing operation. FFmpeg provides multiple trimming methods to extract any time segment from a video.

Basic Trimming Command

Using -ss to specify the start time and -to to specify the end time is the most intuitive trimming method:

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

Specify Duration with -t

Besides specifying the end time, you can also use the -t parameter to directly specify the trim duration:

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

Precise Frame-Level Trimming

Note that when using -c copy for stream copy, the cut point aligns to the nearest keyframe, which may cause a few seconds of error. For frame-accurate trimming, re-encoding is required:

ffmpeg -i input.mp4 -ss 00:01:30.500 -to 00:02:30.250 -c:v libx264 -c:a aac -accurate_seek output.mp4

Precise Editing Methods

In professional video production, frame-accurate editing is crucial. Here are several methods to achieve precise editing.

Trim Using Frame Numbers

Through the select filter, you can precisely select a specific frame range:

ffmpeg -i input.mp4 -vf "select='between(n,100,500)',setpts=PTS-STARTPTS" -af "aselect='between(t,4.17,20.83)',asetpts=PTS-STARTPTS" output.mp4

Effect of Parameter Position

The placement position of the -ss parameter in FFmpeg affects trimming accuracy and speed:

  • Before input (-ss -i): Quickly seeks to a keyframe, fast but less precise
  • After input (-i -ss): Decodes frame by frame for positioning, precise but slow
  • Combined usage: Quick seek first, then precise adjustment โ€” balances speed and accuracy

Multi-Segment Video Concatenation

FFmpeg provides multiple video concatenation methods for different scenarios.

Method 1: Using the Concat Demuxer

When all videos have identical encoding parameters, you can use stream copy for fast concatenation:

# Create filelist.txt
file 'video1.mp4'
file 'video2.mp4'
file 'video3.mp4'

# Execute concatenation
ffmpeg -f concat -safe 0 -i filelist.txt -c copy output.mp4

Method 2: Using the Concat Filter

When video parameters differ, use the concat filter for re-encoding concatenation:

ffmpeg -i video1.mp4 -i video2.mp4 -i video3.mp4 \
  -filter_complex "[0:v][0:a][1:v][1:a][2:v][2:a]concat=n=3:v=1:a=1[v][a]" \
  -map "[v]" -map "[a]" output.mp4

Playback Speed Adjustment

Adjusting video playback speed is a commonly used effect in creative editing. FFmpeg can flexibly implement speed-up and slow-down.

Video Speed Up

Use the setpts filter to adjust video speed โ€” the smaller the value, the faster the speed:

# 2x speed playback
ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" -af "atempo=2.0" output.mp4

# 4x speed playback (audio requires multi-stage atempo)
ffmpeg -i input.mp4 -vf "setpts=0.25*PTS" -af "atempo=2.0,atempo=2.0" output.mp4

Video Slow Down

Slow motion effects are also achieved with setpts โ€” the larger the value, the slower the speed:

# 0.5x speed (slow motion)
ffmpeg -i input.mp4 -vf "setpts=2.0*PTS" -af "atempo=0.5" output.mp4

Video Reverse Effect

Reverse is a creative video effect, implemented in FFmpeg through the reverse filter.

Reverse Both Video and Audio

ffmpeg -i input.mp4 -vf reverse -af areverse output_reverse.mp4

Reverse Video Only

If you only need to reverse the video and keep the original audio:

ffmpeg -i input.mp4 -vf reverse -c:a copy output_reverse.mp4

Video Cropping and Scaling

Besides timeline trimming, adjusting frame dimensions is also a common requirement.

Crop Video Area

Use the crop filter to crop the frame, with parameters as width:height:x:y:

# Crop center area (width 800 height 600, starting at x=100,y=50)
ffmpeg -i input.mp4 -vf "crop=800:600:100:50" output.mp4

# Crop center square
ffmpeg -i input.mp4 -vf "crop=w=min(iw\,ih):h=min(iw\,ih):x=(iw-min(iw\,ih))/2:y=(ih-min(iw\,ih))/2" output.mp4

Video Scaling

Use the scale filter to adjust video resolution:

# Scale to 1280x720
ffmpeg -i input.mp4 -vf "scale=1280:720" output.mp4

# Scale proportionally (maintain aspect ratio)
ffmpeg -i input.mp4 -vf "scale=640:-1" output.mp4

Rotation and Flipping

Adjusting video orientation is also a common editing operation.

Rotate Video

# Rotate 90 degrees clockwise
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4

# Rotate 90 degrees counterclockwise
ffmpeg -i input.mp4 -vf "transpose=2" output.mp4

# Rotate 180 degrees
ffmpeg -i input.mp4 -vf "transpose=2,transpose=2" output.mp4

Horizontal and Vertical Flip

# Horizontal flip (mirror)
ffmpeg -i input.mp4 -vf hflip output.mp4

# Vertical flip
ffmpeg -i input.mp4 -vf vflip output.mp4

Summary

FFmpeg provides rich video editing capabilities โ€” from basic trimming and concatenation to advanced speed changes, reverse playback, and frame adjustments โ€” all achievable through simple command lines. Mastering these techniques can greatly improve video processing efficiency, especially for batch processing and automated workflow scenarios.

If you want to quickly experience video processing features, you can directly use our online video tools โ€” no software installation needed, complete various video processing operations right in your browser.

Related Recommendations

More great articles and useful tools

Want to process videos quickly?

Use our online video conversion tools โ€” no FFmpeg installation needed, complete video trimming, format conversion, and more right in your browser

Try It Now โžก