Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg GIF to WebM decoding issue

Tags:

ffmpeg

gif

webm

I'm trying to convert GIF files into WebM (ffmpeg, libvpx) and getting some strange ffmpeg behaviour.

ffmpeg is installed on my mac from MacPorts.

Converting with:

ffmpeg -i srcFilename.gif -b:v 600K -qmin 0 -qmax 50 -crf 5 destFilename.webm

if my GIF file has some frame(s) with 1-2s duration somewhere in the middle of animation like this, conversion result is fine - it's playing with the "pause" in the middle.

But if I have GIF like this with "pause" in the last frame, ffmpeg decodes it without a delay.

Have no idea why, spent some time reading ffmpeg manual, trying different conversion options with no success.

Any ideas? Thanks in advance!

like image 734
Anton Sergeev Avatar asked Feb 15 '26 07:02

Anton Sergeev


1 Answers

I wrote an email to GIF decoder author and he answered me that he knows about this issue. It's located somewhere deep inside of ffmpeg and he has no idea how to fix it right now.

So, I'm using "dirty hack" in my project - just adding copy of last frame with zero delay to GIF file before encoding.

like image 199
Anton Sergeev Avatar answered Feb 17 '26 22:02

Anton Sergeev