In-depth analysis of FFMPEG-basics <Article 1>

Source: Internet
Author: User

FFmpeg is a powerful multimedia codec framework. It must have basic multimedia knowledge before in-depth analysis of its source code. Otherwise, its source code will be very obscure. This article will introduce some basic multimedia content, mainly to prepare for the study of FFMPEG source code, such as some codec parts. Only by truly understanding the basic process of multimedia processing and studying FFMPEG source code can we get twice the result with half the effort.

Next we will analyze the most basic and core video decoding process in multimedia. We usually download a movie or song from the Internet, so the corresponding multimedia player has done everything for us, we only need to appreciate it. Currently, almost all mainstream multimedia players are based on FFMPEG, an open-source multimedia framework. It can be seen that FFmpeg is powerful. The following describes how to decode a media file:

1. Demux)

After opening a multimedia file, the first step is demultiplexing, which is called Demux. Why is this step required? We know that in a multimedia file, both audio and video are included, and both the audio and video are compressed separately, because the audio and video compression algorithms are different, since the compression algorithms are different, the decoding is definitely different, so the audio and video must be decoded separately. Although the audio and video are compressed separately, the compressed audio and video are bundled for transmission for the convenience of the transmission process. Therefore, the first step of decoding is to split the audio and video streams that are bound together, that is, the legendary decoding and multiplexing, this step of de-multiplexing is to split the audio streams and video streams bundled together in the file to facilitate Decoding of them separately. The following is the effect after Demux.

 

2. Decode)

This step is needless to say. A multimedia file must be compressed in one or more formats, that is, video and audio encoding, to reduce the amount of data, otherwise, it is a challenge for our storage devices. If it is streaming media, it is almost impossible to complete the network bandwidth task. Therefore, we must compress the media information as much as possible.

3. the API function corresponding to the decoding process in FFMPEG

After learning about the process from opening to decoding a media file, you can easily read the FFMPEG code. The FFMPEG framework also follows this process, however, not every process corresponds to an API. The following figure shows the API corresponding to the FFMPEG decoding process that I have analyzed and obtained according to my own understanding, I think this figure is helpful for understanding FFMPEG and codec.

 

In FFMPEG, Demux is implemented through the avformat_open_input () API. This API reads the file header information and performs Demux. After that, we can read the audio and video streams in the media file, then, the basic data stream packet is read from the audio and video streams through av_read_frame (), and then sent to avcodec_decode_video2 () and the corresponding API for decoding.


The Code of FFMPEG will be further explored in the future!

In-depth analysis of FFMPEG-basics <Article 1>

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.