Why a 15-second MP4 can exceed an AI video reference limit A developer demonstrated that a 15-second MP4 can exceed a 15-second reference limit for AI video services because the video stream, audio stream, and container can report different durations. Using FFmpeg 7.1.1 and a synthetic test file with 15.000000 seconds of video (360 frames) and 15.070000 seconds of audio, the developer showed that a validator checking the longest timeline sees a reference longer than 15 seconds, and recommended probing actual packet presentation timestamps rather than trusting a player's rounded display. A player showing “0:15” does not prove that an MP4 fits a 15-second reference limit. The video stream, audio stream, and container can report different durations. An output duration: 15 setting also does not necessarily trim an uploaded reference. AI disclosure: This article was drafted with AI assistance. The commands and synthetic example were checked locally with FFmpeg 7.1.1; no paid model calls were used. Run this in an empty directory with FFmpeg installed. It deliberately creates 15 seconds of video and slightly longer audio. -n prevents overwriting existing files. ffmpeg -hide banner -loglevel error -n \ -f lavfi -i 'testsrc2=size=320x180:rate=24:duration=15' \ -f lavfi -i 'sine=frequency=440:sample rate=44100:duration=15.07' \ -map 0:v:0 -map 1:a:0 \ -c:v libx264 -preset ultrafast -pix fmt yuv420p \ -c:a aac demo.mp4 There is no -shortest : the mismatch is intentional. Inspect the actual file rather than the rounded player display: ffprobe -v error \ -show entries 'format=duration,start time:stream=index,codec type,codec name,duration,start time,nb frames' \ -of json demo.mp4 In the local test, the video stream was 15.000000 seconds / 360 frames , while the audio stream and container were 15.070000 seconds . Exact values can vary with the encoder and version. A validator checking the longer timeline sees a reference longer than 15 seconds. This synthetic test does not establish how any particular AI service validates files. For a deeper diagnostic, inspect packet presentation timestamps and durations. This script reports the largest PTS + duration for each stream: python import json import subprocess from decimal import Decimal data = json.loads subprocess.check output "ffprobe", "-v", "error", "-show packets", "-show entries", "packet=stream index,pts time,duration time", "-of", "json", "demo.mp4" , text=True ends = {} missing = 0 for packet in data "packets" : if "pts time" not in packet or "duration time" not in packet: missing += 1 continue stream = packet "stream index" end = Decimal packet "pts time" + Decimal packet "duration time" ends stream = max ends.get stream, end , end print {stream: str end for stream, end in ends.items } print "Packets needing further inspection:", missing The test produced endpoints of 15.000000 for video and 15.070000 for audio. Use the maximum presentation endpoint, rather than assuming the final packet in file order has the latest presentation time. This is a diagnostic, not a universal duration validator. Nonzero start times, edit lists, codec delay, variable frame rate, and missing packet timestamps need further inspection. An absolute endpoint is not automatically a duration; account for the relevant timeline start and the service’s validation rules. For this particular file, the video already fits. If a silent reference is accepted, removing audio avoids re-encoding the video: ffmpeg -hide banner -loglevel error -n -i demo.mp4 \ -map 0:v:0 -an -c:v copy -movflags +faststart video-only.mp4 Re-run the probes on video-only.mp4 . In the local test, its container duration, video duration, and maximum video packet endpoint were all 15.000000 seconds . This command removes audio; it does not generally trim an overlong video. If audio is required, trim and re-encode the necessary tracks, then inspect the output again. Stream-copy cuts can be constrained by keyframes, and a separate soundtrack is useful only if the API explicitly supports one. Validate the media you actually upload, as well as the JSON request. References: FFprobe documentation https://ffmpeg.org/ffprobe.html and FFmpeg documentation https://ffmpeg.org/ffmpeg.html .