关于windows下使用qt+ffmpeg打开音频设备报错
来源:5-1 FFmpeg初级开发介绍

refuge
2021-01-08
我是在windows环境下使用qt+ffmpeg做实验,然后在打开音频设备的时候报这种错误:
[dshow @ 1457e340] Could not find audio only device with name [麦克风 (Conexant SmartAudio HD)] among source devices of type audio.
[dshow @ 1457e340] Searching for audio device within video devices for 麦克风 (Conexant SmartAudio HD)
[dshow @ 1457e340] Could not find audio only device with name [麦克风 (Conexant SmartAudio HD)] among source devices of type video.
我的设备名为
qt代码为:
//一.打开设备:1.注册设备,2.设置采集方式;3.打开音频设备
avdevice_register_all();//注册所有的设备
av_register_all();
AVFormatContext *ctx = avformat_alloc_context();
AVDictionary *option = NULL;
AVInputFormat *format = av_find_input_format("dshow");
char *deviceName = QString("audio=麦克风 (Conexant SmartAudio HD)").toLocal8Bit().data();//获取音频设备名称
int ret = avformat_open_input(&ctx,deviceName,format,&option);
if(ret == 0){
qDebug()<<"打开设备成功";
}else if(ret < 0){
qDebug()<<ret<<endl;
char error[1024]={0,};
av_strerror(ret,error,1024);//输出错误信息到error数组
QString str = QString("Fail to open! %1").arg(error);
qDebug()<<str;
}
写回答
1回答
-
李超
2021-01-09
这是音视频系统入门的内容,请到对应的课程群里提问
00
相似问题