ffmpeg: gif to video conversion does not keep gif time delay between frames.
Hi, I am using ffmpeg to convert the attached gif to a video file. My command is: ffmpeg -f gif -i test.gif -pix_fmt yuv420p -c:v libx264 -f mp4 out1.mp4 to simplify the command: ffmpeg -f gif -i test.gif -f mp4 out2.mp4 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. I found a similar ticket from past https://trac.ffmpeg.org/ticket/4235 Appreciate your help. Thanks, E
2017-05-07 18:16 GMT+02:00 Email Me <emailme12121212@gmail.com>:
ffmpeg -f gif -i test.gif -f mp4 out2.mp4
It's hard to tell without seeing the full output from ffmpeg, but there's a distinct possibility you need to specify a framerate for the output using -r.
2017-05-07 18:16 GMT+02:00 Email Me <emailme12121212@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
participants (3)
-
Carl Eugen Hoyos -
Cley Faye -
Email Me