ffprobe check for Gemini Omni reference videos: 3 files, 3 s each

Before sending reference videos to Sume's gemini-omni-flash-1.1, check with ffprobe that you have one to three files and each is 3.0 s or shorter. Bash script.

5 min readSume
All posts

Sume's Video Router takes up to 3 reference videos for reference-to-video, and each one can be at most 3 seconds long; it takes up to 10 reference images. A 4-second file is a request you pay a round trip to have refused, so check first. The bash script below counts the files (1 to 3), reads each duration with ffprobe, prints ok or LONG, suggests an ffmpeg -t 3 command for long files, and exits non-zero if any file is over.

The limits

Reference-to-video on the Video Router uses reference_image_urls and reference_video_urls, which you refer to in the prompt as <IMAGE_REF_0> and <VIDEO_REF_0>, counted from 0 in list order. The model itself, gemini-omni-flash-1.1, accepts 3 to 10 seconds of output in 16:9 or 9:16 with native audio always on, and it takes video references but no audio references.

Reference limits for Gemini Omni Flash 1.1 on the Video Router (Sume docs, read 2026-10-09)
ItemLimit
Reference videosUp to 3
Length of each reference videoUp to 3 s
Reference imagesUp to 10
Audio referencesNot accepted
Output length3-10 s
Prompt tags<VIDEO_REF_0>, <VIDEO_REF_1>, ... (0-based)

What the script does

ffprobe reads format=duration for each file as plain text. awk compares it with 3.0, because bash cannot compare decimals. A file of exactly 3.00 seconds passes. For a longer file the script prints the clip command ffmpeg -i name -t 3 -c copy short-name, which cuts the first 3 seconds without re-encoding; with -c copy the cut lands on the nearest keyframe, so re-encode if you need exactness.

The argument count check runs first and exits with status 2 for zero or more than three files, so a CI job can tell a usage error from a long file.

#!/usr/bin/env bash
set -euo pipefail
# usage: ./refcheck.sh ref1.mp4 ref2.mp4 ref3.mp4 (Gemini Omni Flash 1.1: up to 3 reference videos, each up to 3 s)
[ "$#" -ge 1 ] && [ "$#" -le 3 ] || { echo "send 1 to 3 reference videos" >&2; exit 2; }
bad=0
for f in "$@"; do
  secs=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$f")
  if awk -v s="$secs" 'BEGIN { exit !(s <= 3.0) }'; then
    printf 'ok    %-20s %.2fs\n' "$f" "$secs"
  else
    printf 'LONG  %-20s %.2fs  -> ffmpeg -i %s -t 3 -c copy short-%s\n' "$f" "$secs" "$f" "$f"
    bad=1
  fi
done
exit "$bad"

Where it fits

Run it where the files are produced, before upload. The API needs public HTTPS URLs for the references, so the check belongs ahead of the upload step and the submit step. A 400 for a reference-to-video call that was always going to be refused is a bad way to find out. The output length is separate: if you ask for 8 seconds of output, you pay 8 x 0.125 = $1.00 at 720p, regardless of how long the references are.

For a batch of references, put the three files you want in one folder and run the script with a glob. If it exits 1, trim the files it flags and run it again. The same loop works for any model whose reference video limit is shorter than your source material; only the 3.0 constant and the file count change, and both come from the model's documented limits. Name the files in the order you refer to them in the prompt, because the tags are counted from 0 in list order and a swapped order gives the wrong subject.

  • Probe the file you upload, not the source.
  • Keep references short and about one subject.
  • Remember that video_url edits cannot be combined with references.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume