[Libav-user] list all available formats of webcam
Philippe Gorley
philippe.gorley at savoirfairelinux.com
Wed Apr 17 17:43:33 EEST 2019
On 2019-04-17 9:03 a.m., Hristo Ivanov wrote:
> Hi.
>
> The implementation of
> 'avdevice_capabilities_create'(https://ffmpeg.org/doxygen/trunk/avdevice_8c_source.html#l00143)
> starts with the following lines:
>
> 1 int ret; 2 av_assert0(s && caps); 3 av_assert0(s->iformat ||
> s->oformat); 4 if ((s->oformat &&
> !s->oformat->create_device_capabilities) || 5 (s->iformat &&
> !s->iformat->create_device_capabilities)) 6 return AVERROR(ENOSYS);
>
> My guess is the -40(ENOSYS) error is returned in line 6. Can you check
> in your code if 'm_pFormatCtxInCam->iformat->create_device_capabilities'
> is different from null.
> The next step would be to understand why is
> 'm_pFormatCtxInCam->iformat->create_device_capabilities' null. With
> ffmpeg you just have to dive in the source code and try to understand it.
> Compiling a debug version of the ffmpeg libs/dlls is extremely useful
> for this purpose.
It is null because, while the API exists, it is not implemented. AFAIK,
no device implements it.
Source: I grepped the latest source for avdevice_capabilities_create and
found nothing of interest.
The way to go is to either parse the logs or directly use the DShow/V4L2
libraries.
You can also implement the API yourself and send the patch to the
ffmpeg-devel mailing list. ;)
>
> > Maybe I did not initialize everything correctly or bad ordering of
> open input?
>
>> Please see my code:
>
>
> The code seems correct, my only problem with the above code is in the
> next line:
>
>
> > int ret = avformat_open_input(&m_pFormatCtxInCam, szUrl, m_pInFrmt,
> &m_pInOptions);
>
> Try using no(NULL) options:
>
>
> int ret = avformat_open_input(&m_pFormatCtxInCam, szUrl, m_pInFrmt, NULL);
>
> Maybe opening an input with options shuts down the querying capabilities
> of the input, I don't really know, it's just a guess.
>
>
> Regards.
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
--
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux
More information about the Libav-user
mailing list