FFmpeg Concat Filter (Re-encode) — effect skill for cuts & pacing

For AI agents: find the right skill in one call — curl -s "https://varg.ai/how-to/api/search?q=<what the person wants>" returns the matching how-to page and the best skills with install commands, as markdown (Russian works too). Full index: https://varg.ai/how-to/llms.txt. Every page has a markdown twin: add .md to its path. Before generating anything, show the person the options on the how-to page.

Join any sources frame-accurately by decoding, normalizing and re-encoding them in one filter graph.

What it does

Plain hard cuts at exact frames, from mixed cameras, phones and AI generations.

When: Mixed resolutions, fps or codecs; whenever trims must be frame-accurate.

Watch out: Forgetting to normalize: concat needs matching size, SAR and pixel format per stream, and the same stream count per segment.

Timing: Hard cuts

Also called: concat filter, filter_complex concat, re-encode join

In FFmpeg

Three segments with video + audio each, normalized to 1080×1920 at 30 fps:

ffmpeg -i a.mp4 -i b.mp4 -i c.mp4 -filter_complex \
"[0:v]scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:-1:-1,setsar=1,fps=30[v0];[0:a]aresample=48000[a0];\
 [1:v]scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:-1:-1,setsar=1,fps=30[v1];[1:a]aresample=48000[a1];\
 [2:v]scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:-1:-1,setsar=1,fps=30[v2];[2:a]aresample=48000[a2];\
 [v0][a0][v1][a1][v2][a2]concat=n=3:v=1:a=1[v][a]" -map "[v]" -map "[a]" -c:v libx264 -crf 18 -c:a aac out.mp4

Input order is segment by segment: v,a of segment 1, then v,a of segment 2. A clip without audio needs a silent stream (anullsrc + atrim) so every segment has the same streams.

Where this comes from

Use when

Not for

Install

Example output

https://s3.varg.ai/how-to/previews/c993e5c5b3cf/take-ffmpeg-concat-filter.mp4 — concat between two shots, with the timeline strip of the edit. Footage: Spring (2019), Andy Goralczyk / Blender Foundation (Blender Studio) | studio.blender.org, CC BY 4.0; Coffee Run (2020), Blender Studio | studio.blender.org, CC BY 4.0. (credit: Rendered by varg · Spring (2019) + Coffee Run (2020))

More cuts & pacing skills