By ffmpeg tool can be performed directly converting video to gif, but the result is not very good quality. It is best to get video frames and use convert from ImageMagick to create the video later (indicated with -delay the transition time between frames and -loop for an infinite loop):
ffmpeg -i video.mp4 frames%03d.png
convert -delay 5 -loop 0 frames0*.png video.gif
ffmpeg -i video.mp4 frames%03d.png
convert -delay 5 -loop 0 frames0*.png video.gif
Comentarios