Skip to main content
Produce a thumbnail and a short preview GIF in a single chained request. Chained commands run sequentially on the same input, and outputs from earlier commands can feed later ones — cheaper than two separate calls.

Code

How the FFmpeg commands work

Command 1 (thumbnail): -i {{in_1}} -ss 00:17 -vframes 1 {{out_1}} — grab a single frame at 17 s. Command 2 (GIF):
  • select='lte(t,60)*gt(trunc(t/10),trunc(prev_t/10))' — keep one frame every 10 s, up to the 60 s mark (6 frames total)
  • setpts='PTS*0.1' — speed up playback by 10× so the GIF plays fast
  • scale=...:80:force_original_aspect_ratio=decrease,pad=...:80:-1:-1 — scale to 80 px tall, letterbox width
  • -an — drop audio
  • -vsync vfr — variable frame rate for the speed-up

Response