inputContext = avformat_alloc_context();
AVDictionary* options = NULL;
av_dict_set(&options, "video_size","960x54", 0);
av_dict_set(&options, "r","30", 0);
AVInputFormat *iformat = av_find_input_format("avfoundation");
int ret = avformat_open_input(&inputContext,"0:0", iformat,nullptr);
需要注意的是 :
int ret = avformat_open_input(&inputContext,"0:0", iformat,nullptr);
中的 “0:0” 视频设备索引:音频设备索引