How to Validate an Extended Clip's Duration and Seam With ffprobe Before You Ship It
Video-extension tools return a file, not a promise. If you drop the result straight into a build, you have no idea whether the container duration matches the requested extension, whether the frame rate stayed constant, or whether the join between the original clip and the generated tail is a clean cut or a one-frame flash. This is a problem you can turn into a deterministic check: assert container metadata with ffprobe, then inspect the seam frames with ffmpeg. No eyeballing, no "it looked fine in the player".
This walkthrough uses the AI Video Duration Extender, which extends a clip from an instruction and a duration setting, and it treats the returned MP4 as untrusted input to a CI-style acceptance test.
What the tool needs and returns
The route is a real generator: upload the source clip, describe the change you want, choose a duration, and submit. The default model shown is Grok Imagine Video Extension at 105 credits, the default visibility is Public · watermarked, and presets include Product reveal, Character scene and Vertical social. You supply the clip and the intent; the service supplies a container you should verify before use.
The contract you should assert
Decide these four properties before you accept the file:
- Container duration is within tolerance of source duration plus requested extension.
- Frame rate is constant and matches the source.
- Resolution is unchanged (no silent downscale).
- The seam shows no black, frozen or duplicated frame within one frame of the expected join.
A reproducible ffprobe check
Install nothing beyond ffmpeg. Save the script, point it at the source and the extended file, and run it in CI:
#!/usr/bin/env bash
set -euo pipefail
SRC="${1:?source clip}"
EXT="${2:?extended clip}"
TOL="${3:-0.10}" # seconds of tolerated drift
probe() { ffprobe -v error -select_streams v:0 \
-show_entries stream=width,height,r_frame_rate,nb_frames,duration \
-of default=noprint_wrappers=1 "$1"; }
src_dur=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$SRC")
ext_dur=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$EXT")
src_fps=$(ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate -of csv=p=0 "$SRC")
ext_fps=$(ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate -of csv=p=0 "$EXT")
awk -v a="$src_dur" -v b="$ext_dur" -v t="$TOL" 'BEGIN{
if (b <= a) { print "FAIL: extended duration not greater than source"; exit 1 }
print "source", a, "extended", b, "delta", b-a
}'
[ "$src_fps" = "$ext_fps" ] || { echo "FAIL: fps changed $src_fps -> $ext_fps"; exit 1; }
echo "PASS: duration grew, frame rate preserved"
For the seam, extract the two frames either side of the expected join and compare their mean absolute difference with ffmpeg. A jump far above the local average, or a frame that is entirely black, is the flash you are looking for:
JOIN=$(awk -v a="$src_dur" 'BEGIN{printf "%.3f", a-0.05}')
ffmpeg -v error -ss "$JOIN" -i "$EXT" -frames:v 2 -f image2 /tmp/seam-%02d.png
# mean luma of each seam frame; a near-zero frame is a black flash
ffprobe -v error -f lavfi -i "movie=/tmp/seam-01.png,signalstats" \
-show_entries frame_tags=lavfi.signalstats.YAVG -of csv=p=0
Interpreting the results
- Duration grew but fps changed. Reject. Variable frame rate in a delivery clip breaks editors that assume CFR.
- Duration is shorter than the source. The extension failed silently; the output is not usable.
- A black seam frame. The model inserted a transition frame. Trim one frame at the join or re-run with a different instruction.
- Everything passes. Record the probe output next to the file hash so the check is reproducible later.
Limitations
ffprobe proves container properties, not motion quality. A clip can pass every numeric assertion and still show a stretched subject across the seam; that remains a human review. The check also cannot tell you whether the extended content matches the brief — only that the file is structurally sound. Treat the assertions as a gate, not a substitute for watching the join once at full speed.
Next step
Run the probe on a real extension before it reaches a build. Open the AI Video Duration Extender and extend a clip, then assert the contract above before you ship it.


Top comments (0)