I'm running Kubuntu. I don't want to install any Windows applications in wine. I would like a (relatively simple) command to convert a flash animation (.SWF file) to an animated GIF.

The input .SWF file is only 14.5 KiB and I want to convert the entire thing at best quality. I'm hoping the GIF will be of similar size.

Here's the info on the ffmpeg I have installed:

ffmpeg version 0.10.12-7:0.10.12-1~precise1 Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 26 2014 09:49:36 with gcc 4.6.3
configuration: --arch=amd64 --disable-stripping --enable-pthreads --enable-runtime-cpudetect --extra-version='7:0.10.12-1~precise1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
libavutil      51. 35.100 / 51. 35.100
libavcodec     53. 61.100 / 53. 61.100
libavformat    53. 32.100 / 53. 32.100
libavdevice    53.  4.100 / 53.  4.100
libavfilter     2. 61.100 /  2. 61.100
libswscale      2.  1.100 /  2.  1.100
libswresample   0.  6.100 /  0.  6.100
libpostproc    52.  0.100 / 52.  0.100

You don't mention in your post if you've tried the most basic command that should accomplish this:

ffmpeg -i input.swf output.gif

Assuming that works there are going to be quality problems with it, because GIF is a 256-color format. (Imgur recently extended the file format for GIFV which uses WebM video, but that's a separate topic)

If that didn't work, it's because you don't have a SWF decoder or a GIF encoder. You can run this command to see what codecs/formats are supported by your version of FFMpeg:

ffmpeg -formats

The output of that is pretty verbose (it will list everything) and you can use grep to cut it down for you:

ffmpeg -formats | grep -i GIF
ffmpeg -formats | grep -i SWF

For me I get this:

 DE gif             GIF Animation
  E avm2            SWF (ShockWave Flash) (AVM2)
 DE swf             SWF (ShockWave Flash)

This shows that my version of FFMpeg supports decoding and encoding GIF and SWF.

You may also want to test converting it to an AVI before converting it to GIF, to see the quality before any GIF problems:

ffmpeg -i input.swf -sameq output.avi

It may get mad about trying to use the -sameq flag because SWF doesn't have a "quality". You could also try -b:v 900k to set the video bitrate to pretty high.


The source you linked to can easily be compiled on any Linux system that has GCC and the "zlib" library (almost everything has that) Here is how I compiled it:

sudo apt-get install build-essential zlib-dev
wget -o main.c "http://svn.perian.org/ffmpeg/tools/cws2fws.c"
gcc main.c -lz

You can now run the tool to convert like this:

./a.out input.swf decompressed.swf


  • Thanks. Very helpful. My error is [swf @ 0x207f6c0] Compressed SWF format not supported. It looks like I need cws2fws but it doesn't appear to be available in the Ubuntu 12.04 repos.
    – MountainX
    Apr 11 '15 at 22:23
  • You're welcome to send me the SWF and I can give it a shot (kristopher.ives@gmail.com) I'll also have a go at compiling this source and see how hard it is: svn.perian.org/ffmpeg/tools/cws2fws.c Apr 12 '15 at 22:36
  • I updated my answer with some information on how to compile that decompressor. Apr 12 '15 at 22:39
  • Thank you again. I did manage to uncompress the SWF file, but then ffmpeg gave another error (could not find codec parameters). I'm going to take you up on your offer to give it a go. We'll send you the SWF file. Thanks!
    – MountainX
    Apr 13 '15 at 7:15

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .