Ffmpeg开发手册

来源:互联网 发布:pdf全文翻译软件 编辑:程序博客网 时间:2024/06/05 04:20

FFMPEG之初始化

与FFMPEG初始化和收尾工作相关的函数;

av_register_all()

说明:注册全部的文件格式和编解码器;

函数调用代码示例:

 av_register_all();

备注:暂无;

avcodec_open()

打开所以可以选择的编码器和解码器。

avcodec_close()

av_open_input_file()

av_find_input_format()

av_find_stream_info()

av_close_input_file()

FFMPEG之文件操作

与FFMPEG文件操作相关的函数;说明:从视频流中读取一帧数据;文件中包含视频流和音频流,他们以包的形式存在。

函数调用代码示例

 // FIXME AVFormatContext *pf_format_context; AVPacket f_packet; // // Open video file if ( av_open_input_file(&pm_format_context, f_filename, pm_iformat, 0, pm_format_params) != 0 ){       fprintf(stderr, "av_open_input_file %s\n", strerror(errno));       return false; } // Retrieve stream information if (av_find_stream_info (pm_format_context) < 0){       fprintf(stderr, "av_find_stream_info %s\n", strerror(errno));       return false; } if ( av_read_frame (pm_format_context, &f_packet) < 0 ){       fprintf(stderr, "Can't read frames!"); }

备注:

/**

* Return the next frame of a stream.** The returned packet is valid* until the next av_read_frame() or until av_close_input_file() and* must be freed with av_free_packet. 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 AV_TIME_BASE unit (and guessed if the format cannot* provided 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 if error or end of file.*/

av_write_frame()

dump_format()

FFMPEG之音视频解码器

与FFMPEG音视频处理相关的主要函数;

avcodec_find_decoder()

avcodec_alloc_frame()

avpicture_get_size()

avpicture_fill()

img_convert()

avcodec_alloc_context()

avcodec_decode_audio()

avcodec_decode_video()

av_free_packet()

av_free()

FFMPEG之其他函数参考

其它相关的比较重要的函数;

avpicture_deinterlace()

FFMPEG之重要数据结构参考

列出对重要数据结构的定义,说明;

AVFormatContext

这个结构体会记录有关Format的许多信息,在面向文件格式的时候,这是一个主要的结构体。目前我知道他会包含一些流,音频或视频的流,并且会有一个最数目,人们加入的流不能超过这个数目。

AVFormatParameters

AVCodecContext

AVCodec

AVFrame

AVPacket

AVPicture

AVStream

FFMPEG之其它数据结构参考

其它相关的比较重要的数据结构;

ImgReSampleContext


对ffmpeg库的各函数主要是常用函数的注释和分析


原创粉丝点击