MPEG4 vol header file format Analysis

Source: Internet
Author: User

 

Recently, a 3GP/MP4 Player uses FFMPEG to extract MPEG4 raw data from the Demux file of 3GP/MP4, which cannot be directly used for decoding. You need to add the vol header before the first frame. I copied the implementation of FFMPEG's encode_vol_header, and many files (especially qvga files) cannot be decoded.

Finally, we learned that this vol does not need to be generated by ourselves. We only need to copy the data in avctx-> extradata_size to the front of your first frame.
Although FFMPEG has a ready-made vol header, I would like to summarize the file format of MPEG4 SP by the way. See section 6.2 of mpeg-4-14496-2. Use ue to open a. m4v file. The 44-byte header. bit stream syntax is as follows:
A) global configuration information, indicating the entire video object group visualobjectsequence () to be decoded by the decoder ()
B) object configuration information, which represents a single video object. Visualobject ().
C) the object Layer configuration information to characterize the videoobjectlayer () of a video object ().
D) es stream data, including the data in the entire Video Object layer.

Related code: mpeg4_encode_visual_object_header and mpeg4_encode_vol_header in FFMPEG/libavcodec/h263.c. There are several points to note.

-Write the VOS and VO headers first. The vos start code is 0x1b0 and the vo start code is 0x1b5.
-Value of profile_and_level_indication. The Simple Profile value is generally 0x3.
-Vol starts with 00 00 01 00 00 0120
-Vol_width and vol_height are consistent with the image size, which can be obtained from = (* formatctx). Streams [videostream]-> codec.
-Zero must be set for less than 8 digits.

 

By the way, we recommend a mp4ui software that can dump audio and video from 3GP and MP4 files, which is very useful. It is also open-source and helpful for analyzing the 3GP format!

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.