The backticks ( `) around the seq command cause its output to be included as parameters in the gifsicle command line. The height is set to -1 to keep the aspect ratio and will be set automatically. scale resizes the video where the first parameter is the width and the second one is the height. The -f "#%g" makes it print a # before each number, which makes gifsicle understand it as a frame selection instead of a file name. fps specifies the frame rate of the output GIF. The seq command just outputs a sequence of numbers from 0 to 99, counting up in steps of 2. With JohnB's sample animation, it shrinks the output size down by 27%. (If your input animation is already unoptimized, gifsicle may print a warning about it, but this is also completely harmless.)Ĭonversely, the -O2 switch re-optimizes the output animation to minimize the file size. but really, there are many ways to make gifs. You really want to do this before doing pretty much anything with animations, otherwise you're likely to get messy results. extracting frames from the video stitching those frames together. The -U switch will merge frames in the input animation with the preceding ones, so that each frames stands alone and doesn't depend in any others. Firstly copy captured-original animated gif into input.gif file then start command interpreter and type : gifsicle input.gif -I '-1' >input.txt look into input.txt and see what is the length of animation - how many frames it contains. (It's OK to use a larger number, but gifsicle will complain about it.) Replace input.gif and output.gif with the input and output file names, and 99 with the number of frames in your animation. This command should work in most Unix shells I've tested it in bash. The input gif has variable frame delays: Frame 1 - no delay.
#Ffmpeg gif to frames mp4
Here's a simpler solution using gifsicle than JohnB's script: gifsicle -U input.gif `seq -f "#%g" 0 2 99` -O2 -o output.gif ffmpeg -f gif -i test.gif -f mp4 out2.mp4.