关于ffmpeg打开摄像头播放的问题

看了雷神的博客

        avdevice_register_all();
    AVFormatContext *pFormatCtx = avformat_alloc_context();
    AVInputFormat *ifmt=ifmt=av_find_input_format("vfwcap");
    avformat_open_input(&pFormatCtx, 0, ifmt,NULL);

程序运行之后显示

程序输出
最终无法打开摄像头,不清楚是什么原因,网上也没类似答案

没有遇到过,你可以到这里看看雷神的案例:https://blog.csdn.net/leixiaohua1020/article/details/39702113

AVInputFormat* ifmt = ffmpeg.av_find_input_format("dshow");
                //Set own video device's name
                if (ffmpeg.avformat_open_input(&pFormatCtx, "video=Logitech HD Webcam C270", ifmt, null) != 0)
                {
                    Console.WriteLine("Couldn't open input stream.\n");
                    return -1;
                }
                            试一下这么连接。