FFmpeg in-depth analysis of 0-Foundation

Source: Internet
Author: User

FFmpeg is a very powerful multimedia codec framework, in-depth analysis of its source code must have basic knowledge of multimedia, otherwise its source code will be very obscure. This article will from the introduction of some basic multimedia only, mainly for the study of FFmpeg source code preparation, such as some coding and decoding part, only really understand the basic process of multimedia processing, studying ffmpeg source code to do more with less.

The following analysis of the most basic and core of multimedia video decoding process, we usually download a movie or a song from the Internet, then the corresponding multimedia player for us to do all the work, we only use to appreciate the OK. At present, almost all the mainstream multimedia players are based on the open-source multimedia framework FFmpeg to do, visible ffmpeg powerful. The following is the main process for decoding a media file:

1. Multiplexing (DEMUX)

when we open a multimedia file, the first step is to re-use it, called Demux. Why do you need this step, what exactly is this step? We know that in a multimedia file, including both audio and video, and audio and video are compressed separately, because the audio and video compression algorithm is not the same, since the compression algorithm is not the same, then certainly the decoding is not the same, so it is necessary to decode the audio and video separately. Although audio and video are compressed separately, the compressed audio and video are bundled together for the convenience of the transfer process. So our first step in decoding is to separate the audio and video streams that are tied together, which is the legendary solution, so in a word, the solution is to separate the audio streams and video streams bundled together in the file to facilitate decoding them separately, following the Demux effect.


2.decoding (Decode)

This step needless to say, a multimedia file must be compressed in some or several formats, that is, commonly referred to as video and audio coding, encoding is to reduce the amount of data, otherwise it is a challenge for our storage device, if it is streaming media network bandwidth is a nearly impossible task. So we have to compress the media information as much as possible.

3.  API function corresponding to decoding process in FFmpeg

Understand the above a media file from open to decoding process, it is easy to read the FFmpeg code, FFMPEG framework is basically follow this process, but not each process corresponding to an API, The following diagram is my analysis ffmpeg and according to my understanding of the FFmpeg decoding process corresponding API, I think this picture should be to understand ffmpeg and codec have some help.


FFmpeg Demux This step is done through the Avformat_open_input () This API, the API reads the header information of the file, and does Demux, after which we can read the audio and video streams in the media file, and then through the Av_read _frame () reads out the basic data stream packet from the audio and video stream, then decodes the packet to Avcodec_decode_video2 () and the corresponding API.


follow-up will be in-depth discussion of ffmpeg code, the knowledge of this article is a foreshadowing!

FFmpeg in-depth analysis of 0-Foundation

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.