MP4 videos recorded in Android cannot be played as HTTP Streaming Media

Source: Internet
Author: User

Basic MP4 knowledge:
The MP4 file structure mainly contains the moov part, the video metadata and the mdat part, the video content.
When playing MP4 over HTTP, the atom moov is required. Otherwise, an error is returned and the system exits. However, this error is not determined when playing MP4 in the file format. The actual situation is that when playing MP4, you must first obtain moov data. Otherwise, you cannot parse the audio/video data in the mdat to play MP4 over HTTP because moov is behind the mdat, that is, at the end of the file, to play the file, it means that you must download mdat before downloading it to moov. That is to say, you cannot directly obtain moov, therefore, you cannot play this file online through HTTP. It is not in the form of a local file that does not judge moov, instead, in the file form, moov can obtain moov data from the player either in the file header or in the file tail. In the http mode, seek cannot be taken to the end of the file at will, therefore, the moov data cannot be obtained immediately. Of course, the data cannot be played.

About the drag playback problem: the first thing to do is to find the position, that is, seek position. seek is the positioning time, but the time Positioning transmits keyframes to the player in the metadata event in the FLV or MP4 files that can be dragged. This keyframes is the basis for the correspondence between the time and the file data header positioning. The range of the buffered data to be downloaded is determined by the starting position off1 and the buffer size to download. That is, the range of [off1, off1 + Butt] is already buffered data. Note that the positioning accuracy is limited to a maximum of 1 second.
See the attachment for a tool for viewing MP4 file structure information.
If you want to place the moov atom information at the end of the MP4 file at the starting position of the file, you can use QT-faststart to see the attachment.
Usage: New File converted from the QT-faststart source file
In this way, the converted MP4 file can support playing in the form of streaming media over HTTP.

Related Article

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.