一、通用API
1.1 av_register_all()
初始化 libavformat 和注册所有的复用器、解复用器和协议处理器。如果不调用这个函数,可以调用下面的三个函数来选择支持的格式。
- 注册复用器的函数是
av_register_output_format()。 - 注册解复用器的函数是
av_register_input_format()。 - 注册协议处理器的函数是
ffurl_register_protocol()。
注:FFmpeg4.0 以上的版本,这个函数已经被废弃。
1.2 内存的分配和释放(av_malloc()、av_free()等)
av_malloc() 和 av_free() 都是简单的封装了系统函数 malloc() 和free(),并做了一些错误检查工作。同理的还有 av_realloc()。
1.3 avcodec_find_encoder() 和 avcodec_find_decoder()
avcodec_find_encoder() 用于查找 FFmpeg 的编码器,avcodec_find_decoder() 用于查找 FFmpeg 的解码器,声明都位于 libavcodec\avcodec.h。其原型如下:
// 函数的参数是一个编码器的ID,返回查找到的编码器(没有找到就返回NULL)。
AVCodec *avcodec_find_encoder(enum AVCodecID id);
// 函数的参数是一个解码器的ID,返回查找到的解码器(没有找到就返回NULL)。
AVCodec *avcodec_find_decoder(enum AVCodecID id);
1.4 avcodec_open2()
用于初始化一个视音频编解码器的 AVCodecContext,声明位于 libavcodec\utils.c。其原型如下:
int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)

本文详细介绍了FFmpeg的常用API,包括通用API的av_register_all(), avcodec_find_encoder()和avcodec_open2()等,解码API的avformat_open_input()和av_read_frame(),编码API的avformat_alloc_output_context2()和av_write_frame(),以及图像处理API的sws_getContext()和sws_scale()。此外,还提到了日志输出系统av_log()的使用。"
136860959,11374257,自注意力机制详解与TensorFlow实现,"['自然语言处理', '计算机视觉', '深度学习', 'TensorFlow', '神经网络']

1010

被折叠的 条评论
为什么被折叠?



