Doesn't Not Compute

My log of experiences with GNU/Linux and computers in general.

Tag Archives: Flash sucks

Trying To Deal With Compressed SWF

We all know Flash is a major pain — from Adobe’s own Flash player’s lack of performance to the security problems and nonfree status of said plugin. Not to mention the often-poor compatiblity of the free players, such as Gnash and Swfdec. So I won’t be discussing that right now. Nor will I be discussing the somewhat well-known process of using MPlayer to play Flash video files (.flv).

Today’s note is on dealing with those pesky .SWF Flash animations. While Swfdec-gnome is relatively decent at decoding the few I deal with, I’d like to convert these animations to a video format, such as OGG Vorbis or WebM. Why? Because unlike with Flash videos (.flv files) such as found on YouTube, .SWF files are almost always compressed — and FFMPEG can’t deal with compressed .SWF files. The result being, MPlayer can’t play them.

I really don’t expect it to, anyway — MPlayer is an audio and video player, NOT an animation decoder and player. But I’m very tired of needing a Flash decoder just to watch the animations of MSPA‘s Homestuck adventure comic, when it would be better for people with slower computers and a dislike of nonfree software to serve videos.

So, during a couple breaks from my efforts on Project Permafrost, I’ve been trying to find a way to convert these SWF animations. I’ve had very little luck so far — while there is some software for the job, it’s virtually all for a certain operating system from a company in Redmond, WA, USA. Most of this software works by taking the displayed output from a Flash plugin and converting it to a video — a very CPU-intensive and hacky solution. Video files were created, but they were composed only of empty, black frames with no audio.

Since the only converter I could find for my operating system was useless, I next turned to the tools for creating and modifying the SWF animation itself, and thus to the swftools and flasm packages.

Swftools is a collection of tools for working with Adobe Flash files, as you may have guessed. Flasm is for disassembling and modifying the Flash Actionscript bytecode, and supports SWFs produced by Flash 8 and earlier. Sounds complicated? Yeah, seems that way to me too, and sadly I don’t have time to investigate them deeply right now.

What I did find, by reading the help text for both the swfextract tool (found in the swftools package) and Flasm, was two options that inspired some hope. From swfextract:


Sound extraction:
-m , –mp3 Extract main mp3 stream

And Flasm:


-x Decompress SWF

These suggest three courses of action. In each case, “file.swf” should be replaced with the name of the SWF file you’re working with, of course. 😉

The first is simply copying out the audio directly from the SWF animation.

swfextract -m file.swf

This produces a file named “output.mp3” in the same directory you run the command from.

The second course of action is to decompress the SWF file, so MPlayer can work with it.

flasm -x file.swf

This will, obviously, decompress the SWF file. The original is saved with a “$wf” extension. MPlayer can play the resulting uncompressed SWF file, but (in my case, at least) can only play the audio.

The third option, of course, is to ask the author(s) to release a video format conversion themselves. :mrgreen: They may be hesistant to do so, of course — they may wish for people to HAVE to come to their site to view the animation, instead of someone uploading the video to YouTube or someplace similar. This could be slowed by requiring people to pay for the video, I suppose, but also partially defeats the purpose of the entire endeavor — the goal of which was to be able to easily watch the animation on a computer without needing Flash or putting the CPU under maximum load for the several minutes of the animation.

It’s progress, I guess. If one can call only being able to listen to the animation “progress”. 😦 I’m getting back to work now. 🙂

Advertisements