ShockwaveFlash

Getting started

Install the packages and load your first SWF.

Install

The library ships as three independent packages — add only what you need. All target .NET 10.

dotnet add package ShockwaveFlash             # read / write SWF
dotnet add package ShockwaveFlash.Avm1        # AVM1 bytecode & data scripts
dotnet add package ShockwaveFlash.Rendering   # render to PNG/JPEG/WebP/GIF/PDF/SVG

Headless Linux

For rendering on a server, also add SkiaSharp.NativeAssets.Linux.NoDependencies so Skia has a native backend.

Your first SWF

Load a file

ShockwaveFlashFile.Disassemble parses the bytes into a strongly-typed, mutable movie.

using ShockwaveFlash;

var swf = ShockwaveFlashFile.Disassemble(File.ReadAllBytes("movie.swf"));

Inspect it

The header and the tag list are plain, typed objects.

Console.WriteLine($"SWF v{swf.Header.Version} ({swf.Header.Compression})");
Console.WriteLine($"Frame size : {swf.Header.FrameSize}");
Console.WriteLine($"Frame rate : {swf.Header.FrameRate.ToSingle()} fps");
Console.WriteLine($"Tags       : {swf.Tags.Count}");

foreach (var tag in swf.Tags)
    Console.WriteLine($"  {tag.Metadata.Code} ({tag.Metadata.Length} bytes)");

Write it back

Edit the tree in place, then Assemble — the round-trip is lossless.

File.WriteAllBytes("copy.swf", swf.Assemble().ToArray());

Where to next

On this page