[Libav-user] Querying v4l2 devices

Timur Guseynov s1.sam.1.93 at gmail.com
Sat Sep 17 00:39:32 EEST 2016


Hi. I wrote the code for getting a list of input devices:

 avdevice_register_all();


    AVFormatContext *formatContext = avformat_alloc_context();

    AVInputFormat *inputFormat = NULL;

    while((inputFormat = av_input_video_device_next(inputFormat)))

    {

        formatContext->iformat = inputFormat;


        AVDeviceInfoList *deviceList = NULL;

        avdevice_list_devices(formatContext, &deviceList);


        if(deviceList)

        {

            for(int i = 0; i < deviceList->nb_devices; ++i)

            {

                AVDeviceInfo *device = deviceList->devices[i];

                ..........

            }

        }


       avdevice_free_list_devices(&deviceList);

     }


It fails with SIGSEGV on avdevice_list_devices when it comes to v4l2
input format.


Why does it fail?

How can I get list of video devices?


Btw I'm using Ubuntu 16.04
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160916/7d4cbc47/attachment.html>


More information about the Libav-user mailing list