A Preliminary Study on FLAC format

Source: Internet
Author: User

Because I have been watching the Ogg format and Ogg also contains FLAC audio, I have watched the FLAC audio format over the past few days. The detailed parsing of this format is done at http://developer.sourceforge.net/format.html#residual, which is very detailed.

Stream format of FLAC:"FLAC" identifier, four bytes

Metadata_block +

Frame +

Determine whether the audio type of a file is in FLAC format. It starts from the first four bytes of 'F' 'l' a 'C' and then multiple metadata_blocks, each metadata_block identifies the block type in the header. The types include:

Metadata_block_streaminfo
Metadata_block_padding
Metadata_block_application
Metadata_block_seektable
Metadata_block_vorbis_comment
Metadata_block_cuesheet
Metadata_block_picture

Generally, important parameters are included in metadata block_streaminfo to obtain BPS, channel, and sample rate. This helps us to get the total duration of the audio stream.

The frame format of FLAC is as follows:Frame_header

Subframe + (each channel has a sumberframe)

Frame_footer

It should be emphasized that each frame has a synchronization code of 11 1111 1111 1110. The size of the frame header is also uncertain, and there are many information parameters contained in the header, it is helpful for parsing the FLAC format. The length of each frame is also uncertain. It needs to be calculated based on different situations. I will not explain it in detail here. The official website is very detailed and I think it is clearer than my explanation.

FLAC subframe format:

In the subframe_header header, specify the type of this subframe.

Subframe_constant
| Subframe_fixed
| Subframe_lpc
| Subframe_verbatim

 

If you don't understand it, you can go to the official website or discuss it with me ~

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.