Because of the constant attack by the wiki spam bots, accounts that are created and not used will be deleted. If you are a legitimate user, and your IP was blocked, please contact any active administrator - look at Special:RecentChanges and see who is busy fighting spam.

From SWFTools
Revision as of 10:12, 10 May 2012 by ChrisP (Talk | contribs) (ttftool)

Jump to: navigation, search

SWF generation and manipulation utilities

Available downloads

Quick Links:
SWFTools 0.9.2 Stable - Source Code for Linux and Windows
SWFTools 0.9.2 Stable - Windows Binary
SWFTools 0.9.1 Stable - Source Code for Linux and Windows
SWFTools 0.9.1 Stable - Windows Binary
Main GIT Repository : git clone git://git.swftools.org/swftools
Main GIT Repository Clone: http://wiki.swftools.org/viewgit ( with file browser )
GIT Repository Clone https://github.com/rpedroso ( maintained by Ricardo Pedroso )


Installation guides

Installation - How To


Mailing List

swftools-common is a user self-managed, friendly, low volume mailing list. Queries, and suggestions concerning the SWFTools utilities suite should be posted here, as should the submission of patches for inclusion in the git repository. Subscription is highly recommended.


Subscribe/unSubscribe here!


A lot of useful information may gleaned from the fully searchable mailing list archives. Your query may already have been answered! Do check the archives before posting to the list.

swftools-common Archive


SWFTools Website

SWFTools Website


SWF Tools 0.9.2 ( Current Stable Version ) Documentation

as3compile - a standalone ActionScript 3.0 compiler

Usage: ./as3compile file.as [-o file.swf]
  [switches]   <collapsetext><collapse>
-h , --help                    Print short help message and exit
-V , --version                 Print version info and exit
-v , --verbose                 Increase verbosity
-q , --quiet                   Decrease verbosity
-C , --cgi                     Output to stdout (for use in CGI environments)
-R , --resolve                 Try to resolve undefined classes automatically.
-D , --define <namespace::variable>    Set a compile time variable (for doing conditional compilation)
-X , --width                   Set target SWF width
-Y , --height                  Set target SWF width
-r , --rate                    Set target SWF framerate
-M , --mainclass               Set the name of the main class (extending flash.display.MovieClip)
-l , --library <file>          Include library file <file>. <file> can be an .abc or .swf file.
-I , --include <dir>           Add additional include dir <dir>.
-N , --local-with-network      Make output file "local with networking"
-L , --local-with-filesystem     Make output file "local with filesystem"
-T , --flashversion <num>      Set target SWF flash version to <num>.
-o , --output <filename>       Set output file to <filename>.

</collapsetext>


font2swf - Font file (TTF, Type1) conversiom to SWF

Usage: ./font2swf <fontfile>'
  [switches]   <collapsetext><collapse>
-h , --help                    Print short help message and exit
-v , --verbose                 Be verbose. Use more than one -v for greater effect.
-o , --output <filename>       Write output to file <filename>.
-V , --version                 Print version info and exit

</collapsetext>


gif2swf - GIF to SWF conversion. Able to handle animated gifs

Usage: ./gif2swf [-X width] [-Y height] [-o file.swf] [-r rate] file1.gif [file2.gif ...]'
  [switches]   <collapsetext><collapse>

-r , --rate <framerate>        Set movie framerate (frames per second)
-o , --output <filename>       Set name for SWF output file.
-z , --zlib <zlib>             Enable Flash 6 (MX) Zlib Compression
-l , --loop <loop count>           Set loop count. (default: 0 [=infinite loop])
-X , --pixel <width>           Force movie width to <width> (default: autodetect)
-Y , --pixel <height>          Force movie height to <height> (default: autodetect)
-v , --verbose <level>         Set verbose level (0=quiet, 1=default, 2=debug)
-C , --cgi                     For use as CGI- prepend http header, write to stdout
-V , --version                 Print version information and exit

</collapsetext>


