[FFmpeg-user] ffmpeg: gif to video conversion does not keep gif time delay between frames.

Carl Eugen Hoyos ceffmpeg at gmail.com
Wed May 10 11:09:17 EEST 2017

2017-05-07 18:16 GMT+02:00 Email Me <emailme12121212 at gmail.com>:

> ffmpeg -f gif -i test.gif -pix_fmt yuv420p -c:v libx264 -f mp4 out1.mp4

> ffmpeg -f gif -i test.gif -f mp4 out2.mp4

Complete, uncut console output missing.

> The input gif has variable frame delays:
> Frame 1 - no delay
> Frame 2 - 1 sec
> Frame 3 - 2 sec
> Frame 4 - 4 sec
> The generated video file does not maintain these time delay
> between the frames.

It is impossible to show the first frame for "no" time, and this
has an effect on the following frames.

Only constant frame rate mp4 output files are supported by libavformat,
since you didn't provide an output frame rate, FFmpeg tries to
guess one which is not easy for a gif file: It guesses -r 1 because
this is the granularity of the given gif file. Choose a higher frame rate
like -r 10 or -r 25 to show the first frame for a shorter amount of time.
Output frame rates lower than -r 6 will trigger timestamp issues,
the fps filter avoids them but fails outputting the last frame.

Carl Eugen

More information about the ffmpeg-user mailing list