[FFmpeg-trac] #3329(avfilter:open): fps filter bug

FFmpeg trac at avcodec.org
Mon Jan 20 11:38:01 CET 2014

#3329: fps filter bug
             Reporter:  Krieger     |                    Owner:
                 Type:  defect      |                   Status:  open
             Priority:  normal      |                Component:  avfilter
              Version:  git-master  |               Resolution:
             Keywords:  fps         |               Blocked By:
             Blocking:              |  Reproduced by developer:  1
Analyzed by developer:  1           |
Changes (by Cigaes):

 * analyzed:  0 => 1


 The timestamp logic in {{{vf_fps}}} is wrong. The major culprit is this

     /* number of output frames */
     delta = av_rescale_q_rnd(buf->pts - s->pts, inlink->time_base,
                              outlink->time_base, s->rounding);

 As you can see, it means: number of frames to output = (time of next
 frame) - (time of current frame) rescaled to output frame rate. In this
 particular case (2 FPS -> 25 FPS, it is 12.5, rounded to 13. Rounded to 13
 every time. That means a 0.5/25 error for every input frame.

 The in this case fix would be to convert all timestamps to the output time
 base immediately, but it must be tested also when decreasing the frame
 rate and other corner cases.

 As a temporary workaround, I suggest: {{{-vf fps=50,framestep=2}}}: 2→50
 is exact, and framestep is easy.

Ticket URL: <https://trac.ffmpeg.org/ticket/3329#comment:2>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list