Convert Jing SWF Files to MP4

Jing is a free program from TechSmith for creating short screen-share videos with audio. It works great BUT it only outputs SWF files. SWF files require that Adobe Flash be installed on machine where you want to play them. Because it is a constant source of security problems, and because there are good options now to play MPEG4 (MP4) files without Flash, Flash is dying out. So how can you convert your old Jing files to MP4 so they can play without Flash?

The answer turns out to be difficult to research but not that difficult to implement once you know what to do.

Research

The research difficulty comes from old/inaccurate information on the TechSmith forum, and from the huge number of spam posts on that forum and others offering programs that supposedly do the conversion but either fail to do it and/or are crippled until you pay for the program.

One piece of bad advice in 2011 from Daniel Foster, the TechSmith Snagit strategy lead, is to use the trial version of Camtasia to convert to MP4. If you go all the way through the conversion, the trial output will contain a watermark. When importing the SWF, Camtasia actually saves an AVI file without a watermark, which might be useful as an intermediate file. But Camtasia license terms section 2.71 specifically says that the trial version is “not for production purposes.” Skip Camtasia.

That thread has frequent reference to the VIP Video Converter. I installed the trial version. The conversion works by playing the video in a window and supposedly capturing in a different format. Except that the output folder was always empty—it never created an output file. I contacted support; they asked for a sample video which I sent; I never heard back. Skip VIP Video Converter. [Update September 11, 2017:  I got a reply two months later with deep apologies for a technical glitch that caused some tech supports incidents to vanish.]

Other sites reference Handbrake. This is a legitimate, free, open-source program. Unfortunately, Handbrake cannot open Jing SWF files. Handbrake can convert AVI to MP4, but we’ll use another program for that. Skip Handbrake.

One article or post suggested that Handbrake needed VLC media player. VLC is another good, free program, but Handbrake doesn’t need it. Skip VLC unless you want to use it for testing video output. (I found that output files would sometimes play in one player but not in others. My goal was to get output that would play in any player.)

Some Answers

This answer on the Apple StackExchange forum contains an important clue:  “Because the video is buried inside a full SWF file you won’t be able to convert it…. Instead you’ll need to extract the video.” Aha! So SWF is just a container. The extraction programs mentioned there are Mac-based, but now I know I’m looking for an SWF extractor/decompiler.

