ffmpeg相关API(2)

av_find_input_format()

cpp 复制代码
/**
 * 根据输入格式的短名称查找AVInputFormat。
*/
ff_const59 AVInputFormat *av_find_input_format(const char *short_name);

avformat_open_input()

cpp 复制代码
/**
 * 打开一个输入流并读取头。编解码器未打开。 * 必须使用avformat_close_input()关闭流。
 *
 * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context).
 *           May be a pointer to NULL, in which case an AVFormatContext is allocated by this
 *           function and written into ps.
 *           Note that a user-supplied AVFormatContext will be freed on failure.
 * @param url 要打开的流的URL。
 * @param fmt If non-NULL, this parameter forces a specific input format.
 *            Otherwise the format is autodetected.
 * @param options  A dictionary filled with AVFormatContext and demuxer-private options.
 *                 On return this parameter will be destroyed and replaced with a dict containing
 *                 options that were not found. May be NULL.
 *
 * @return 0 on success, a negative AVERROR on failure.
 *
 * @note If you want to use custom IO, preallocate the format context and set its pb field.
 */
int avformat_open_input(AVFormatContext **ps, const char *url, ff_const59 AVInputFormat *fmt, AVDictionary **options);

avformat_close_input()

cpp 复制代码
/**
 关闭打开的输入AVFormatContext。释放它和里面的所有东西 并将 *s设置为NULL。
 */
void avformat_close_input(AVFormatContext **s);

av_read_frame()

cpp 复制代码
/**
 * 返回流的下一帧.
 * This function returns what is stored in the file, and does not validate
 * that what is there are valid frames for the decoder. It will split what is
 * stored in the file into frames and return one for each call. It will not
 * omit invalid data between valid frames so as to give the decoder the maximum
 * information possible for decoding.
 *
 * If pkt->buf is NULL, then the packet is valid until the next
 * av_read_frame() or until avformat_close_input(). Otherwise the packet
 * is valid indefinitely. In both cases the packet must be freed with
 * av_packet_unref when it is no longer needed. For video, the packet contains
 * exactly one frame. For audio, it contains an integer number of frames if each
 * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames
 * have a variable size (e.g. MPEG audio), then it contains one frame.
 *
 * pkt->pts, pkt->dts and pkt->duration are always set to correct
 * values in AVStream.time_base units (and guessed if the format cannot
 * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format
 * has B-frames, so it is better to rely on pkt->dts if you do not
 * decompress the payload.
 *
 * @return 0 if OK, < 0 on error or end of file
 */
int av_read_frame(AVFormatContext *s, AVPacket *pkt);

av_init_packet()

cpp 复制代码
/**
 * 使用默认值初始化数据包的可选字段。.
 *
 * 注意,这并不涉及data和size成员,它们必须分别初始化。
 *
 * @param pkt packet
 */
void av_init_packet(AVPacket *pkt);

av_packet_unref()

cpp 复制代码
/**
 * 把包擦干净。
 *
 * 取消引用数据包所引用的缓冲区,并重置
 * 其余分组字段设置为它们的默认值。
 *
 * @param pkt The packet to be unreferenced.
 */
void av_packet_unref(AVPacket *pkt);

av_packet_alloc()

cpp 复制代码
/* 分配AVPacket并将其字段设置为默认值。  结果
 * 必须使用av_packet_free()释放结构。
 *
 * @return一个AVPacket,在失败时填充默认值或NULL。
 *
 * @注意,这仅分配AVPacket本身,而不是数据缓冲区。那些
 * 必须通过诸如av_new_packet的其它手段来分配。
 */
AVPacket *av_packet_alloc(void);

av_packet_free()

cpp 复制代码
/**
   释放数据包,如果数据包被引用计数,它将
 * 未引用第一。
 *
 * @param要释放的pkt包。指针将被设置为NULL。
 * @note传递NULL是一个空操作。
 */
void av_packet_free(AVPacket **pkt);
相关推荐
Evonso1 天前
静态编译的ffmpeg用法
ffmpeg
_chirs2 天前
编译不依赖动态库的FFMPEG(麒麟国防 V10)
arm开发·ffmpeg
熊猫钓鱼>_>3 天前
从零到一:打造“抗造” Electron 录屏神器的故事
前端·javascript·ffmpeg·electron·node·录屏·record
UpYoung!3 天前
【格式转换工具】专业级多媒体格式转换解决方案——Freemake Video Converter 完全指南:轻量化视频剪辑媒体格式转换
ffmpeg·短视频·实用工具·开源工具·多媒体格式转换·运维必备·视频转换格式
试剂小课堂 Pro4 天前
Ald-PEG-Ald:丙醛与聚乙二醇两端连接的对称分子
java·c语言·c++·python·ffmpeg
MaoSource4 天前
Debian 12 安装 FFmpeg 命令
服务器·ffmpeg·debian
白云千载尽5 天前
交换空间扩容与删除、hugginface更换默认目录、ffmpeg视频处理、清理空间
python·ffmpeg·控制·mpc·navsim
xmRao5 天前
Qt+FFmpeg 实现 PCM 转 WAV
qt·ffmpeg·pcm
eWidget5 天前
Shell循环进阶:break/continue,循环嵌套与优化技巧
运维·开发语言·ffmpeg·运维开发
Knight_AL5 天前
Java + FFmpeg 实现视频分片合并(生成 list.txt 自动合并)
java·ffmpeg·音视频