{"slug": "why-a-15-second-mp4-can-exceed-an-ai-video-reference-limit", "title": "Why a 15-second MP4 can exceed an AI video reference limit", "summary": "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.", "body_md": "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.\n\n*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.*\n\nRun this in an empty directory with FFmpeg installed. It deliberately creates 15 seconds of video and slightly longer audio. `-n` prevents overwriting existing files.\n\n```\nffmpeg -hide_banner -loglevel error -n \\\n  -f lavfi -i 'testsrc2=size=320x180:rate=24:duration=15' \\\n  -f lavfi -i 'sine=frequency=440:sample_rate=44100:duration=15.07' \\\n  -map 0:v:0 -map 1:a:0 \\\n  -c:v libx264 -preset ultrafast -pix_fmt yuv420p \\\n  -c:a aac demo.mp4\n```\n\nThere is no `-shortest`: the mismatch is intentional. Inspect the actual file rather than the rounded player display:\n\n```\nffprobe -v error \\\n  -show_entries 'format=duration,start_time:stream=index,codec_type,codec_name,duration,start_time,nb_frames' \\\n  -of json demo.mp4\n```\n\nIn 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.\n\nFor a deeper diagnostic, inspect packet presentation timestamps and durations. This script reports the largest `PTS + duration` for each stream:\n\n``` python\nimport json\nimport subprocess\nfrom decimal import Decimal\n\ndata = json.loads(subprocess.check_output([\n    \"ffprobe\", \"-v\", \"error\", \"-show_packets\",\n    \"-show_entries\", \"packet=stream_index,pts_time,duration_time\",\n    \"-of\", \"json\", \"demo.mp4\"\n], text=True))\n\nends = {}\nmissing = 0\nfor packet in data[\"packets\"]:\n    if \"pts_time\" not in packet or \"duration_time\" not in packet:\n        missing += 1\n        continue\n    stream = packet[\"stream_index\"]\n    end = Decimal(packet[\"pts_time\"]) + Decimal(packet[\"duration_time\"])\n    ends[stream] = max(ends.get(stream, end), end)\n\nprint({stream: str(end) for stream, end in ends.items()})\nprint(\"Packets needing further inspection:\", missing)\n```\n\nThe 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.\n\nThis 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.\n\nFor this particular file, the video already fits. If a silent reference is accepted, removing audio avoids re-encoding the video:\n\n```\nffmpeg -hide_banner -loglevel error -n -i demo.mp4 \\\n  -map 0:v:0 -an -c:v copy -movflags +faststart video-only.mp4\n```\n\nRe-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**.\n\nThis 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.\n\nValidate the media you actually upload, as well as the JSON request.\n\nReferences: [FFprobe documentation](https://ffmpeg.org/ffprobe.html) and [FFmpeg documentation](https://ffmpeg.org/ffmpeg.html).", "url": "https://wpnews.pro/news/why-a-15-second-mp4-can-exceed-an-ai-video-reference-limit", "canonical_source": "https://dev.to/best-sites/why-a-15-second-mp4-can-exceed-an-ai-video-reference-limit-3gh2", "published_at": "2026-11-10 02:16:38+00:00", "updated_at": "2026-11-10 02:21:06.544840+00:00", "lang": "en", "topics": ["ai-tools", "generative-ai"], "entities": ["FFmpeg", "FFprobe"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/why-a-15-second-mp4-can-exceed-an-ai-video-reference-limit", "markdown": "https://wpnews.pro/news/why-a-15-second-mp4-can-exceed-an-ai-video-reference-limit.md", "text": "https://wpnews.pro/news/why-a-15-second-mp4-can-exceed-an-ai-video-reference-limit.txt", "jsonld": "https://wpnews.pro/news/why-a-15-second-mp4-can-exceed-an-ai-video-reference-limit.jsonld"}}