FFmpeg CLI - Getting Started

FFmpeg is a free, open-source tool for processing video files. Learn how to automate video editing tasks like cropping for different platforms, adding text overlays for branding, and batch processing to create weeks of content in minutes.

What You'll Learn

  • ✅ Crop to Square - Convert landscape videos to 1:1 square format for Instagram, TikTok, and LinkedIn
  • ✅ Add Text Overlays - Brand your videos with website URLs, calls-to-action, or custom text
  • ✅ Loop & Concatenate - Stitch multiple clips together or loop videos for extended runtime
  • ✅ Batch Processing - Run FFmpeg on hundreds of videos to create content at scale
  • ✅ Automation Workflows - Use FFmpeg in scripts, APIs, and no-code platforms like N8N

Commands Covered

1. Crop to Square

Convert landscape videos to perfect 1:1 squares for social media:

ffmpeg -i test-video.mp4 -vf "crop=min(iw\,ih):min(iw\,ih)" output-square.mp4

min(iw\,ih) picks the shorter of the video's width and height and uses it for both sides, so a landscape or portrait clip comes out square. With no position given, FFmpeg takes the crop from the center. The backslash stops the comma from being read as the break between two filters.

2. Add Text Overlay

Add branded text with a semi-transparent background:

ffmpeg -i test-video.mp4 -vf "drawtext=text='your-site.com':fontsize=48:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:box=1:boxcolor=black@0.5:boxborderw=10" output-with-text.mp4

x=(w-text_w)/2 and y=(h-text_h)/2 center the text in the frame. box=1 turns on the background, boxcolor=black@0.5 makes it black at half opacity, and boxborderw=10 gives the text 10 pixels of padding inside it.

3. Loop/Concatenate Videos

Create a file list and concatenate videos without re-encoding:

echo "file 'output-with-text.mp4'" > filelist.txt
echo "file 'output-with-text.mp4'" >> filelist.txt
ffmpeg -f concat -safe 0 -i filelist.txt -c copy output-doubled.mp4

The two echo lines write a list that names the same clip twice. -f concat reads that list in order, -safe 0 lets it name files by any path, and -c copy joins the streams as they are. Nothing is re-encoded, which is why the clips have to share a codec and resolution.

Prerequisites

  • • FFmpeg installed on your system
  • • General understanding of running commands on a command-line interface

Ready to Automate?

Process videos at scale with FFmpeg Micro's API. No servers to manage.

Start Free Trial