1# Introduction to AVCodec Kit 2Audio and Video Codec (AVCodec) Kit provides capabilities such as audio and video codec, media file muxing and demuxing, and media data input. 3For performance reasons, AVCodec Kit provides only C APIs. 4 5## Capability Scope 6- Media data input: Media applications can pass in the FD of a file or the URL of a stream for subsequent processing such as media information parsing. 7- Media foundation: provides common basic types for media data processing, including [AVBuffer](../../reference/apis-avcodec-kit/native__avbuffer_8h.md) and [AVFormat](../../reference/apis-avcodec-kit/native__avformat_8h.md). 8- Audio encoding: Audio applications (such as audio calling and audio recording applications) can send uncompressed audio data to the audio encoder for encoding. The applications can set parameters such as the encoding format, bit rate, and sampling rate to obtain compressed audio files in desired formats. 9- Video encoding: Video applications (such as video calling and video recording applications) can send uncompressed video data to the video encoder for encoding. The applications can set parameters such as the encoding format, bit rate, and frame rate to obtain compressed video files in desired formats. 10- Audio decoding: Audio applications (such as audio calling application and audio player) can send audio streams to the audio decoder for decoding. The decoded data can be sent to audio devices for playback. 11- Video decoding: Video applications (such as video calling application and video player) can send video streams to the video decoder for decoding. The decoded image data can be sent to display devices for display. 12- Media file demuxing: Media applications (such as audio and video players) can parse media files stored locally or received from the Internet to obtain audio and video streams, presentation time, encoding formats, and basic file attributes. 13- Media file muxing: Media applications (such as audio and video recording application) can mux stream data encoded by the encoder into media files (in MP4 or M4A format), and write the audio and video streams, presentation time, encoding format, and basic file attributes into the specified file in a certain format. 14 15## Highlights 16- Zero copy of internal data: During video decoding, the AVCodec provides an AVBuffer through a callback function. The application writes the sample data to be decoded to the AVBuffer. In this way, data in the AVCodec is directly sent to the decoder, rather than being copied from the memory. 17 18- Hardware acceleration for video codecs: H.264, H.265, and H.265 10-bit hardware codecs are supported. 19 20## Basic Concepts 21- Media file: file that carries media data such as audio, video, and subtitles. Examples are .mp4 and .m4a files. 22- Streaming media: media transmission mode that supports simultaneous download and playback. The supported download protocols include HTTP/HTTPS and HLS. 23- Audio and video encoding: process of converting uncompressed audio and video data into another format, such as H.264 and AAC. 24- Audio and video decoding: process of converting a data format into an uncompressed original sequence of audio or video data, such as YUV and PCM. 25- Media file muxing: process of writing media data (such as audio, video, and subtitles) and description information to a file in a given format, for example, .mp4. 26- Media file demuxing: process of reading media data (such as audio, video, and subtitles) from a file and parsing the description information. 27- sample: a group of data with the same timing attributes. 28 29 In the case of audio and video, a sample typically means compressed data that has the same decoding timestamp. 30 31 In the case of subtitles, it generally includes the content that is meant to be displayed at certain time points. 32 33 At the end of all tracks, the sample is considered to be empty. 34 35## Usage 36- Video codec 37 38 The input of video encoding and the output of video decoding are in surface mode. 39 40 During encoding and decoding, an application is notified of the data processing status through a callback function. For example, during encoding, the application is notified once a frame is encoded and an AVBuffer is output. During decoding, the application is notified once a frame of stream arrives at the decoder. When the decoding is complete, the application is also notified and can perform subsequent processing on the data. 41 42 The following figure shows the video encoding and decoding logic. 43 44  45 46 For details about the development guide, see [Video Decoding in Surface Output](video-decoding.md#surface-output) and [Video Encoding in Surface Input](video-encoding.md#surface-input). 47 48- Audio codec 49 50 The input of audio encoding and the output of audio decoding are in PCM format. 51 52 During encoding and decoding, an application is notified of the data processing status through a callback function. For example, during encoding, the application is notified once a frame is encoded and an AVBuffer is output. During decoding, the application is notified once a frame of stream arrives at the decoder. When the decoding is complete, the application is also notified and can perform subsequent processing on the data. 53 54 The following figure shows the audio encoding and decoding logic. 55 56  57 58 For details about the development guide, see [Audio Decoding](audio-decoding.md) and [Audio Encoding](audio-encoding.md). 59 60 61- File muxing and demuxing 62 63 During file muxing, an application sends an AVBuffer to the corresponding codec interface for muxing. The AVBuffer can be that output in the preceding encoding process or an AVBuffer created by the application. The AVBuffer must carry valid stream data and related time description. 64 During file demuxing, the application obtains the AVBuffer that carries stream data from the corresponding codec interface. The AVBuffer can be sent to the decoder for decoding. 65 66 The following figure shows the file muxing and demuxing logic. 67 68  69 70 For details about the development guide, see [Media Data Demuxing](audio-video-demuxer.md) and [Media Data Muxing](audio-video-muxer.md). 71