avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;postproc.lib;swresample.lib;swscale.lib
FFmpeg日志系统
include<libavutil/log/h>
av_log_set_level(AV_LOG_DEBUG)
av_log(NULL,AV_LOG_INFO,"...%s\n",op)
日志级别
AV_LOG_ERROR
AV_LOG_WAWRING
AV_LOG_INFO
AV_LOG_DEBUG
打印音视频信息
AVFormatContext* fcontext = nullptr;
avformat_open_input(&fcontext, "test.mp4", nullptr, nullptr);
av_dump_format(fcontext, 0, "test.mp4", 0);//第四个0表示输入文件,1表示输出文件
avformat_close_input(&fcontext);
一个AVFormatContext包含多个AVStream,每个码流包含了AVCodec和AVCodecContext,AVPicture是AVFrame的一个子集,
他们都是数据流在编解过程中用来保存数据缓存的对像,从数据流读出的数据首先是保存在AVPacket里,也可以理解为一个AVPacket最多只包含一个AVFrame,
而一个AVFrame可能包含好几个AVPacket,AVPacket是种数据流分包的概念。
*********************重要***********************
在使用ffmpeg库时引用dll请全部引入
ffmpeg库之间的调用关系复杂,dll之间涉及到互相调用,请勿只配置代码中使用到的库
*********************重要***********************
关于直播流 avformat_open_input 导致的点播时延大
/通过AVDictionary来改变AVFormatContext结构体里参数
AVDictionary* avdic = NULL;
av_dict_set(&avdic, "probesize", "2048", 0);
av_dict_set(&avdic, "max_analyze_duration", "10", 0);
if(avformat_open_input(&pFormatCtx,url,NULL, &avdic)!=0){
printf("Couldn't open input stream.\n");
return -1;
}
AVFrame->linesize
0:Y 0:左声道 0:RGBRGBRGB
1:U 1:右声道
2:V