jpeg2swf - generates a slideshow from one or more JPEG pictures. Supports motion estimation compression (h.263) for better compression of video sequences

Usage: ./jpeg2swf [-options [value]] imagefiles[.jpg]|[.jpeg] [...]
  [switches]   <collapsetext><collapse>
-o , --output <outputfile>     Explicitly specify output file. (otherwise, output.swf will be used)
-q , --quality <quality>       Set compression quality (1-100, 1=worst, 100=best)
-r , --rate <framerate>        Set movie framerate (frames per second)
-z , --zlib <zlib>             Enable Flash 6 (MX) Zlib Compression
-M , --mx                      Use Flash MX H.263 compression (use for correlated images)
-x , --xoffset <offset>        horizontally offset images by <offset>
-y , --yoffset <offset>        vertically offset images by <offset>
-X , --width <width>           Force movie width to <width> (default: autodetect)
-Y , --height <height>         Force movie height to <height> (default: autodetect)
-T , --flashversion <version>      Set flash file version to <version>
-v , --verbose <level>         Set verbose level to <level> (0=quiet, 1=default, 2=debug)
-V , --version                 Print version information and exit
-f , --fit-to-movie            Fit images to movie size
-e , --export <assetname>          Make importable as asset with <assetname>

</collapsetext>


pdf2swf - PDF to SWF Converter. Generates one frame per page. Enables fully formatted text, ::including tables and formulas, inside a Flash Movie.

