FFMPEG write 函数:
ffmpeg write:
int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oformat, const char *format_name, const char *filename);
//add stream
AVCodec *avcodec_find_encoder(enum AVCodecID id);
AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c);
int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
//open video
int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options);
AVFrame *avcodec_alloc_frame(void);
//int avpicture_alloc(AVPicture *picture, enum PixelFormat pix_fmt, int width, int height);
//open out put file
avio_open(AVIOContext **s, const char *url, int flags);
int avformat_write_header(AVFormatContext *s, AVDictionary **options);
//write video
void av_init_packet(AVPacket *pkt);
int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr);
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const;
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);
//write tail
int av_write_trailer(AVFormatContext *s);
//close
int avio_close(AVIOContext *s);
avcodec_close
av_free