How to determine video duration via link by downloading 7% of the file, and why the MP4 header can be zero

The author examines the technical challenge of determining the duration of MP4 video files. The focus is on scenarios where standard tools fail to read metadata and the file header contains a zero duration value. The article provides a detailed explanation of the internal structure of the MP4 container and how metadata is stored. The author proposes an efficient solution: retrieving the necessary information using just three HTTP Range requests, which avoids the need to download the entire video file. This method is particularly useful for optimizing services that process media content, as it allows data extraction by downloading only about 7% of the file. The article is valuable for developers working with streaming data and video processing, as it offers an alternative to heavy libraries like ffmpeg, demonstrating a deep understanding of network protocols and file formats.
This is a summary. Read the full article at the original source:
HabrRelated stories
What did AI change in my scheme? Incremental updates instead of full projects
The author analyzes changes in the development approach for the PlyLoom project following the integration of Large Language Model (LLM) tools. The foc…
The Evolution of NGINX in 2026: How the Open Source Version Gained Commercial Plus Features
In 2026, NGINX made a significant technological leap, greatly expanding the capabilities of its open-source (OSS) version. Key updates, including rele…
How to supercharge your Windows 11 PC with this built-in automation tool
Windows 11 includes a powerful, albeit visually dated, utility known as Task Scheduler. While it may not be the most intuitive feature for the average…



