1.检查文件路径是否正确
2.命令行中试试ffmpeg -i filaename E:\image%d.jpg 如果可行,说明你的ffmpeg库没问题
3、若不行,试试我下面的方法:(强制指定输入视频的格式)
//原来的代码int errocode=avformat_open_input(&pFormatCtx,filepath,NULL,NULL);
//修改后的代码
//添加这句话AVInputFormat* iformat=av_find_input_format("h264");(因为我的视频时H.264压缩的,这句话为强制指定视频的输入格式。估计我的视频压缩不标准或是其他什么原因导致了pFormatCtx无法获取正确的AVInputFormat)
int errocode=avformat_open_input(&pFormatCtx,filepath,iformat,NULL);