[FFmpeg-devel] [PATCH] allow v4l2 to select a frame rate
Tue Dec 22 10:33:28 CET 2009
Michael Niedermayer wrote:
>> Unfortunately, this patch appears to break capturing from a Logitech
>> QuickCam Communicate STX (which captures MJPEG): if I try
>> ./ffmpeg -r 25 -v 10 -f video4linux2 -s 320x240 -i /dev/video0 test.avi
>> I get
>> [video4linux2 @ 0x9e76390]The V4L2 driver changed the frame rate from
>> 25.000000 to nan
>> and ffmpeg hangs.
>> Without the patch, it works correctly. This is due to VIDIOC_G_PARM
>> returning a (0,0) frame rate.
>> Of course, the issue can be addressed by checking if
>> parm.parm.capture.timeperframe.numerator == 0, but I am wondering
>> if it would be possible to consider the v4l2 input as variable frame
> it would be annoying if pal/ntsc lacked a properly set framerate.
Yes, I agree. I was suggesting using variable frame rate for webcams,
which do not use standards like PAL or NTSC, so the frame rate is
not known in advance.
For PAL and NTSC, the user can set the correct and known frame rate
with "-r", but this can be automated (I seem to remember that "-target"
worked for this some time ago... I do not know the current status).
> if that was done, it would be _reqired_ for libavformat to buffer a second
> or so of video to figure the framerate out.
> What can be done is to set the timebase to something finer and set r_framerate
> and avg_framerate correctly, i dont know though if this would help.
> And of course webcams that are truly var-fps can also be but PAL/NTSC
> capture should not have all variables set to 1000fps.
I fully agree with this.
More information about the ffmpeg-devel