ffmpeg接口使用流程比较固定:
av_register_all():注册所有模块int ret = avformat_open_input(&ic, ofn, 0, 0);:获取AVFormatContext ic(ofn为输入文件地址)for(i = 0; i < ic->nb_streams; i++):遍历AVFormatContext中所有stream,分别找到Audio与Video对应的AVCodecContext;AVCodec *codec = avcodec_find_decoder(enc->codec_id);:根据AVCodecContext中codec_id获取到AVCodec;avcodec_open2(enc, codec,NULL):打开AVCodec;- 接下来分配AVPacket与AVFrame