[Libav-user] Recent ffmpeg version doesn't support v4l2

Leandro Santiago leandrosansilva at gmail.com
Thu Aug 4 21:01:22 CEST 2011


Hi again. Sorry for the delay.

I changed a bit the file v4l2.c to resolve this problem here.

Libav was using a unitialized variable as device framerate. So the
problem was really random.  And as the function av_parse_video_rate
was returning false, this variable continued with this initial random
value. So I just initialized it before use with 0.

Here's a small one-line patch I applied to revision
82b1516a85ad21b5455dcfef6fe49d1189565c33:

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 468c133..778351f 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -439,7 +439,7 @@ static int v4l2_set_parameters(AVFormatContext
*s1, AVFormatParameters *ap)
     struct v4l2_streamparm streamparm = {0};
     struct v4l2_fract *tpf = &streamparm.parm.capture.timeperframe;
     int i, ret;
-    AVRational framerate_q;
+    AVRational framerate_q = {0,0};

     streamparm.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;


2011/7/4 Stefano Sabatini <stefano.sabatini-lala at poste.it>:
> On date Monday 2011-07-04 11:07:12 -0300, Leandro Santiago encoded:
>> Yes... It's very strange. After trying what you told me, I could open
>> replacing the old code with this, using the new API:
>>
>> /* New API */
>> AVDictionary *dict = NULL;
>> int dictRet = av_dict_set(&dict,"standard","ntsc",0);
>> dictRet = av_dict_set(&dict,"video_size","320x240",0);
>> bRet = avformat_open_input(&pIFormatCtx, sFile, pIFormat,&dict);
>>
>
>> And it worked :-) Why did you replaced informations like video width
>> and height by strings in a dictionary? By the say, thx for your help
>> :-)
>
> Because the idea of AVFormatParameters was busted, in general you need
> to specify special options for the device/de/muxer you're opening, and
> you can't rely on a fixed structure for that.
>
> Anyway, could you show a gdb backtrace of the crash? The old API is
> still supported and a crash there is a bug (but I can't reproduce
> here, also telling the exact version you're using may help).
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>


More information about the Libav-user mailing list