Convert swf files to mp4

I came accross this nice web. There are swf and mp3 files.
I’d like to convert them to mp4 or something, so it is viewable.

I tried gnash and ffmpeg without success.

I’m on Lubuntu 22.04

Asked By: xralf


First of all, I’ll mention some of the paths you shouldn’t take and why nowadays (as long as you’re running a modern distro):

Swivel can convert from swf to images/video, but it relies on Adobe AIR, which is not available on Linux.

Gnash has a dump-gnash command which might work and you might give it a go to export a raw rgb32 30fps video, but it didn’t work on my system. I’ll give you the command anyways:

dump-gnash -1 -D ./out.raw@30

According to this: you might succeed with Gnash as well.

But Gnash is an unfinished, abandoned project and that’s why I’ll show you how to do with a maintained project called Ruffle.

If you’re getting the newest version of the software, you’re gonna have to get the newest version of Rust and its components as well. To install that (at the time of writing) the command is:

curl --proto '=https' --tlsv1.2 -sSf | sh

When I tried installing from the Package Manager I hit a brick wall, the command above gets the latest stable rust distribution.

You might also need to install Java (openJDK worked for me).

Now git clone ruffle master branch using git clone

cd into the ruffle folder:

git clone
cd ruffle/

WARNING: you apparently need a GPU for this so it won’t work on a headless server :/

then run the following command:

cargo run --release --package=exporter -- path/to/file.swf

This will install the required dependencies, start the exporter and then export the slide in high quality (well in terms what quality Flash implemented back in the day… you can also play around with the command line arguments if you’re not happy).

And yes, it will need to compile basically the main components of the project, but at least the end result will be good.

If the process didn’t work you will need to decompress the SWFs used:

tar xvf swftools-0.9.2.tar.gz
cd swftools-0.9.2.tar.gz/

now cd into the src directory where you’ll find the swfcombine binary which you will need for conversion:

swfcombine -d slide1.swf -o slide1dec.swf
rfxswf error: sprite doesn't end(1)
rfxswf error: sprite doesn't end(2)

Yes it will print out errors, but it seems to work.

You will need to go it for every slide, you can use find, xargs or similar to automate it (or maybe a wildcard if it’s supported).

Then you can feed it into Ruffle like shown above.

According to your input (PNG or raw video) you might want to do something like this to combine the audio with the video:

ffmpeg -i /tmp/out.wav 
       -f rawvideo 
       -pix_fmt rgb32 
       -s:v 800x550 
       -r 30 
       -i /tmp/out.raw 
       -c:v libx264 
       -r 30 
       -b 160k 

Let me know if this works for your use case.

P.S. if you wanna do the mp3 merging in one go:

Edit 1:

Please try the following for adding the audio to the image:

ffmpeg -loop 1 -i img.png -i slide1.mp3 -shortest slide1withaudio.mp4
Answered By: Sir Muffington
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.