<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dirty Motherfucking Blog &#187; air</title>
	<atom:link href="http://www.dirty-motherfucker.org/blog/tag/air/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dirty-motherfucker.org/blog</link>
	<description>All kinds of shit</description>
	<lastBuildDate>Tue, 17 Aug 2010 18:19:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1-alpha</generator>
		<item>
		<title>Converting SWF animations to video</title>
		<link>http://www.dirty-motherfucker.org/blog/2008/10/14/converting-swf-animtions-to-video/</link>
		<comments>http://www.dirty-motherfucker.org/blog/2008/10/14/converting-swf-animtions-to-video/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 09:25:54 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[aswing]]></category>
		<category><![CDATA[flashdevelop]]></category>
		<category><![CDATA[swfstudio]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://dirty-motherfucker.org/blog/?p=151</guid>
		<description><![CDATA[If you ever tried to convert a SWF animation to a video you know what a pain it can be. Let&#8217;s first look at the solutions at hand: Exporting a movie from Flash Using a SWF to movie converter Screen capture Now let&#8217;s break those down. Exporting a movie from Flash - Doesn&#8217;t play sub-movieclip [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever tried to convert a SWF animation to a video you know what a pain it can be. Let&#8217;s first look at the solutions at hand:</p>
<ul>
<li>Exporting a movie from Flash</li>
<li>Using a SWF to movie converter</li>
<li>Screen capture</li>
</ul>
<p>Now let&#8217;s break those down.</p>
<ul>
<li>Exporting a movie from Flash<br />
- Doesn&#8217;t play sub-movieclip animations</li>
<li>Using a SWF to video converter<br />
- Some have limited encoding support<br />
- Some have really bad encoding quality<br />
- Some have poor playback performance and the result looks shitty<br />
- Some also don&#8217;t play sub-movieclip animations</li>
<li>Screen capture<br />
- Suffers from the same encoding and playback problems as converters</li>
</ul>
<p>So, after trying all of the above on a project at hand i was rather disappointed to see that all the solution i tried were basically shit. The animation at hand had 1024&#215;768 dimensions and only in Flash player 10 it played with reasonable speed. So when i added screen capture into the mix the result looked like crap.</p>
<p>So i rolled my own converter. And the goals were clear:</p>
<ul>
<li>I want to capture every single frame of the animation</li>
<li>I want the highest quality possible</li>
<li>I want to use the vector scaling of flash to achieve my target size to avoid bitmap scaling later on in the process.</li>
</ul>
<p>Now what i ended up with is a converter that just writes out every single frame as PNG, no sound, no direct video. But capturing the sound is extremely easy and so is converting a PNG sequence into a movie.</p>
<p>So here is how it&#8217;s done.<br />
At first i tried to gotoAndStop( ++frame ); in a loop and writing out the frames, but this results in sub-movieclip animations not being played back.<br />
So what you have to do is just play the movie. But you place a listener on it for Event.ENTER_FRAME. If your host application runs at the same frame rate you can also place the listener on the host application (which is what I&#8217;ve done in my reference implementation).</p>
<p>Now in the event listener you just .draw into a BitmapData object, encode it to PNG (using the AsPngEncoder from the AsWing project for example) and then write it to disk.<br />
And this is where you get problems. Cause Flash itself won&#8217;t let you write to disk. I had 2 solutions to that problem. I used SWFStudio to compile a .exe that could write binaries to disk and i wrote one version in AIR.</p>
<p>Feel free to look at both implementations, but keep in mind that they are basically proof-of-concept, look like shit and are almost unuseable.</p>
<p>The SWFStudio version expects the name of the swf as the first command-line parameter (which can&#8217;t include spaces). The second and third parameter are the width and height. The last parameter is the number of frames to write.</p>
<p>The AIR version includes a GUI to set the input movie and output folder.</p>
<p>Have fun!</p>
<p><a href="http://dirty-motherfucker.org/blog/wp-content/uploads/2008/10/swf2videoconverter.zip">SWFStudio Version</a><br />
<a href="http://dirty-motherfucker.org/blog/wp-content/uploads/2008/10/swf2videoconverterair.zip">Adobe AIR Version</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dirty-motherfucker.org/blog/2008/10/14/converting-swf-animtions-to-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
