Use ffmpeg to modify MP4 file header information to support streaming loading and playback.

Published: 2022-09-14

Users often report that for mp4 files loaded on some web pages, some can start playing after loading only a little, while others must be fully loaded before they can play.

After verification, this is mainly related to the data order of the header information. You can use the tool: mp4info.exe to view the structure information of an mp4 file:


If the video can play as soon as it has loaded, metaData information needs to be inserted into the video header, that is, the data in moov->udta->meta in the figure above.

If this structure is at the end of the video file, or these data do not exist at all, then it can only play after everything has been fully loaded.



To solve the problem of playing while loading, move the Metadata information in the MP4 to the file header. The specific method is as follows:


Download and install ffmpeg, and download qt-faststart.exe.

Place qt-faststart.exe in the bin folder of the ffmpeg folder.

Type cmd in Start->Run to open the command window.

Go to the installation directory, enter ffmpeg/bin and press Enter. This enters the ffmpeg directory.

Then run the command: qt-faststart.exe d:/1.mp4  d:/2.mp4

Note: 1.mp4 is the original mp4 file, and 2.mp4 is the modified and saved file.

The final 2.mp4 is the successful one, and it can support playing while loading.