[Libav-user] list all available formats of webcam

Hans, Sven Sven.Hans at dermalog.com
Wed Apr 17 16:30:36 EEST 2019

Hi Hristo,

thanks again for your support.

I tried with

avformat_open_input(&m_pFormatCtxInCam, szUrl, m_pInFrmt, nullptr)

which did not solve the issue. Same error as before.

Yes, m_pFormatCtxInCam->iformat->create_device_capabilities is nullptr in my case.

Same is the case for m_pInFrmt->create_device_capabilities.

Actually I tried the same code with

m_pInFrmt = m_pLibAvFormatWrapper->av_find_input_format(“rtsp”); and szUrl being a valid rtsp stream url. Same here.

(the stream opens successfully and I can grab and decode frames etc… all good there)

Probably I am missing some register-call…

In the link you send me for this API the first call is

avformat_alloc_output_context2<https://ffmpeg.org/doxygen/trunk/avformat_8h.html#a0234fa1116af3c0a72edaa08a2ba304f>(&oc, NULL<https://ffmpeg.org/doxygen/trunk/coverity_8c.html#a070d2ce7b6bb7e5c05602aa8c308d0c4>, "opengl", NULL<https://ffmpeg.org/doxygen/trunk/coverity_8c.html#a070d2ce7b6bb7e5c05602aa8c308d0c4>)

I am not doing this, because I am not interested in option-ranges of the output format. But there is no avformat_alloc_input_context-function, right? Or do I need to use avformat_alloc_output_context2 in my case? But then, what would be useful parameters?

Mit freundlichen Grüßen / Best regards

Sven Hans
DERMALOG Identification Systems GmbH
Systems Engineer

Mittelweg 120 | 20148 Hamburg
Fon +49 40 413227 0

Fax +49-40-413227-40

Mail Sven.Hans at dermalog.com<mailto:Sven.Hans at dermalog.com>

Web www.dermalog.com<https://www.dermalog.com>

This e-mail may contain information that is confidential or proprietary to DERMALOG Identification Systems GmbH. Any unauthorized disclosure, distribution or other use is prohibited.

P Please consider the environment before printing this email
From: Libav-user <libav-user-bounces at ffmpeg.org> On Behalf Of Hristo Ivanov
Sent: Mittwoch, 17. April 2019 15:03
To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user at ffmpeg.org>
Subject: Re: [Libav-user] list all available formats of webcam


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.

> 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.



DERMALOG Identification Systems GmbH * Mittelweg 120, 20148 Hamburg, Germany
CEO/Managing Director: Günther Mull * Commercial Register: AG Hamburg HRB 69547
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20190417/0df64f4d/attachment.html>

More information about the Libav-user mailing list