user18532: I thought when streaming a mp4 file on a browser, the browser needs to download the whole MP4  file before playing, because the player needs to know metadata like video codec, audio codec, etc. and MP4's metadata can only be known only after downloading the whole file.
But today when I uploaded a 2 Gigabyte MP4 video on AWS S3, it plays instantly on Microsoft Edge (actually there is 1 or 2 seconds' delay, but still obviously the browser did not download the whole MP4 file before playing). By the way I have CloudFront (CDN) before S3, so Microsoft Edge first request the video url to CloudFront, then CoudFront request the MP4 file in S3.
How is it possible? What is the magic behind AWS S3? Don't we have to download the whole MP4 file before knowing MP4's metadata then streaming?

user4169: Mp4 files store all the metadata in the moov box of the file. The browser can download the moov box, then perform byte range requests to pull the rest of the file on demand as needed. the moov box is usually only a few hundred kilobytes.

Don't we have to download the whole MP4 file before knowing MP4's
metadata then streaming?

No

18532: <p>I thought when streaming a mp4 file on a browser, the browser needs to download the whole MP4  file before playing, because the player needs to know metadata like video codec, audio codec, etc. and MP4's metadata can only be known only after downloading the whole file.</p>
<p>But today when I uploaded a 2 Gigabyte MP4 video on AWS S3, it plays instantly on Microsoft Edge (actually there is 1 or 2 seconds' delay, but still obviously the browser did not download the whole MP4 file before playing). By the way I have CloudFront (CDN) before S3, so Microsoft Edge first request the video url to CloudFront, then CoudFront request the MP4 file in S3.</p>
<p>How is it possible? What is the magic behind AWS S3? Don't we have to download the whole MP4 file before knowing MP4's metadata then streaming?</p>
 4169: <p>Mp4 files store all the metadata in the moov box of the file. The browser can download the moov box, then perform byte range requests to pull the rest of the file on demand as needed. the moov box is usually only a few hundred kilobytes.</p>
<blockquote>
<p>Don't we have to download the whole MP4 file before knowing MP4's
metadata then streaming?</p>
</blockquote>
<p>No</p>
