[FFmpeg-trac] #3517(avdevice:new): can't set Video4Linux2 framerate

FFmpeg trac at avcodec.org
Tue Apr 1 01:58:25 CEST 2014


#3517: can't set Video4Linux2 framerate
----------------------------------+--------------------------------------
             Reporter:  nunojpg   |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avdevice  |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+--------------------------------------
 ffmpeg version N-61985-gd5c0036
 built on Mar 31 2014 22:09:58 with gcc 4.8 (Ubuntu 4.8.2-17ubuntu2)
 configuration: --enable-libx264 --enable-gpl --enable-libfaac --enable-
 nonfree

 Linux sky5 3.13.0-20-generic #42-Ubuntu SMP Fri Mar 28 09:56:33 UTC 2014
 x86_64 x86_64 x86_64 GNU/Linux

 My webcam supports several framerates at 640x480.

 If I try to grab it using:

 ./ffmpeg -f v4l2 -video_size 640x480 -framerate 5 -i /dev/video1 out1.avi

 The webcam will continue with the 30fps selected (checked with v4l2-ctl
 -all), while ffmpeg will output the correct framerate, by droping every 5
 in 6 frames.

 This is a bug since ffmpeg tries to confirm the v4l2 accepts the selected
 framerate, but then does not select it:

 ./ffmpeg -f v4l2 -video_size 640x480 -framerate 3 -i /dev/video1 out3.avi
 [video4linux2,v4l2 @ 0x32fca40] The driver changed the time per frame from
 1/3 to 1/5

 In this example v4l2 reports that the webcam does not support 3fps, and
 the closest value is 5fps. But 30fps will remain selected!

 Current VLC HEAD does configure v4l2 framerate correctly.

 Also the framerate is being set before the video_size, which introduces
 probably related errors.
 The webcam under test supports hd1080 at 5fps, and hd720 at 10fps.
 According to the following examples, it changes the framerate according to
 the video_size that was previously selected, and not the one that is
 currently being selected!

 ./ffmpeg -f v4l2 -video_size hd720 -framerate 10 -i /dev/video1 out.avi
 (no errors)

 ./ffmpeg -f v4l2 -video_size hd1080 -framerate 10 -i /dev/video1 out.avi
 (no errors)

 ./ffmpeg -f v4l2 -video_size hd1080 -framerate 10 -i /dev/video1 out.avi
 [video4linux2,v4l2 @ 0x1f38a40] The driver changed the time per frame from
 1/10 to 1/5

 ./ffmpeg -f v4l2 -video_size hd720 -framerate 10 -i /dev/video1 out.avi
 [video4linux2,v4l2 @ 0x1d63a40] The driver changed the time per frame from
 1/10 to 1/5

 ./ffmpeg -f v4l2 -video_size hd720 -framerate 10 -i /dev/video1 out.avi
 (no errors)

--
Ticket URL: <https://trac.ffmpeg.org/ticket/3517>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list