For SWF decompilation, I finally found the JPEXS Free Flash Decompiler (“FFdec”) (moved January 2018 from https://www.free-decompiler.com/flash/ to Github). At first, this looked suspicious, and I was concerned that the installer is not code-signed, but it does seem to work and my anti-virus did not complain. Note that FFdec requires the Java Runtime Environment; if you don’t have it already it will be downloaded and installed.

The other half of the solution is a free, open-source command-line media transcoder called FFmpeg. Downloads start here; getting a Windows build took me to this page. I went for a released version (not a nightly build), 64-bit, with Static linking. Extract it to C:\FFmpeg and/or put the FFmpeg\bin folder it in your computer’s Path environment variable so you’ll be able to execute FFmpeg easily.

Solution

Part 1:  Extract Video and Audio from SWF

When you open a Jing SWF file in FFdec, you’ll see lots of component parts. The two that interest us are sounds and frames:

JingSWFtoMP4_1

Export the sounds and Frames:

1. In the top bar, under Export, choose Export all parts.

2. Deselect all except Sounds and Frames:

JingSWFtoMP4_2

3. Click OK. Specify an empty output folder. FFdec will create subfolders named frames and sounds.

The conversion is slow. The “frames” output is a huge AVI file (71MB per minute for a 1043×540 video at 10 frames per second). The “sounds” output is a .wav file. At least now you have readable video and audio files.

Step 2: Convert and Merge Video and Audio into an MP4 File

Now we’ll use ffmpeg to convert and merge the video and audio. There are dozens of options. The Wiki section on Encoding is helpful. Let’s start simple and build up to the final command we need.

1. Open a command prompt and go to the output folder you created in step 3 above.

2. To get info on a video or audio file, run ffmpeg with one –i (input) parameter, e.g.

ffmpeg -i frames/frames.avi
ffmpeg -i sounds/0.wav

3. To convert the video and audio to MP4 and AAC respectively, wrapping in an MP4 file:

ffmpeg -i frames/frames.avi -i sounds/0.wav -c:v libx264 -c:a aac output1.mp4

4. Add -movflags faststart to allow the video to start playing while it is downloading:

ffmpeg -i frames/frames.avi -i sounds/0.wav -c:v libx264 -c:a aac -movflags faststart output2.mp4

5. You may find that the output has audio but no video in some media players (like the Windows 10 default player). If you check the format of the file, you’ll find that it has the default yuv444p pixel format. This answer and its comments led me to try the yuv420p pixel format (which I read somewhere else is more broadly compatible):

ffmpeg -i frames/frames.avi -i sounds/0.wav -c:v libx264 -c:a aac -pix_fmt yuv420p -movflags faststart output3.mp4

6. Alas, that gave me the error message, “[libx264 @ 00000000006e1c60] width not divisible by 2 (1043×540)”. For reasons explained in this answer, for yuv420p, each dimension of the video must be divisible by 2. That answer talks about using scaling to achieve that, but heeding a suggestion in the comments of this answer, I wanted to use padding instead, to avoid any blurring. I found an example of padding in this answer, but the official documentation examples were also helpful. As shown in the error message, this particular video is 1043 wide and 540 tall. I used iw+1 to add 1 to the input width. The default color is black; I prefer white:

ffmpeg -i frames/frames.avi -i sounds/0.wav -c:v libx264 -c:a aac -pix_fmt yuv420p -movflags faststart -vf pad="width=iw+1:height=ih:x=0:y=0:color=white" output4.mp4

You now have an MP4 file that should play in the default Windows 10 player as well as any other player. I’ve also confirmed that I can upload and play the video from screencast.com. You’ll note the MP4 file is quite small, about 1MB per minute for my test case, even smaller than the original SWF file. I’ll be deleting my intermediate AVI and WAV files once I’m sure the conversion is complete.

14 thoughts on “Convert Jing SWF Files to MP4

  1. Igor

    So complete and so useful!
    By the way, I wasn’t able to export using ‘Export all parts’ – got java.lang.Nullpointerexception.
    To export I selected Sounds first (in the left object tree) and used ‘Export selection’. Then repeated it for Frames.

  2. hoda

    hello, i have 4 png instead of AVI. the code that i have to write is different, yes?

  3. Mark Berry Post author

    Hoda, I thought PNG files are still images? This article is about converting movies.

  4. hoda

    could you please help me to convert my swf file to mp4. i’ve read lots of forums and tried online converters. none was useful. I used Decompiler software and extracted swf objects. They are Fonts, Images, Shapes, Sounds, Sprites and Texts. I have no idea how i can convert it to mp4.

  5. Mark Berry Post author

    Sorry Hoda, video file conversion is outside my area of expertise. It took me a long time to figure out the Jing conversion so I posted about that specific scenario here.

  6. David Schulberg

    Downloaded and installed the JPEXS Free Flash Decompiler on Win 10 64 bit computer.
    When I try to open an SWF file the program complains it can’t open the file.

  7. Mark Berry Post author

    David, to confirm, the SWF file was created by Jing? That’s the only thing I’ve tested.

  8. David Schulberg

    Yes the SWF file was created with Jing.

  9. Mark Berry Post author

    Strange. Looks like I was using JPEX 10.0.0. Is that the version you got? If they have a support forum, you might get more help there.

  10. Bruce Wiggins

    Great post. Many thanks. The AVI output was very poor quality (compared to the lossless Jing original) so I exported the frames as PNG instead, and then glued them all together using ffmpeg before combining with audio.

    e.g. for 10 fps, 949×675 images and libx264 codec at constant rate factor (quality….lower is better) of 15

    ffmpeg -r 10 -f image2 -s 949×675 -i %d.png -vcodec libx264 -crf 15 video5_nosound.mp4

  11. AM

    Amazing article – thank you for the details.
    I used an alternative encoder on mac: mpeg4 as opposed to libx264

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.