mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 17:27:09 +00:00
When the probed video stream duration is inflated (container duration fallback includes a longer audio track), FFmpeg delivers far fewer frames than expected — typically exactly 50% for stock clips whose audio is 2x the video length. The coverage gate then aborts the render because it sees 50% coverage against the inflated expectation. After extraction, if FFmpeg delivered <=60% of the predicted frames, correct `metadata.videoStreamDurationSeconds` to the actual video extent. This reconciliation feeds through to the coverage check via the same `metadata` reference, so `expectedFramesForVideo` sees the true duration without any interface changes. This is a corrective complement to the preventive nb_frames cross-check in extractMediaMetadata — it catches cases where nb_frames is unavailable (MKV, live streams, fragmented MP4). Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>