Advertisement

ffmpeg编码视频分析与研究

阅读量:

上一篇文章总结了ffmpeg解码,本文继续总结一下编码。

一:编码流程:

编码流程图

ffmpeg函数:
avformat_alloc_output_context2():初始化输出码流的AVFormatContext。
avio_open():打开输出文件。
av_new_stream():创建输出码流的AVStream。
avcodec_find_encoder():查找编码器。
avcodec_open2():打开编解码器。
avformat_write_header():生成文件头信息。
avcodec_send_frame() + avcodec_receive_packet():编码视频帧(即将AVFrame转换为AVPacket)。因为ffmpeg版本更新的原因(主要由于 ffmpeg 版本更新),雷神团队使用了 avcodec_encode_video2() 函数进行替换操作。
av_write_frame():将编码后的视频码流写入文件中。
flush_encoder():当输入像素数据处理完毕时调用该函数(用于输出编码器中剩余的 AV

全部评论 (0)

还没有任何评论哟~