[FFmpeg-trac] #9455(undetermined:new): Overlay n expression being off 1 frame

FFmpeg trac at avcodec.org
Fri Oct 15 15:03:13 EEST 2021

#9455: Overlay n expression being off 1 frame
             Reporter:  Jozef Chutka  |                     Type:  defect
               Status:  new           |                 Priority:  normal
            Component:  undetermined  |                  Version:  4.3.2
             Keywords:  overlay n     |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  0             |
 Summary of the bug:

 Using ffmpeg 4.4

 It seems to me that when using overlay, the `n` expression is actually 1
 frame off. To prove it, I managed to put together the following demo.

 How to reproduce:
 ffmpeg -filter_complex_script input/filter.txt -ss 1 -frames:v 1
 output/out.png -y






 What I am doing here is, I am animating position of these red/green/blue
 bars in order to center within its growing white container.

 The containers width is `n*10`, bar is 64, so expected formula to center
 would be `(n*10-64)/2` (same as `(W-w)/2`). However, when applied, the
 green bar is not centered.

 I am able to center using `((n-1)*10-64)/2`. This makes me think that the
 `n` expression in overlay is for some reason off by 1.
Ticket URL: <https://trac.ffmpeg.org/ticket/9455>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list