http://www.ffmpeg.com.cn/index.php/Output_example.c ffmpeg项目中很典型的一个例程
http://www.rosoo.net/a/201110/15191.html 音视频文件码率与大小计算
http://blog.csdn.net/derryzhang/article/details/5133083 视频知识基础:什么是TS、PS流?
API分为4个部分Initialization,Decode,Image scaling,Video rendering。
Initialization:
avcodec_register_all
avcodec_find_encoder
avcodec_alloc_context
avcodec_alloc_frame
SDL_SetVideoMode
Decode:
avcodec_decode_video
Image scaling:
sws_getContext
sws_scale
Video rendering:
SDL_CreateYUVOverlay
API的具体说明。
FFmpeg API | 描述 |
av_register_all() | Initializes libavformat and registers all the muxers, demuxers and protocols. 初始化libavformat和注册所有的混合器,分路和协议。 |
avcodec_find_decoder(…) | Finds a decoder with a matching codec ID. 找到一个可以匹配的编解码器ID的解码器。 |
avcodec_alloc_context() | Allocates an AVCodecContext and sets its fields to default values.
分配一个AVCodecContext,并设置其字段的默认值。
|
avcodec_alloc_frame() | Allocates an AVFrame and sets its fields to default values. 分配一个AVFrame,并设置其字段的默认值。 |
sws_getContext(…) | Returns an SwsContext to be used in sws_scale(). 返回在sws_scale()使用的SwsContext。 |
sws_scale(…) | Scales the data in source according to our settings in our SwsContext c. srcStride and dstStride are the source and destination linesize. |
avcodec_decode_video(…) | Decodes a video frame from buffer into picture.
|
av_register_all();
av_alloc_format_context()-------av_free()-----------生成或释放一个AVFormatContext结构体
url_fopen()-------url_fclose()------------打开或关闭一个输出文件