On date Tuesday 2008-08-05 11:35:48 +0100, Gustavo Felisberto wrote: > Luca Abeni escreveu: > > Hi, > > > > Gustavo Felisberto wrote: > > > >> Using available source code I managed to do a simple video capture program: > >> > >> http://pastebin.com/m5e2840a8 > >> > >> But now I'm trying to use it in a larger project. The thing is when I > >> copy/pasted it to a c++ file I started receiving a "-12" when calling > >> int result = av_open_input_file(&pFormatCtx, "/dev/video0", iformat, 0, > >> &formatParams); > >> > > > > -12 should be ENOMEM, which (I think) does not make too much sense here... > > The only issue I can see is that you risk to pass random data in > > formatParams. Try a memset() to 0 on this variable before using it. > > > > > Sorry for the delay but I've been working with other parts of the > project. If i add the memset I get problems even in the standalone program: > > AVFormatParameters formatParams; > AVInputFormat *iformat; > AVFormatContext *pFormatCtx; > > memset(&formatParams, 0, sizeof(AVFormatParameters)); > > formatParams.channel = 0; > formatParams.standard = NULL; > formatParams.width = 352; > formatParams.height = 288; > > iformat = av_find_input_format("video4linux"); > > if (av_open_input_file(&pFormatCtx, "/dev/video0", iformat, 4096, > &formatParams) != 0) { > fprintf(stderr, "Could not open device"); > return -1; > } > > I start getting a return of -1 and: > [video4linux @ 0x4d170050]Bad capture size (352x288) or wrong time base (0) ^^^^^^^^^^^^^^^^^^^ > Could not open device
Wrong time base, and libav* is way too lazy to tell you explicitly which is the problem (you always have to figure out if the problem is the size *or* the time base). Regards. _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
