我在iPad mini 4(型号A1538),iOS 11.2.6中运行此代码
尝试通过FFmpeg录制音频。
av_register_all();
avcodec_register_all();
avdevice_register_all();
AVFormatContext *pFormatCtx = avformat_alloc_context();
AVDictionary* options = NULL;
av_dict_set(&options,"list_devices","true",0);
AVInputFormat *iformat = av_find_input_format("avfoundation");
printf("==AVFoundation Device Info===\n");
avformat_open_input(&pFormatCtx,"",iformat,&options);
printf("=============================\n");
if(avformat_open_input(&pFormatCtx,"0",iformat,NULL)!=0){
printf("Couldn't open input stream.\n");
return;
}
pFormatCtx
= NULL
,iformat
= NULL
。
为什么会发生这种情况,我错过了什么设置?
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,&options);
AVFoundation输入设备。 AVFoundation是Apple目前推荐的用于在OSX> = 10.7以及iOS上进行流式处理的框架。输入文件名必须使用以下语法给出:-i“[[VIDEO]:[AUDIO]]”