请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

关于windows下使用qt+ffmpeg打开音频设备报错

我是在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;
}

正在回答 回答被采纳积分+3

1回答

李超 2021-01-09 08:53:37

这是音视频系统入门的内容,请到对应的课程群里提问

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号