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

Source: Internet
Author: User

Recently in the use of AS3 write a Flash player, found that the same is H264 encoded MP4 files, and some can be loaded a little to start playback, and some must be all loaded to broadcast.

With the local player (Potplayer, Storm audio, etc.) open the view, found that the code is the same:




The left side of this must be all loaded to play, the right is a load can be broadcast.

Then asked a colleague, said may be Ken head information of the data order. Here is a tool for: Mp4info.exe


Attached Download Address:

Link: Http://pan.baidu.com/s/1nvUcBZN Password: OYS0

This gadget can view the structure information of the MP4 file:


If the video can be loaded and can be played, you need to insert the metadata information in the video header, that is, the data in the Moov->udta->meta in the figure above

If the structure is at the end of the video file, or there is no such data at all, then it can only be played after all the loading is complete.


Here is an online post that describes the method:


http://www.gxchina.com/edu/11216.html#627677-qzone-1-98393-01316438de54fba6421e9817746b2229


Allow Flash Player to support playback of MP4 files, and solve the problem of not loading side-by-side multicast

First, let the Flash Player support MP4, you need to convert the encoding to H. MP4.

Second, to solve the problem of side loading side playback, the MP4 in the metadata information to the file head, the specific method is as follows:

1th Step: Download and install FFmpeg

Use under Windows
Download Address: http://ffmpeg.zeranoe.com/builds/
Click on the page Download FFmpeg git-738ebb4 64-bit Static (I am 64 bit) If you are 32 bit click Download FFmpeg git-738ebb4 32-bit Static
After I downloaded it, I changed the folder to FFmpeg and put it under the D drive.
Run three files:
D:ffmpeg/bin/ffmpeg.exe
D:ffmpeg/bin/ffplay.exe
D:ffmpeg/bin/ffprobe.exe
This is a successful installation


2nd step: Add Qt-faststart to Ffmpeg/bin directory

Download Qt-faststart
Download Address: Http://www.ckplayer.com/down/qt-faststart.rar
Unzip the Qt-faststart.exe and put it in the d:ffmpeg/bin/.


3rd Step: Execute the Modify metadata command

Enter CMD in Start-to-run, pop-up command window
Follow the commands below:
Enter D: Press ENTER
Enter the CD Ffmpeg/bin carriage return so that it enters the FFmpeg directory
Run command again: Qt-faststart.exe d:/1.mp4 D:/2.mp4
Description: 1.mp4 is the original MP4 file, 2.mp4 is the file stored after the modification

The last out of this 2.mp4 is successful, you can support Bengazai side play.


Attach the download address of the backup:

Link: http://pan.baidu.com/s/1bp5u9ht Password: 2sud


Then I followed this method to turn 2 videos, one of which succeeded, implemented a load on the play,



The other one turned or not, and I looked at it with the tools above and found:


Although the MOOV structure is referred to the previous position, but there is no udta, there is no metadata, so this video can not be loaded side play, need to re-encode metadata information to be able to.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.