*封装文件逻辑和流程和相应的FFMPEG函数
封装逻辑
AVFormatContext* out_ctx;
先申明封装信息上下文
avformat_alloc_output_context2(&out_ctx,NULL,NULL,out_file);//创建输出文件空间,
根据即将输出的文件名、获取封装信息上下文AVFormatContext
AVStream *st = avformat_new_stream(out_ctx,NULL);
//添加音视频流
avcodec_parameters_copy();
//对st输出文件信息进行设置和复制
avio_open()
//有了输出文件信息就可以打开输出文件
AVPacket* pkt =av_packet_alloc(); //申明编码数据空间格式
AVStream *in_stream, *out_stream; //申明流
avformat_write_header() //写入封装格式头部信息
下面开始循环了
out_stream = out_ctx->streams[out_vidx];
av_rescale_q_rnd()、av_rescale_q //时间戳转换
av_interleaved_write_frame()
//向输出封装文件中写入数据包,如果包含视频、音频等多个码流的数据包,则按照时间戳大小交织写入