👉 Try Free Online Marksheet Generator Tool – Create school & college marksheets instantly

FFmpeg Video Trimming: Complete Guide to Cut Videos Using Start and End Time

Basic Video Trimming with Start and End Time

Using the -ss and -to parameters allows you to specify exact start and end points in your video. This method is more intuitive than specifying duration.

Trim Video Using Start and End Time
# Trim video from 10 seconds to 40 seconds
ffmpeg -i input.mp4 -ss 00:00:10 -to 00:00:40 -c copy output_trimmed.mp4

# Alternative format using seconds
ffmpeg -i input.mp4 -ss 10 -to 40 -c copy output_trimmed.mp4

Advanced Trimming Techniques

For more complex operations, you can combine trimming with format conversion or quality adjustments.

Trim with Re-encoding
# Trim and convert to different format
ffmpeg -i input.mp4 -ss 00:00:15 -to 00:00:45 -c:v libx264 -c:a aac -crf 23 output.mp4

# Trim with resolution change
ffmpeg -i input.mp4 -ss 00:00:05 -to 00:00:25 -vf scale=1280:720 -c:v libx264 output.mp4

Optimization Tips for Video Trimming

⚠️ Important: When using -c copy, ensure the start time aligns with keyframes for clean cuts. For frame-accurate cutting, omit the copy parameter to allow re-encoding.

For frame-accurate trimming, place the -ss parameter after the input file:

Frame-Accurate Trimming
# Frame-accurate trimming (slower but more precise)
ffmpeg -i input.mp4 -ss 00:00:10.500 -to 00:00:40.250 -c:v libx264 -c:a aac output.mp4

# Fast trimming with keyframe alignment
ffmpeg -i input.mp4 -ss 00:00:10 -to 00:00:40 -c copy output.mp4

Batch Processing Multiple Trims

For multiple trims from the same source video, create a script to automate the process.

Batch Trimming Script
#!/bin/bash
input_video="input.mp4"

# Define trim segments
segments=(
  "00:00:10-00:00:30-segment1"
  "00:01:00-00:01:45-segment2"
  "00:02:30-00:03:15-segment3"
)

for segment in "${segments[@]}"; do
  IFS='-' read -r start end name <<< "$segment"
  ffmpeg -i "$input_video" -ss "$start" -to "$end" -c copy "${name}.mp4"
  echo "Created ${name}.mp4"
done

Conclusion

FFmpeg's video trimming capabilities provide precise control over video extraction using start and end time parameters. The -ss and -to approach offers more intuitive control than duration-based trimming. For fastest processing, use stream copying with -c copy, but be aware of keyframe alignment requirements. When frame accuracy is crucial, allow re-encoding for clean cuts at exact timestamps. This technique is essential for content creators who need to extract specific moments from longer recordings, create highlight reels, or prepare clips for social media platforms. The flexibility of FFmpeg allows combining trimming with other operations like format conversion, quality adjustment, and resolution changes in a single command. Mastering these trimming techniques significantly improves workflow efficiency for video editing tasks.

📚 Further Learning: For more advanced FFmpeg techniques, check the official FFmpeg documentation at ffmpeg.org/documentation

← Back to Marksheet Generator