Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to convert a .mov to a .gif and I'm not having success.

Here's the error:

ffmpeg -pix_fmt rgb24 -i output.gif
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 12 2012 17:47:34 with clang 2.1 (tags/Apple/clang-163.7.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/0.11.1 --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/clang --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-libvo-aacenc --disable-ffplay
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Option pixel_format not found.

If I leave out the -pix_fmt rgb24 part it complains. Thoughts on how to fix?

share|improve this question
FYI, There is an excellent solution for high quality conversions given here. – ryanjdillon Mar 28 '14 at 13:37
up vote 95 down vote accepted

The order of command line arguments matters. This command line should work but will generate a giant file:

ffmpeg -i -pix_fmt rgb24 output.gif

Note that you probably want to reduce the frame rate and size when you convert, as well as specify a start time and duration. You probably do not want to convert the entire file at its original resolution and frame rate.

ffmpeg -ss 00:00:00.000 -i -pix_fmt rgb24 -r 10 -s 320x240 -t 00:00:10.000 output.gif

The file size will still be huge. You may be able to use ImageMagick's GIF optimizer to reduce the size:

convert -layers Optimize output.gif output_optimized.gif
share|improve this answer
Awesome answer, thanks :) GIF is a crazy format... the original .mov was 250k, the converted .gif from ffmpeg was 8mb, and the convert-optimized version was an astounding 10k! Impressive! – TooTallNate Jan 22 '13 at 1:37
ffmpeg complains about the pixel format, and switches from rgb24 to pal8; should the command in the answer be updated? – user1071136 Mar 17 '14 at 20:39
Incompatible pixel format 'rgb24' for codec 'gif' – Andy Jul 18 '14 at 10:15

After converting:

ffmpeg -i input.mp4 input.gif 

Try optimize frames:

convert input.gif -verbose -coalesce -layers OptimizeFrame input_optframe.gif

And use gifsicle to make final optimization:

gifsicle -O2 input_optframe.gif -o optimized.gif

Got 6.8mb GIF from 12.2mb video with almost the same quality!

share|improve this answer
Mind explaining how these steps work and what they are doing? – Raystafarian Nov 5 '14 at 19:31
ffmpeg -y -i input.mp4 -f image2pipe -vcodec ppm - | convert -delay 2 -loop 0 -layers Optimize - gif:- | gifsicle -d 3 -O3 -o optimized.gif

first use ffmpeg to convert mp4 file to images via pipe then use imagemagick to compress it to gif at last optimized it with gifsicle

I don't know why using gifscicle directly won't work.

or you can make the gif smaller by this

convert -dither none -matte -depth 8 -deconstruct -layers optimizePlus -colors 32 in.gif out.gif
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.