mac中使用qt做的开发,这里有个问题想请求帮助,avformat_open_input(); 返回值为-5
***下面是我代码
AVFormatContext *pFormatCtx;
AVCodecContext *pCodecCtx;
AVCodec pCodec;
AVDictionary pOptions = NULL;
//设置编码格式
av_dict_set(&pOptions, "pixel_format", "uyvy422", 0);
//设置分辨率
av_dict_set(&pOptions,"video_size","3264x2448",0);
//设置帧率
av_dict_set(&pOptions,"framerate","30",0);
// 打开摄像头
pFormatCtx = avformat_alloc_context();
AVInputFormat *ifmt = av_find_input_format("avfoundation");
const char* indexs = devId.c_str();
iRet=avformat_open_input(&pFormatCtx,indexs,ifmt,&pOptions);
编译后错误提示*************
[avfoundation @ 0x7fe0a7038000] An error occurred: *** -[AVCaptureDevice_Tundra setActiveVideoMinFrameDuration:] Not supported - Supported ranges: (
"<AVFrameRateRange: 0x600000bc4020 1.00 - 1.00 (1000000 / 1000000 - 1000000 / 1000000)>"
), tried to set maxFrameRate to 30.000031 (1000000 / 30000030)>>>>>>>>>>>>>>avformat_open_input error
我把 av_dict_set(&pOptions,"framerate","30",0);改成 av_dict_set(&pOptions,"framerate","15",0);
编译后错误提示*************
[avfoundation @ 0x7f79fb013200] Selected framerate (15.000000) is not supported by the device
[avfoundation @ 0x7f79fb013200] Supported modes:
[avfoundation @ 0x7f79fb013200] 640x480@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 640x480@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 800x600@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 800x600@[2.500000 20.000000]fps
[avfoundation @ 0x7f79fb013200] 1024x768@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 1024x768@[15.000015 15.000015]fps
[avfoundation @ 0x7f79fb013200] 1280x720@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 1280x720@[10.000000 10.000000]fps
[avfoundation @ 0x7f79fb013200] 1280x960@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 1280x960@[5.000000 5.000000]fps
[avfoundation @ 0x7f79fb013200] 1600x1200@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 1600x1200@[5.000000 5.000000]fps
[avfoundation @ 0x7f79fb013200] 1920x1080@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 1920x1080@[5.000000 5.000000]fps
[avfoundation @ 0x7f79fb013200] 2048x1536@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 2048x1536@[3.750001 3.750001]fps
[avfoundation @ 0x7f79fb013200] 2592x1944@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 2592x1944@[2.500000 2.500000]fps
[avfoundation @ 0x7f79fb013200] 3264x2448@[2.500000 30.000030]fps
[avfoundation @ 0x7f79fb013200] 3264x2448@[1.000000 1.000000]fps
[avfoundation @ 0x7f79fb013200] 3840x2880@[2.500000 10.000000]fps
[avfoundation @ 0x7f79fb013200] 3840x2880@[1.000000 1.000000]fps
avformat_open_input error
我改成av_dict_set(&pOptions,"framerate","1",0);就能出图,但是帧率太低,好卡
编译后提示*************
[avfoundation @ 0x7fdb9105a800] Stream #0: not enough frames to estimate rate; consider increasing probesize
上面的代码要怎么改才能让帧率在15~30,可以avformat_open_input(); 返回值为0,请求解答,谢谢了