Stitch ranked clips into a vertical countdown with ffmpeg

Stitch ranked clips into a vertical countdown with ffmpeg

ShortsRank

If you are comfortable in a terminal you can build a numbered countdown with ffmpeg and no editor at all. These commands were run on a Linux box with three test clips and produced a 1080×1920 file of the expected length. Adjust the font path for your system.

The idea

For each clip, do three things in one pass: scale it to fit a 1080×1920 frame, pad the leftover space, and burn a rank number in a corner. Then concatenate the results in countdown order, worst first, #1 last.

Step 1: render each clip with its number

For a Top 3, the first clip shown is #3.

ffmpeg -i clipA.mp4 -t 4 -vf "scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2:black,setsar=1,fps=30,drawtext=text='#3':fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:fontsize=180:fontcolor=white:borderw=8:bordercolor=black:x=60:y=80" -c:v libx264 -pix_fmt yuv420p -c:a aac -ar 48000 -ac 2 r_clipA.mp4

What each part does:

  • -t 4 keeps four seconds, so every item has the same hold.
  • scale=...:force_original_aspect_ratio=decrease fits the clip inside 1080×1920 without stretching it.
  • pad=... centres it on a black frame. Use a blurred copy of the clip as a background if you prefer, though that needs a more complex filter graph.
  • drawtext burns the rank. borderw gives it an outline so it stays readable on bright footage.
  • The same video and audio settings on every clip matter for the next step.

Repeat for the other clips with #2 and #1.

Step 2: concatenate

Make a text file named list.txt in countdown order:

file 'r_clipA.mp4'
file 'r_clipB.mp4'
file 'r_clipC.mp4'

Then:

ffmpeg -f concat -safe 0 -i list.txt -c copy countdown.mp4

-c copy avoids re-encoding, which only works because all the parts share codec, size, frame rate, and audio settings. That is why step 1 forces the same settings on every clip. If you skip that, the concat will fail or glitch.

You can check the result with ffprobe -v error -show_entries stream=width,height,codec_name,duration -of csv=p=0 countdown.mp4. In the test it reported h264 at 1080×1920, with an AAC audio stream.

Things this does not do

It does not add titles beyond the number, a title card, transitions, or loudness matching between clips. It does not trim silence. And it does not give you a preview, so you re-run the command each time you swap two clips. That is the real cost of this route: reordering means re-running.

When a browser editor is faster

For one-off countdowns where you are changing the order and the titles, a tool that shows a preview is quicker. ShortsRank makes the same kind of file: you add your own MP4, WebM, or MOV clips, set Top 3, 5, or 10, reorder, name each card, and export a 9:16 video in the browser, without uploading the clips. Its how-to page describes the order of operations, and the export checklist covers what to check in the downloaded file. The free export is watermarked and limited to three four-second clips; there is a one-time paid unlock for more.

More notes in this series: A pacing sheet for a Top 5 countdown short built from your own clips

Report Page