Reference
编译出对应 FFmpeg 源码的 API doc
1、下载 doxygen
2、编译
执行完成后在 ffmpeg-5.0/doc/doxy/html 目录内生成 html 形式的 doc,访问入口是 index.html。
TODO Examples list 缺少:avio_list_dir、extract_mvs、qsvdec、vaapi_encode、vaapi_transcode,这些在 ffmpeg-5.0/doc/examples 可以找到。
3、编译好的 API doc
FFmpeg-5.0 doc
Examples
(前例写过的 API 不会在后例中写)
avio_list_dir
API example program to show how to list files in directory accessed through AVIOContext.
API 示例程序显示如何列出通过 AVIOContext 访问的目录中的文件。
打开输入的路径
|
|
关闭输入的路径
|
|
错误信息转字符串
|
|
打印信息
|
|
读目录内的文件
|
|
释放对文件的引用
|
|
获取文件模式(操作文件的权限)
|
|
获取 User ID 和 Group ID
|
|
打印文件信息
|
|
|
|
avio_reading
API example program to show how to read from a custom buffer accessed through AVIOContext.
API 示例程序显示如何从通过 AVIOContext 访问的自定义缓冲区中读取数据。
映射文件的内容到缓冲区
|
|
取消映射文件的内容到缓冲区
|
|
创建 AVFormatContext
|
|
关闭 AVFormatContext
|
|
创建缓冲区
|
|
释放缓冲区
|
|
创建 AVIOContext
|
|
|
|
|
|
后一个数组向前一个数组复制 n 个数据
|
|
|
|
释放 AVIOContext
|
|
建立 AVFormatContext 对 AVIOContext 的引用
|
|
打开输入的文件
|
|
获取文件的流信息
|
|
打印输入或输出的详细信息
|
|
decode_audio
audio decoding with libavcodec API example
使用 libavcodec API 进行音频解码示例
|
创建 AVPacket
|
|
释放 AVPacket
|
|
获取指定的 AVCodec
|
|
创建并初始化 AVCodecParserContext
|
|
关闭 AVCodecParserContext
|
|
创建 AVCodecContext
|
|
释放 AVCodecContext
|
|
初始化 AVCodecContext
For some codecs, such as msmpeg4 and mpeg4, width and height MUST be initialized there because this information is not available in the bitstream.
对于某些编解码器,例如 msmpeg4 和 mpeg4,必须在此处初始化宽度和高度,因为此信息在比特流中不可用。
|
|
释放 AVCodecContext
|
|
释放 AVCodecContext
|
|
打开文件
|
|
关闭文件
|
|
读文件的内容
|
|
创建 AVFrame
|
|
释放 AVFrame
|
|
解析数据包
|
|
提供原始数据包数据作为解码器的输入
|
|
获取解码器解码后的输出数据
|
|
获取每个样本的字节数
|
|
写数据到文件
|
|
后一个数组向前一个数组复制 n 个数据
|
|
刷新解码器
|
|
检查样本格式是否是平面的
|
|
获取样本格式名称
|
|
获取样本格式的打包
|
|
获取 ffplay 时的参数
|
|
|
|
decode_video
video decoding with libavcodec API example
使用 libavcodec API 进行视频解码示例
And check your input file is encoded by mpeg1video please.
请检查您的输入文件是否由 mpeg1video 编码。
|
创建 AVPacket
|
|
将缓冲区的结尾设置为 0
这可确保损坏的 MPEG 流不会发生过度读取
输出缓冲区中的数据
|
|
刷新解码器
|
|
demuxing_decoding
API example program to show how to read frames from an input file.
This program reads frames from a file, decodes them, and writes decoded video frames to a rawvideo file named video_output_file, and decoded audio frames to a rawaudio file named audio_output_file.
API 示例程序,展示如何从输入文件中读取帧。
该程序从文件中读取帧,对其进行解码,并将解码的视频帧写入名为 video_output_file 的 rawvideo 文件,并将解码的音频帧写入名为 audio_output_file 的 rawaudio 文件。
打开输入的文件
|
|
获取最佳流
|
|
获取指定的 AVCodec
|
|
覆盖 AVCodecContext 对应的参数
|
|
创建图像缓冲区
|
|
循环读数据到 AVPacket,读成功后调用解码函数进行解码
|
|
复制图像
|
|
刷新解码器
|
|
encode_audio
获取指定的 AVCodec
|
|
获取通道数
|
|
创建缓冲区
|
|
确保帧数据可写
确保帧数据是可写的。
在第一轮中,帧是来自 av_frame_get_buffer() 的新帧,因此我们知道它是可写的。
但在接下来的几轮中,encode() 将调用 avcodec_send_frame(),并且编解码器可能在其内部结构中保留了对该帧的引用,这使得该帧不可写。
av_frame_make_writable() 检查并仅在必要时为帧分配新缓冲区。
提供原始视频或音频帧作为编码器的输入
|
|
从编码器返回编码后的输出数据
|
|
刷新编码器
|
|
encode_video
获取指定的 AVCodec
|
|
给参数赋值
|
|
添加序列结束代码,以获得真正的 MPEG 文件
之所以有意义,是因为这个小示例直接写入数据包。这称为“基本流”,仅适用于某些编解码器。
要创建有效的文件,通常需要将数据包写入适当的文件格式或协议; 参见 muxing.c。
extract_mvs
获取边数据
|
|
ffhash
This example is a simple command line application that takes one or more arguments. It demonstrates a typical use of the hashing API with allocation, initialization, updating, and finalizing.
此示例是一个简单的命令行应用程序,它采用一个或多个参数。 它演示了哈希 API 的典型用法,包括分配、初始化、更新和完成。
|
获取支持的 hash 算法
|
|
获取指定的位置
|
|
创建 AVHashContext
|
|
初始化 AVHashContext
|
|
更新 AVHashContext
|
|
释放 AVHashContext
|
|
打开文件
|
|
关闭文件
|
|
获取 hash 算法名
|
|
hash 值转字符串
|
|
filter_audio
This example will generate a sine wave audio, pass it through a simple filter chain, and then compute the MD5 checksum of the output data.
The filter chain it uses is: (input) -> abuffer -> volume -> aformat -> abuffersink -> (output)
abuffer: This provides the endpoint where you can feed the decoded samples.
volume: In this example we hardcode it to 0.90.
aformat: This converts the samples to the samplefreq, channel layout, and sample format required by the audio device.
abuffersink: This provides the endpoint where you can read the samples after they have passed through the filter chain.
这个例子将生成一个正弦波音频,通过一个简单的过滤器链,然后计算输出数据的 MD5 校验和。
它使用的过滤器链是:(input) -> abuffer -> volume -> aformat -> abuffersink -> (output)
abuffer:这提供了您可以提供解码样本的端点。
volume:在本例中,我们将其硬编码为 0.90。
aformat:这会将样本转换为音频设备所需的样本频率、通道布局和样本格式。
abuffersink:这提供了端点,您可以在样本通过过滤器链后读取样本。
|
字符串转 float
|
|
创建 AVMD5
|
|
初始化 AVMD5
|
|
计算 MD5 值
|
|
创建 AVFilterGraph
|
|
释放 AVFilterGraph
|
|
获取指定的 AVFilter
|
|
创建 AVFilterContext
|
|
获取通道布局的描述
|
|
设置 AVFilterContext 的参数
|
|
|
|
初始化 AVFilterContext
|
|
|
|
|
|
转字符串
|
|
释放 AVDictionary
|
|
链接过滤器
|
|
配置图
|
|
将帧发送到 AVFilterGraph 的输入
|
|
获取 AVFilterGraph 的输出
|
|
释放对 AVFrame 的引用
|
|
filtering_audio
API example for audio decoding and filtering
用于音频解码和过滤的 API 示例
|
|
创建 AVFilterInOut
|
|
释放 AVFilterInOut
|
|
获取指定数量频道的默认频道布局
|
|
创建过滤器并添加到图中
|
|
设置 AVFilterInOut 的参数
|
|
|
|
添加图
|
|
将帧添加到缓冲区源
|
|
filtering_video
API example for decoding and filtering
用于解码和过滤的 API 示例
睡眠一段时间
|
|
将视频中的像素点替换成字符,然后从终端输出
|
|
http_multiclient
API example program to serve http to multiple clients.
This example will serve a file without decoding or demuxing it over http.Multiple clients can connect and will receive the same file.
为多个客户端提供 http 服务的 API 示例程序。
此示例将提供一个文件,而无需通过 http 对其进行解码或解复用。多个客户端可以连接并接收相同的文件。
创建并初始化服务端 AVIOContext
|
|
接受并创建客户端 AVIOContext
|
|
刷新 AVIOContext
|
|
关闭 AVIOContext
|
|
|
|
创建进程
|
|
HTTP 握手
|
|
获取指定参数的值
|
|
打开指定的文件
|
|
循环读,并发给客户端,直到读完
|
|
hw_decode
HW-Accelerated decoding example.
This example shows how to do HW-accelerated decoding with output frames from the HW video surfaces.
硬件加速解码示例。
此示例说明如何使用来自硬件视频表面的输出帧进行硬件加速解码。
获取指定的 AVHWDeviceType
|
|
遍历受支持的 AVHWDeviceType
|
|
获取 AVHWDeviceType 的字符串名称
|
|
获取 AVCodec 支持的硬件配置
|
|
打开指定类型的设备,并创建 AVCodecContext
|
|
创建新的引用
|
|
释放引用
|
|
在不同硬件之间复制数据
|
|
获取所需的内存大小
|
|
复制数据到缓冲区
|
|
metadata
example program to demonstrate the use of the libavformat metadata API.
示例程序来演示 libavformat 元数据 API 的使用。
获取 AVDictionaryEntry
|
|
muxing
API example program to output a media file with libavformat.
This program generates a synthetic audio and video stream, encodes and muxes them into a file named output_file.
The output format is automatically guessed according to the file extension.
Raw images can also be output by using ‘%%d’ in the filename.
使用 libavformat 输出媒体文件的 API 示例程序。
该程序生成合成的音频和视频流,将它们编码并复用到一个名为 output_file 的文件中。
根据文件扩展名自动猜测输出格式。
也可以通过在文件名中使用“%%d”来输出原始图像。
|
比较两个字符串的值
|
|
创建输出的 AVFormatContext
|
|
释放 AVFormatContext
|
|
获取 AVCodec 的字符串名称
|
|
创建 AVStream
|
|
复制 AVDictionary
|
|
设置 AVCodecParameters 的值
|
|
创建 SwrContext
|
|
释放 SwrContext
|
|
设置 SwrContext 的参数
|
|
初始化 SwrContext
|
|
创建 AVIOContext
|
|
写文件头
|
|
比较时间戳
|
|
创建 SwsContext
|
|
释放 SwsContext
|
|
缩放
|
|
转换 timebase
|
|
打印 AVPacket 的信息
|
|
写 AVPacket 到文件,并重置 AVPacket
|
|
获取下一个输入样本相对于下一个输出样本将经历的延迟
|
|
使用指定的舍入重新调整 64 位整数
该运算在数学上相当于a * b / c
转换音频
|
|
写文件尾
只能在成功调用 avformat_write_header 后调用。
qsvdec
This example shows how to do QSV-accelerated H.264 decoding with output frames in the GPU video surfaces.
此示例说明如何使用 GPU 视频表面中的输出帧进行 QSV 加速 H.264 解码。
获取指定的 AVCodec
|
|
获取所需的内存
|
|
remuxing
API example program to remux a media file with libavformat and libavcodec.
使用 libavformat 和 libavcodec 重新混合媒体文件的 API 示例程序。
获取所需的内存
|
|
复制 AVCodecParameters
|
|
resampling_audio
API example program to show how to resample an audio stream with libswresample.
This program generates a series of audio frames, resamples them to a specified output format and rate and saves them to an output file named output_file.
API 示例程序,展示如何使用 libswresample 重新采样音频流。
该程序生成一系列音频帧,将它们重新采样为指定的输出格式和速率,并将它们保存到名为 output_file 的输出文件中。
创建缓冲区
|
|
创建缓冲区
|
|
获取所需的内存大小
|
|
scaling_video
API example program to show how to scale an image with libswscale.
This program generates a series of pictures, rescales them to the given output_size and saves them to an output file named output_file.
展示如何使用 libswscale 缩放图像的 API 示例程序。
该程序生成一系列图片,将它们重新缩放到给定的 output_size 并将它们保存到名为 output_file 的输出文件中。
解析出视频的宽高数据
|
|
获取像素格式的短名称
|
|
transcode_aac
Simple audio converter
Convert an input audio file to AAC in an MP4 container using FFmpeg.Formats other than MP4 are supported based on the output file extension.
简单的音频转换器
使用 FFmpeg 将输入音频文件转换为 MP4 容器中的 AAC。根据输出文件扩展名,支持 MP4 以外的格式。
|
获取 AVOutputFormat
|
|
创建 SwrContext 并设置参数
// 为简单起见,假定基于通道数量的默认通道布局(解复用器和/或解码器有时无法正确检测到它们)。
创建 AVAudioFifo
|
|
释放 AVAudioFifo
|
|
获取可用的样本数
|
|
获取所需的内存
|
|
重新创建 AVAudioFifo
|
|
写数据到 AVAudioFifo
|
|
从 AVAudioFifo 读数据
|
|
写数据到文件
|
|
transcoding
API example for demuxing, decoding, filtering, encoding and muxing
用于解复用、解码、过滤、编码和复用的 API 示例
获取 AVRational
|
|
反转 AVRational
|
|
获取所需的内存
|
|
设置 AVFilterContext 的参数
|
|
vaapi_encode
Intel VAAPI-accelerated encoding example.
This example shows how to do VAAPI-accelerated encoding. now only support NV12 raw file, usage like: vaapi_encode 1920 1080 input.yuv output.h264
英特尔 VAAPI 加速编码示例。
这个例子展示了如何进行 VAAPI 加速编码。 现在只支持 NV12 原始文件,用法如:vaapi_encode 1920 1080 input.yuv output.h264
创建 AVHWFramesContext
|
|
初始化 AVHWFramesContext
|
|
创建帧的缓冲区
|
|
vaapi_transcode
Intel VAAPI-accelerated transcoding example.
This example shows how to do VAAPI-accelerated transcoding.
Usage: vaapi_transcode input_stream codec output_stream
e.g: vaapi_transcode input.mp4 h264_vaapi output_h264.mp4
vaapi_transcode input.mp4 vp9_vaapi output_vp9.ivf
The output format is guessed according to the file extension.
英特尔 VAAPI 加速转码示例。
这个例子展示了如何进行 VAAPI 加速的转码。
用法:vaapi_transcode input_stream codec output_stream
例如:vaapi_transcode input.mp4 h264_vaapi output_h264.mp4
vaapi_transcode input.mp4 vp9_vaapi output_vp9.ivf
根据文件扩展名猜测输出格式。