使用ffmpeg,函数av_find_input_format(“avfoundation”)返回null

问题描述 投票:0回答:1

我在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 = NULLiformat = NULL

为什么会发生这种情况,我错过了什么设置?

ios ffmpeg record
1个回答
1
投票
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]]”

© www.soinside.com 2019 - 2024. All rights reserved.