Animated GIF as an overlay in FFMPEG?

4

2

I have an animated gif that I wanted to loop in the bottom corner of a video, unfortunately when added as an overlay in ffmpeg it does not loop and only shows the first 'frame'. Is there a way of achieving this?

x1886x

Posted 2012-09-10T23:53:39.637

Reputation: 141

This question is related to overlaying animated image over image may help you at some extent.

– Mayura – 2012-09-11T00:34:47.153

Answers

2

try this :

ffmpeg -i test.mp4 -ignore_loop 0 -i loop.gif -filter_complex "[0][1]overlay=0:H-100" output.mp4

Ahmad Ali Mukashaty

Posted 2012-09-10T23:53:39.637

Reputation: 31

3

The best answers teach WHY they work. Could you add a couple of sentences to explain the command? Thanks. from review

– fixer1234 – 2016-12-07T17:47:40.367

While this snippet may address the question, including an explanation of how and why this solves the problem would really help to improve the quality of your post. Remember that you are answering the question for readers in the future, not just the person asking now! Please [edit] your answer to add explanation, and give an indication of what limitations and assumptions apply.

– Toby Speight – 2016-12-07T18:40:14.650

Two caveats: with the given option, -ignore_loop 0 the GIF will loop as per the value embedded in it. If it's 4, then it will loop 4 times. And, the overlay filter should have shortest=1 added, else with an infinite loop, the overlay will never terminate. – Gyan – 2016-12-07T18:45:05.323

I got this error, any tips? Too many packets buffered for output stream 0:1. [aac @ 0x7fb358015200] Qavg: 732.219 [aac @ 0x7fb358015200] 2 frames left in the queue on closing Conversion failed! – freedrull – 2018-08-06T13:50:41.637