title: GIF overlays blink with ffmpeg
body: <p>I've been playing around with ffmpeg over the past months and can't get rid of an issue I'm facing when adding a GIF file as an overlay.</p>
  <p>Basically what I'm trying to achieve is to add a transparent GIF animation as an overlay on top of a MP4 video.</p>
  <p>Please find below an example command that I'm using:</p>
  <pre><code>ffmpeg \
    -i 0689a8a9-43b5-45d2-b0e8-acbea6905ce1.mp4 \
    -ignore_loop 0 \
    -i 02a6e696-969b-4a90-9444-e4b0b4d6f6da.gif \
    -t 10.000000 \
    -filter_complex &quot;[0:v][1:v]overlay=enable='between(t, 1, 3)'[overlay]&quot; \
    -map '[overlay]' \
    -pix_fmt yuv420p \
    output.mp4
  </code></pre>
  <p>For a better understanding, please note that:</p>
  <ul>
  <li><code>-ignore_loop 0</code> allows me to loop the animation as long as the overlay is enabled</li>
  <li><code>-t</code> makes my video last 10s</li>
  <li><code>overlay=enable='between(t, 1.0, 3.0)'</code> sets the interval during which it's visible</li>
  </ul>
  <p>However, when I run this command, a very few milliseconds before the GIF disapears (at 3s), it starts blinking. If I run take a look at it frame by frame, it actually disappears from the video, then comes back, and eventually goes away as expected.</p>
  <p>Please find an example with a black background and a random GIF from giphy <a href="https://streamable.com/llfzzn" rel="noreferrer">at this link</a>. The assets can be found <a href="https://drive.google.com/drive/folders/1OwLBmYyU0_rIvemoUWi1mnhizcHhCFn-?usp=sharing" rel="noreferrer">here</a>.</p>
  <p>I'm probably missing something here. Do you have any hints ?</p>
  <p>I'm running <code>ffmpeg</code> in <code>4.3.1</code>.</p>
  <p>Thank you in advance</p>