From c98bb560edac308b0c4b5527772f8c29e8646964 Mon Sep 17 00:00:00 2001 From: wenchao1024 <87457873+wenchao1024@users.noreply.github.com> Date: Thu, 6 Jan 2022 14:37:02 +0800 Subject: [PATCH] =?UTF-8?q?Create=20FFmpeg=20=E5=AD=A6=E4=B9=A0(=E5=85=AD)?= =?UTF-8?q?=EF=BC=9AFFmpeg=20=E6=A0=B8=E5=BF=83=E6=A8=A1=E5=9D=97=20libavf?= =?UTF-8?q?ormat=20=E4=B8=8E=20libavcodec=20=E5=88=86=E6=9E=90.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...模块 libavformat 与 libavcodec 分析.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 FFmpeg 学习(六):FFmpeg 核心模块 libavformat 与 libavcodec 分析.md diff --git a/FFmpeg 学习(六):FFmpeg 核心模块 libavformat 与 libavcodec 分析.md b/FFmpeg 学习(六):FFmpeg 核心模块 libavformat 与 libavcodec 分析.md new file mode 100644 index 0000000..c0984f5 --- /dev/null +++ b/FFmpeg 学习(六):FFmpeg 核心模块 libavformat 与 libavcodec 分析.md @@ -0,0 +1,18 @@ +# 一、libavformat介绍 + +libavformat的主要组成与层次调用关系如下图: + + ![img](https://images2018.cnblogs.com/blog/682616/201807/682616-20180720175819282-1689330427.png) + +AVFromatContext是API层直接接触到的结构体,它会进行格式的封装和解封装,它的数据部分由底层提供,底层使用了AVIOContext,这个AVIOContext实际上就是为普通的I/O增加了一层Buffer缓冲区,再往底层就是URLContext,也就是达到了协议层,协议层的实现由很多,如rtmp、http、hls、file等,这个就是libavformat的内部封装结构了。 + +# 二、libavcodec介绍 + +libavcodec模块的主要组成和数据结构图如下: + + ![img](https://images2018.cnblogs.com/blog/682616/201807/682616-20180720180926182-1853199081.png) + +对于开发者来说,这个模块我们能接触到的最顶层的数据结构就是AVCodecContext,该结构体包含的就是与实际的编解码有关的部分。 + +首先AVCodecContext是包含在一个AVStream里面的,即描述了这路流的编码格式是什么,然后利用该编码器或者解码器进行AVPacket与AVFrame之间的转换(实际上就是编码或者解码的过程),这是FFmpeg中最重要的一部分。 +