[Libav-user] AVERROR_INVALIDDATA in avformat_open_input on Raspberry Pi

Blair Azzopardi blairuk at gmail.com
Tue Feb 4 16:50:54 CET 2014


Hi

I am investigating why opencv on raspberry pi isn't able to connect to the
camera using video4linux and the "/dev/video0" device handle. I've managed
to trace the error to opencv calling avformat_open_input. When this
function is called it returns an AVERROR_INVALIDDATA (0xbebbb1b7) error
code. I have been able to reproduce this using:

#include <libavcodec/avcodec.h> #include <libavformat/avformat.h> #include
<libavformat/avio.h> #include <libavutil/file.h> int main(int argc, char
*argv[]) { AVFormatContext *fmt_ctx = NULL; int ret = 0;
av_log_set_level(AV_LOG_DEBUG); av_register_all(); ret =
avformat_open_input(&fmt_ctx, "/dev/video0", NULL, NULL); if (ret < 0) {
fprintf(stderr, "Could not open input: %08x\n", ret); } return 0; }

I note in the above code sample I am using a null AVFormatContext. This
seems to be what opencv does too. Should this code return an
AVERROR_INVALIDDATA error?
The error appears to occur during av_opt_set_defaults2 function. Another
possibility is that raspberry pi's video4linux driver needs to be
pre-configured initially although I am not sure.

Any help or pointers would be greatly appreciated :)
Thanks
Blair
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140204/e4333e67/attachment.html>


More information about the Libav-user mailing list