( It's based on the xpdf PDF parser from ::Derek B. Noonburg. )
Usage: ./pdf2swf [-options] file.pdf -o file.swf
  [switches]   <collapsetext><collapse>
-h , --help                    Print short help message and exit
-V , --version                 Print version info and exit
-o , --output file.swf         Direct output to file.swf. If file.swf contains '%' (file%.swf), then each page goes to a separate file.
-p , --pages range             Convert only pages in range with range e.g. 1-20 or 1,4,6,9-11 or
-P , --password password       Use password for deciphering the pdf.
-v , --verbose                 Be verbose. Use more than one -v for greater effect.
-z , --zlib                    Use Flash 6 (MX) zlib compression.
-i , --ignore                  Allows pdf2swf to change the draw order of the pdf. This may make the generated
-j , --jpegquality quality     Set quality of embedded jpeg pictures to quality. 0 is worst (small), 100 is best (big). (default:85)
-s , --set param=value         Set a SWF encoder specific parameter.  See pdf2swf -s help for more information.
-w , --samewindow              When converting pdf hyperlinks, don't make the links open a new window. 
-t , --stop                    Insert a stop() command in each page. 
-T , --flashversion num        Set Flash Version in the SWF header to num.
-F , --fontdir directory       Add directory to the font search path.
-b , --defaultviewer           Link a standard viewer to the swf file. 
-l , --defaultloader           Link a standard preloader to the swf file which will be displayed while the main swf is loading.
-B , --viewer filename         Link viewer filename to the swf file. 
-L , --preloader filename      Link preloader filename to the swf file. 
-q , --quiet                   Suppress normal messages.  Use -qq to suppress warnings, also.
-S , --shapes                  Don't use SWF Fonts, but store everything as shape.
-f , --fonts                   Store full fonts in SWF. (Don't reduce to used characters).
-G , --flatten                 Remove as many clip layers from file as possible. 
-I , --info                    Don't do actual conversion, just display a list of all pages in the PDF.
-Q , --maxtime n               Abort conversion after n seconds. Only available on Unix.

</collapsetext>


pdf2swf -s - Set a SWF encoder specific parameter

Usage: ./pdf2swf -s [option][=value] input.pdf -o output.swf
  [switches]   <collapsetext><collapse>
PDF device global parameters:

fontdir=<dir>     a directory with additional fonts
font=<filename>   an additional font filename
pages=<range>     the range of pages to convert (example: pages=1-100,210-)
zoom=<dpi>        the resultion (default: 72)
languagedir=<dir> Add an xpdf language directory
multiply=<times>  Render everything at <times> the resolution
poly2bitmap       Convert graphics to bitmaps
bitmap            Convert everything to bitmaps

SWF Parameters:

SWF layer options:
jpegsubpixels=<pixels>      resolution adjustment for jpeg images (same as jpegdpi, but in pixels)
ppmsubpixels=<pixels        resolution adjustment for  lossless images (same as ppmdpi, but in pixels)
subpixels=<pixels>          shortcut for setting both jpegsubpixels and ppmsubpixels
drawonlyshapes              convert everything to shapes (currently broken)
ignoredraworder             allow to perform a few optimizations for creating smaller SWFs
linksopennewwindow          make links open a new browser window
linktarget                  target window name of new links
linkcolor=<color)           color of links (format: RRGGBBAA)
linknameurl		    Link buttons will be named like the URL they refer to (handy for iterating through links with actionscript)
storeallcharacters          don't reduce the fonts to used characters in the output file
enablezlib                  switch on zlib compression (also done if flashversion>=6)
bboxvars                    store the bounding box of the SWF file in actionscript variables
dots                        Take care to handle dots correctly
reordertags=0/1             (default: 1) perform some tag optimizations
internallinkfunction=<name> when the user clicks a internal link (to a different page) in the converted file, this actionscript function is called
externallinkfunction=<name> when the user clicks an external link (e.g. http://www.foo.bar/) on the converted file, this actionscript function is called
disable_polygon_conversion  never convert strokes to polygons (will remove capstyles and joint styles)
caplinewidth=<width>        the minimum thichness a line needs to have so that capstyles become visible (and are converted)

insertstop                  put an ActionScript "STOP" tag in every frame
protect                     add a "protect" tag to the file, to prevent loading in the Flash editor
flashversion=<version>      the SWF fileversion (6)
framerate=<fps>		    SWF framerate
minlinewidth=<width>        convert horizontal/vertical boxes smaller than this width to lines (0.05) 
simpleviewer                Add next/previous buttons to the SWF
animate                     insert a showframe tag after each placeobject (animate draw order of PDF files)
jpegquality=<quality>       set compression quality of jpeg images
splinequality=<value>       Set the quality of spline convertion to value (0-100, default: 100).
disablelinks                Disable links.

</collapsetext>


png2swf - like JPEG2SWF, only for PNGs

Usage: png2swf [-X width] [-Y height] [-o file.swf] [-r rate] file1.png [file2.png...]
  [switches]   <collapsetext><collapse>
-r , --rate <framerate>        Set movie framerate (frames per second)
-o , --output <filename>       Set name for SWF output file.
-j , --jpeg <quality>          Generate a lossy jpeg bitmap inside the SWF, with a given quality (1-100)
-z , --zlib <zlib>             Enable Flash 6 (MX) Zlib Compression
-T , --flashversion            Set the flash version to generate
-X , --pixel <width>           Force movie width to <width> (default: autodetect)
-Y , --pixel <height>          Force movie height to <height> (default: autodetect)
-v , --verbose <level>         Set verbose level (0=quiet, 1=default, 2=debug)
-q , --quiet                   Omit normal log messages, only log errors
-C , --cgi                     For use as CGI- prepend http header, write to stdout
-V , --version                 Print version information and exit

</collapsetext>


swfbbox - allows to read out, optimize and readjust SWF bounding boxes

Usage: ./swfbbox [-OS] file.swf
  [switches]   <collapsetext><collapse>
-h , --help                    Print help and exit
-b , --bbox                    Show movie bounding box (default)
-B , --newbbox                 Show recalculated (optimized/expanded) bounding box
-e , --expand                  Write out a new file using the recalculated header bounding box
-O , --optimize                Recalculate all object bounding boxes (except for the header)
-S , --swifty                  Print out transformed bounding boxes
-c , --clip                    Clip bounding boxes to movie size
-o , --output <filename>       Set output filename to <filename> (for -O)
-v , --verbose                 Be more verbose
-V , --version                 Print program version and exit

</collapsetext>


swfbytes - hex dump swf byte code to a file

Usage: ./swfbytes [-v] file.swf > file.hexdump
OR: ./swfbytes file.hexdump
  [switches]   <collapsetext><collapse>
-h , --help                    Print help and exit
-v , --verbose                 Be more verbose
-V , --version                 Print program version and exit

</collapsetext>


swfc - SWF file creation from simple swfc script files. Includes ActionScript 2.0/3,0 support

Usage: ./swfc [-o file.swf] file.sc
  [switches]   <collapsetext><collapse>
-h , --help                    Print short help message and exit
-V , --version                 Print version info and exit
-C , --cgi                     Output to stdout (for use in CGI environments)
-v , --verbose                 Increase verbosity. 
-o , --output <filename>       Set output file to <filename>.

</collapsetext>


swfcombine - multi-function tool for SWF insertion into wrapper SWFs, SWF concatenation, stacking, and basic parameter manipulation (e.g. size change )

Usage: ./swfcombine [-rXYomlcv] [-f] masterfile [-xysf] [(name1|#id1)=]slavefile1 .. [-xysf] [(nameN|#idN)=]slavefileN
OR: ./swfcombine [-rXYomv] --stack[1] [-xysf] [(name1|#id1)=]slavefile1 .. [-xysf] [(nameN|#idN)=]slavefileN
OR: ./swfcombine [-rXYov] --cat [-xysf] [(name1|#id1)=]slavefile1 .. [-xysf] [(nameN|#idN)=]slavefileN
OR: ./swfcombine [-rXYomlcv] --dummy [-xys] [file]
  [switches]   <collapsetext><collapse>
-o , --output <outputfile>      explicitly specify output file. (otherwise, output.swf will be used)
-t , --stack                   place each slave in a seperate frame (no master movie)
-T , --stack1                  place each slave in the first frame (no master movie)
-m , --merge                   Don't store the slaves in Sprites/MovieClips
-a , --cat                     concatenate all slave files (no master movie)
-l , --overlay                 Don't remove any master objects, only overlay new objects
-c , --clip                    Clip the slave objects by the corresponding master objects
-v , --verbose                 Be verbose. Use more than one -v for greater effect 
-F , --flashversion            Set the flash version of the output file.
-d , --dummy                   Don't require slave objects (for changing movie attributes)
-f , --frame                   The following identifier is a frame or framelabel, not an id or objectname
-x , --movex <xpos>            x Adjust position of slave by <xpos> pixels
-y , --movey <ypos>            y Adjust position of slave by <ypos> pixels
-s , --scale <scale>           Adjust size of slave by <scale> percent (e.g. 100% = original size)
-r , --rate <fps>              Set movie framerate to <fps> (frames/sec)
-X , --width <width>           Force movie bbox width to <width> (default: use master width (not with -t))
-Y , --height <height>          Force movie bbox height to <height> (default: use master height (not with -t))
-N , --local-with-networking     Make output file "local-with-networking"
-G , --hardware-gpu            Set the "use hardware gpu" bit in the output file
-B , --accelerated-blit        Set the "use accelerated blit" bit in the output file
-L , --local-with-filesystem     Make output file "local-with-filesystem"
-z , --zlib <zlib>             Enable Flash 6 (MX) Zlib Compression

</collapsetext>


swfdump - print out SWF asset information, i.e. images/fonts/sounds, code content disassembly, cross-reference and bounding box data.

Usage: ./swfdump [-atpdu] file.swf
  [switches]   <collapsetext><collapse>
-h , --help                    Print short help message and exit
-D , --full                    Show everything. Same as -atp
-V , --version                 Print version info and exit
-e , --html                    Print out html code for embedding the file
-E , --xhtml                   Print out xhtml code for embedding the file
-a , --action                  Disassemble action tags
-t , --text                    Show text fields (like swfstrings).
-s , --shapes                  Show shape coordinates/styles
-F , --fonts                   Show font information
-p , --placements              Show placement information
-B , --buttons                 Show button information
-b , --bbox                    Print tag's bounding boxes
-X , --width                   Prints out a string of the form "-X width".
-Y , --height                  Prints out a string of the form "-Y height".
-r , --rate                    Prints out a string of the form "-r rate".
-f , --frames                  Prints out a string of the form "-f framenum".
-d , --hex                     Print hex output of tag data, too.
-u , --used                    Show referred IDs for each Tag.

</collapsetext>


swfextract - SWF element extraction: Movieclips, Sounds, Images, shapes, etc

Usage: ./swfextract [-v] [-n name] [-ijf ids] file.swf
  [switches]   <collapsetext><collapse>
	-v , --verbose			 Be more verbose
	-o , --output filename		 set output filename
	-V , --version			 Print program version and exit

SWF Subelement extraction:
	-n , --name name		 instance name of the object (SWF Define) to extract
	-i , --id ID			 ID of the object, shape or movieclip to extract
	-f , --frame frames		 frame numbers to extract
	-w , --hollow			 hollow mode: don't remove empty frames
	             			 (use with -f)
	-P , --placeobject			 Insert original placeobject into output file
	             			 (use with -i)
SWF Font/Text extraction:
	-F , --font ID			 Extract font(s)
Picture extraction:
	-j , --jpeg ID			 Extract JPEG picture(s)
	-p , --pngs ID			 Extract PNG picture(s)

Sound extraction:
	-m , --mp3			 Extract main mp3 stream
	-M , --embeddedmp3			 Extract embedded mp3 stream(s)
	-s , --sound ID			 Extract Sound(s)

</collapsetext>


swfrender - bitmap rendering from swf files created with pdf2swf, jpeg2swf or png2swf

Usage: ./swfrender file.swf [-o output.png]
  [switches]   <collapsetext><collapse>
-h , --help                    Print short help message and exit
-l , --legacy                  Use old rendering framework
-o , --output		   Output file (default: output.png)

</collapsetext>


swfstrings - scans SWFs for textual ( aphpanumeric ) data

Usage: ./swfstrings [options] file.swf
  [switches]   <collapsetext><collapse>
-f , --fonts                   Print out font information for each text block
-x , --xpos <x>                Set bounding box x coordinate
-y , --ypos <y>                Set bounding box y coordinate
-W , --width <width>           Set bounding box width
-H , --height <height>         Set bounding box height
-V , --version                 Print version information and exit

</collapsetext>


ttftool - ttf font manipulation tool

Usage: ./ttftool <fontfile>
  [switches]   <collapsetext><collapse>
-h , --help                    Print short help message and exit
-v , --verbose                 Be verbose. Use more than one -v for greater effect.
-o , --output <filename>       Write output to file <filename>.
-V , --version                 Print version info and exit

</collapsetext>


wav2swf - WAV audio to SWF conversion

Usage: ./wav2swf [-o filename] file.wav
  [switches]   <collapsetext><collapse>
-h , --help                    Print short help message and exit
-V , --version                 Print version info and exit
-o , --output <filename>       Explicitly specify output file. (Otherwise, output will go to output.swf)
-r , --framerate <fps>         Set file framerate to <fps> frames per second.
-s , --samplerate <sps>        Set samplerate to <sps> frames per second (default: 11025).
-d , --definesound             Generate a DefineSound tag instead of streaming sound.
-l , --loop n                  (Only used with -d)
-C , --cgi                     For use as CGI- prepend http header, write to stdout.
-S , --stop                    Stop the movie at frame 0
-E , --end                     Stop the movie at the end frame
-b , --bitrate <bps>           Set mp3 bitrate to <bps> (default: 32)
-v , --verbose                 Be more verbose

</collapsetext>

Questions & Answers

Frequently asked questions (FAQ) including compilation instructions for Linux, Windows, and Mac
Frequently Given Answers (FGA) - various swfc code snippets to compile and test
Example Code - further examples of SWFTools usage and coding implementations


== SWF Tools 0.9.1 ( Previous Stable Version ) == <collapsetext><collapse>

Command Description
as3compile A standalone ActionScript 3.0 compiler.
avi2swf AVI animation files to SWF converter (now deprecated, use MEncoder or ffmpeg for this).
font2swf Font file (TTF, Type1) conversiom to SWF.
gif2swf GIFs to SWF conversion. Able to handle animated gifs.
jpeg2swf Generates a slideshow from one or more JPEG pictures. Supports motion estimation compression (h.263) for better compression of video sequences.
pdf2swf PDF to SWF Converter. Generates one frame per page. Enables fully formatted text, ::including tables and formulas, inside a Flash Movie. It's based on the xpdf PDF parser from ::Derek B. Noonburg.
png2swf Like JPEG2SWF, only for PNGs.
swfbbox Allows to read out, optimize and readjust SWF bounding boxes.
swfc SWF file creation from simple script files. Includes ActionScript 2.0/3,0 support.
swfcombine Multi-function tool for SWF ibsertion into Wrapper SWFs, SWF contatenation, stacking, and basic parameter manipulation (e.g. size change ).
swfdump Prints out SWF information, i.e images/fonts/sounds, contained code disassembly, cross-reference and bounding box data.
swfextract SWF element extraction: Movieclips, Sounds, Images, shapes, etc.
swfrender Bitmap rendering from swf files created with pdf2swf, jpeg2swf or png2swf.
swfstrings Scans SWFs for text data.
wav2swf WAV audio to SWF conversion.

</collapsetext>


SWF API Documentation

python gfx module
Python library


SWFTools based software

GUI wrappers for some SWFTools commands:

Wrapper swfc command Contributor
SWF Extractor swfextract Chris Ohmstede
qpdf2swf pdf2swf. Written in QT4 Silvian Cretu
Gpdf2swf pdf2swf ( part of the Windows distribution ) Ricardo Pedroso/Matthias Kramm

Editors

Software Description Contributor
:scEdit Windows '98/XP swfc GUI editor - Laurent Lalanne

Viewers

Software Description Contributor
:zViewer (2009) Document Viewer in AS2, uses rfxview Cristan Rusu
( Various ) ( supplied with swftools distribution )

Media Players:

software Description Contributor
Video Player Video Player (swfc compilable script ) John Sullivan ( .video tag patch contributor )
swfty Media Player/SWF Viewer (swfc compilable script ) Nissemand


Related Documentation and Guides

Adobe PDF Reference
Adobe SWF File Format Reference
Adobe Actionscript 2.0 Reference
Adobe Actionscript 3.0 Reference
ECMA Script
Mozilla Tamarin Project - Open Source AS3


Useful Software Links- Open Source and Other

OSFlash - Sited dedicated to Open Source Flash Software
ePDFViewer - requires Poppler and GTK4 ( plus CUPS for printing )
muPDF Lightweight PDF Viewer, Toolkit and library - Linux/Windows. Written in Portable C. Released under GNU GPL v3.0
Evince - Gnome Project's multi-format document viewer ( Linux/Windows )
Nitro PDF PDF Viewer/Editor - Windows
ZOHO Viewer on-line document viewer
PDF Xchange Viewer PDF Viewer/Editor - Windows. Free version of a Closed Source Commercial Product
Xpdf Open Source viewer and tools used by SWFTools - Linux/Windows. GNU GPL v2.0
PDF Software Listing Wikipedia list of PDF software inc development libraries
PDFEdit pdf maniplation Library and Tools - Linux/Windows. Released under GNU GPL v2.0
AlivePDF Open Source PDF library written is Actionscript 3
PDF Readers/Viewers General Information


---

NB The above links are provided solely for informational purposes in the hope they prove useful. Where site content and any products referenced may have been found to be of particular interest, their mention here in no way implies a relationship to the SWFTools project,

its maintainers, nor compatibility with it's code base. Should the worst happen and something breaks your system, we are not, repeat NOT responsible. :)