[FFmpeg-devel] [PATCH] allow v4l2 to select a frame rate

Michael Niedermayer michaelni
Mon Dec 21 20:53:31 CET 2009


On Mon, Dec 21, 2009 at 04:53:24PM +0100, Luca Abeni wrote:
> Hi,
>
> klchxbec at freenet.de wrote:
>> Hello.
>>  Attached patch fixes the problem with v4l2 where if the user does
>> not specify the frame rate using -r option, it would fail with:
>> Error while opening encoder for output stream #0.0 - maybe incorrect 
>> parameters such as bit_rate, rate, width or height
>> The patch tries to apply the user-specified frame rate. If that does
>> not work, it reads the frame rate from the driver. Tested with a
>> couple of Logitech webcams.
>
> 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
> rate...

it would be annoying if pal/ntsc lacked a properly set framerate.
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.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091221/b27069e3/attachment.pgp>



More information about the ffmpeg-devel mailing list