av_dict_set(&optionsDict, "rtsp_transport", "udp", 0);
av_dict_set(&optionsDict, "stimeout", "200000", 0);
av_dict_set(&optionsDict, "fflags", "nobuffer", 0);
if (avformat_open_input(&pFormatCtx, filepath, 0, &optionsDict) != 0) {
printf("Couldn't open input stream.
");
return -1;
}
我最近还发现可以把avformat_find_stream_info()去掉,然后再补充pFormatCtx的参数加上,比如宽高等。