澳门银河网上官方赌场_老品牌值得信赖

ITKeyword,专注技术干货聚合推荐

注册 | 登录

v4l2 - How to query all devices in ffmpeg?

itPublisher 分享于

2020腾讯云限时秒杀,爆款1核2G云服务器99元/年!(领取2860元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1062

2020阿里云最低价产品入口+领取代金券(老用户3折起),
入口地址https://www.aliyun.com/minisite/goods

How to properly query all video devices in system using libavdevice? opening input with int err = avformat_open_input(&context, NULL, fmt, NULL); fails because device name is not provided (second parameter is device name, if one provides "/dev/video0" for example it finds that device only):

    avcodec_register_all();
    avdevice_register_all();
    AVFormatContext* context = avformat_alloc_context();
    AVInputFormat *fmt = av_find_input_format("video4linux");
    printf("trying to open input");
    int err = avformat_open_input(&context, "/dev/video0", fmt, NULL);
    if(err != 0){
        fprintf(stderr, "ffmpeg failed to open input");
    }
    static struct AVDeviceInfoList* devices_list;
    avdevice_list_devices(context, &devices_list);
    int devices_count = devices_list->nb_devices;
    for(int i = 0; i < devices_count; i++){
        printf("Checking device nr. %d \n", i);
        AVDeviceInfo* current_device_info = devices_list->devices[i];

       printf("Find Device: %s", current_device_info->device_description);
    }

    avformat_free_context(context);

How Can AVFormatContext can be initialized to find all v4l2 devices? I imagine that if context partially initialized (let's say takes all v4l2devices) it should query everything properly. When context run with avformat_open_input one must provide exact device name beforehand.

ffmpeg v4l2
|
  this question
asked Aug 14 '15 at 8:38 IBr 389 1 3 13

 | 

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.


相关阅读排行


相关内容推荐

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱

如果您没有收到激活邮件,请注意检查垃圾箱。

澳门银河网上官方赌场