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.

Difference between revisions of "Swfextract"

From SWFTools
Jump to: navigation, search
(Removed online Betting link. Cheers for that Alex B! :o/)
(Incorporating "Know bugs" from the Discussion page)
 
(6 intermediate revisions by 3 users not shown)
Line 38: Line 38:
 
-m , --mp3 Extract main mp3 stream
 
-m , --mp3 Extract main mp3 stream
 
-s , --sound ID Extract Sound(s)
 
-s , --sound ID Extract Sound(s)
 +
 +
Extract all:
 +
 +
-a Extract all files
 +
--outputformat "extract_%06d.%s" Filename to use for extraction (printf format)
 +
 
</pre>
 
</pre>
 +
 +
== How to use it ==
 +
To extract everything use... <ref>[http://www.mail-archive.com/swftools-common@nongnu.org/msg04813.html Paul Fitzpatrick's message to the swftools-common mailing list]</ref>
 +
<pre>
 +
swfextract --outputformat "extract_%06d.%s" -a 1- test.swf
 +
</pre>
 +
 +
To extract individual items. First, run ''swfextract file.swf'' and get whatever the flash application contains. The output looks like:
 +
 +
<pre>
 +
Objects in file file.swf:
 +
[-i] 8 Shapes: ID(s) 2, 5, 7, 9, 11, 13, 15, 17
 +
[-i] 1 MovieClip: ID(s) 18
 +
[-j] 8 JPEGs: ID(s) 1, 4, 6, 8, 10, 12, 14, 16
 +
[-F] 1 Font: ID(s) 3
 +
[-f] 1 Frame: ID(s) 0
 +
</pre>
 +
 +
These are the objects you will be able to extract. For example, if you want to extract the third jpg (ID = 6) to a file ''file.jpeg'', the command is:
 +
<pre>
 +
swfextract -j 6 file.swf -o file.jpeg
 +
</pre>
 +
 +
== Bash shell script example to extract a range of sounds ==
 +
 +
To view the list of sound IDs in file example.swf, run:
 +
<pre>swfextract example.swf
 +
 +
...
 +
[-s] 20 Sounds: ID(s) 30-50
 +
...</pre>
 +
 +
<pre>cat extract.sh
 +
 +
for i in $(seq 30 1 50)
 +
do
 +
swfextract -s $i example.swf -o $i.mp3
 +
done
 +
</pre>
 +
 +
'''Run using'''
 +
 +
<pre>sh ./extract.sh</pre>
 +
 +
== Known bugs ==
 +
Swfextract is throwing a bunch of "Not a JPEG file: starts with 0x00 0x10" errors then aborting, even while trying an '-a --outputformat' extraction.  The correct behavior should be to skip the errors and extract the ''invalid'' files anyway.
 +
 +
In this case, the syntax should be changed to  -a [id] -o [file-prefix]  Examples:
 +
 +
:swfextract -a foo.swf
 +
: foo_000001.jpg
 +
: foo_000002.png
 +
 +
:swfextract -a 1-2 -o bar foo.swf
 +
: bar_000001.jpg
 +
: bar_000002.png

Latest revision as of 09:02, 25 July 2014

Current Stable

swfextract man page

Current Git


Usage: swfextract [-v] [-n name] [-ijf ids] file.swf


Available Options

	-v , --verbose			 Be more verbose
	-o , --output filename		 set output filename
	-V , --version			 Print program version and exit

SWF Sub-element 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
	-s , --sound ID			 Extract Sound(s)

Extract all:

	-a				 Extract all files
	--outputformat "extract_%06d.%s" Filename to use for extraction (printf format)

How to use it

To extract everything use... <ref>Paul Fitzpatrick's message to the swftools-common mailing list</ref>

swfextract --outputformat "extract_%06d.%s" -a 1- test.swf

To extract individual items. First, run swfextract file.swf and get whatever the flash application contains. The output looks like:

Objects in file file.swf:
 [-i] 8 Shapes: ID(s) 2, 5, 7, 9, 11, 13, 15, 17
 [-i] 1 MovieClip: ID(s) 18
 [-j] 8 JPEGs: ID(s) 1, 4, 6, 8, 10, 12, 14, 16
 [-F] 1 Font: ID(s) 3
 [-f] 1 Frame: ID(s) 0

These are the objects you will be able to extract. For example, if you want to extract the third jpg (ID = 6) to a file file.jpeg, the command is:

swfextract -j 6 file.swf -o file.jpeg

Bash shell script example to extract a range of sounds

To view the list of sound IDs in file example.swf, run:

swfextract example.swf

...
[-s] 20 Sounds: ID(s) 30-50
...
cat extract.sh

for i in $(seq 30 1 50)
do
swfextract -s $i example.swf -o $i.mp3
done

Run using

sh ./extract.sh

Known bugs

Swfextract is throwing a bunch of "Not a JPEG file: starts with 0x00 0x10" errors then aborting, even while trying an '-a --outputformat' extraction. The correct behavior should be to skip the errors and extract the invalid files anyway.

In this case, the syntax should be changed to -a [id] -o [file-prefix] Examples:

swfextract -a foo.swf
foo_000001.jpg
foo_000002.png
swfextract -a 1-2 -o bar foo.swf
bar_000001.jpg
bar_000002.png