<?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>ArKaos Blog &#187; codec</title>
	<atom:link href="http://www.arkaos.net/blog/tag/codec/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.arkaos.net/blog</link>
	<description>The corporate blog of ArKaos, a leader in technology for live visual performances.</description>
	<lastBuildDate>Tue, 15 Nov 2011 09:06:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Using the right decoder for your video content</title>
		<link>http://www.arkaos.net/blog/2009/12/tips/using-the-right-decoder-for-your-video-content/</link>
		<comments>http://www.arkaos.net/blog/2009/12/tips/using-the-right-decoder-for-your-video-content/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 16:35:29 +0000</pubDate>
		<dc:creator>FraKtus</dc:creator>
				<category><![CDATA[Hints & Tips]]></category>
		<category><![CDATA[codec]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[grandvj]]></category>
		<category><![CDATA[mediamaster]]></category>
		<category><![CDATA[quicktime]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.arkaos.net/blog/?p=933</guid>
		<description><![CDATA[To get the most out of GrandVJ or MediaMaster, benefit from the advantages of multi threading and perform frame blending you should make sure that your content is always played through the best decoder.]]></description>
			<content:encoded><![CDATA[<div style="text-align: left;"><img class="alignright size-full wp-image-948" title="ffmpeg" src="http://www.arkaos.net/blog/wp-content/uploads/2009/12/ffmpeg.png" alt="ffmpeg" width="235" height="75" /></div>
<p>One thing that appears obvious to us after more than 10 years of working with the various solutions that can be used on Mac and Windows to decompress video is that not all solutions are equal.</p>
<p>We believe that our users should be able to play almost any kind of media with the ArKaos software and at the same time we do everything a team of developer can to get the best performance on the platforms supported.</p>
<p>Practically the ArKaos software can play media files through the following decoders: QuickTime, FFmpeg, the Flash plugin, Quartz Composer and Windows Media Player. Currently (December 2009) we don&#8217;t allow the user to decide through which solution a media will be decoded, instead we try to make the best decision based on our many years of experience and tests. In the case where several video codecs (such as Mpeg4) can be played through different decoders like QuickTime, FFmpeg and Windows Media Player, we always prefer, no matter the platform, to first try to handle those codecs with FFmpeg as we have always had the best results with FFmpeg during our tests, and here&#8217;s why..<span id="more-933"></span></p>
<h5>The other solutions..</h5>
<p>Of course, on the Mac we could stick to QuickTime.. But sadly it appears that QuickTime has become almost obsolete today and is just used to decompress the codecs needed by the iPods. Most codecs are not properly multi threaded in QuickTime and this is a big problem for us. With GrandVJ or MediaMaster taking advantage of multi core machines by using each core separately to decompress the video layers you are mixing, it&#8217;s too bad to miss that great improvement by playing videos that absolutely need the QuickTime support.</p>
<p>On the PC we could be using Windows Media Player, it is a wonderful technology but it&#8217;s architecture is completely incompatible with the sophisticated engine we use to allow frame blending and frame prediction in the latest version of <a title="GrandVJ - Eight channels VJ software for real time HD video mixing" href="http://www.arkaos.net/vj-dj/grandvj/" target="_blank">GrandVJ</a> and <a title="MediaMaster - DMX video software for lighting designers" href="../../show-lihting/mediamaster/" target="_blank">MediaMaster</a>.</p>
<p>Flash animations and Quartz Compositions, of course, are unique in the sense that they can only be read by their own dedicated player.</p>
<p>As you now understand, once you open a media file in ArKaos your content can go through various roads and it&#8217;s important to consider that. To get the most out of <a title="GrandVJ - Eight channels VJ software for real time HD video mixing" href="../../vj-dj/grandvj/" target="_blank">GrandVJ</a> or <a title="MediaMaster - DMX video software for lighting designers" href="../../show-lihting/mediamaster/" target="_blank">MediaMaster</a>, benefit from the advantages of multi threading and perform frame blending you should make sure that your content is always played through FFmpeg.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-938" title="ArKaosAnimationProcessing" src="http://www.arkaos.net/blog/wp-content/uploads/2009/12/ArKaosAnimationProcessing.png" alt="ArKaosAnimationProcessing" width="576" height="432" /></p>
<h5>How does ArKaos process the movie file?</h5>
<p>On the Windows platform it&#8217;s pretty easy because the software first tries to play a file with the FFmpeg player and then falls back to the others (Windows Media Player or QuickTime) if needed.</p>
<p>But things get harder with the Mac platform because some files that could be played by FFmpeg may be rejected and fall back to QuickTime just because they have not been saved the correctly. Many QuickTime files have been created in a way that make them compatible with Mac OS X but also it&#8217;s ancestors Mac OS 9 and 8 and 7 and&#8230; Those files make use of what is called a Resource Fork.</p>
<p>To make it short, when Apple introduced the Macintosh years ago they decided that a single file would in fact be two files: the data file itself and an optional resource file. Many software have been using that Resource Fork to store additional data and information. This is now a problem for many .mov files that were created in the past and even still today with some applications that were born under the Mac OS 9 era and still generate QuickTime .mov files that have a Resource Fork.</p>
<p>This is quiet an issue for us because when the FFmpeg decoder can&#8217;t handle those files and makes ArKaos fall back to QuickTime, you end with QuickTime&#8217;s very bad multi core support even for very common codecs such as Photo JPEG. Another bad side effect of this Resource Fork is that most of the time when you will copy a movie file that has a Resource Fork to a Windows or Linux machine it will simply not be readable anymore because that tiny bit of information contained in the Resource Fork is not read on other platforms although it is vital to play the content.</p>
<h5>How to get rid of the Resource Fork?</h5>
<p>Thankfully it&#8217;s very easy to remove that annoying Resource Fork from a QuickTime file. You can simply open the file in today&#8217;s QuickTime player and do a &#8220;Save As&#8221;, QuickTime will reprocess the file correctly. The process is called &#8220;flattening&#8221; a movie file, it is very fast and will not re-compress your movie, this is very important to avoid re-compressing when possible.</p>
<p style="text-align: center;">Open your file in QuickTime and go to File, Save As..</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-940" title="SlowRainSaveAs1" src="http://www.arkaos.net/blog/wp-content/uploads/2009/12/SlowRainSaveAs1.png" alt="SlowRainSaveAs1" width="520" height="394" /></p>
<p style="text-align: center;">.. and enter a new name</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-941" title="SlowRainSaveAs2" src="http://www.arkaos.net/blog/wp-content/uploads/2009/12/SlowRainSaveAs2.png" alt="SlowRainSaveAs2" width="513" height="470" /></p>
<p>Of course, you will only need to do that if your file was created on a Mac, the free version of the QuickTime player is enough to do this and it works on all Mac OS X versions up to Snow Leopard with the latest QuickTime player. Now if you have lots of movie files to convert, you can of course look for some professional software that can queue and &#8220;flatten&#8221; a bunch of files from a directory.</p>
<p style="text-align: center;">FYI, here is a QuickTime file that has a Resource Fork (moov), inspected with a programming utility called Resorcerer:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-942" title="SlowRainWithRes" src="http://www.arkaos.net/blog/wp-content/uploads/2009/12/SlowRainWithRes.png" alt="SlowRainWithRes" width="419" height="209" /></p>
<p style="text-align: center;">And here is the same file that has been flattened:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-943" title="SlowRainFlat" src="http://www.arkaos.net/blog/wp-content/uploads/2009/12/SlowRainFlat.png" alt="SlowRainFlat" width="418" height="209" /></p>
<h5>How do I know what decoder is used?</h5>
<p>In <a title="GrandVJ - Eight channels VJ software for real time HD video mixing" href="../../vj-dj/grandvj/" target="_blank">GrandVJ</a> it&#8217;s very easy to see what player is used by the ArKaos engine when processing a file; simply hover your mouse over the cell that contains the video and the contextual help appears.</p>
<p style="text-align: center;">In this one, the video file with a resource fork will be played through QuickTime:</p>
<p style="text-align: center;">
<div id="attachment_944" class="wp-caption aligncenter" style="width: 325px"><img class="size-full wp-image-944" title="GrandVJ-QT" src="http://www.arkaos.net/blog/wp-content/uploads/2009/12/GrandVJ-QT.png" alt=" " width="315" height="206" /><p class="wp-caption-text"> </p></div>
<p style="text-align: center;">In this one, the same video flattened with the QuickTime player will go through the FFmpeg path:</p>
<p style="text-align: center;">
<div id="attachment_945" class="wp-caption aligncenter" style="width: 429px"><img class="size-full wp-image-945" title="GrandVJ-FFmpeg" src="http://www.arkaos.net/blog/wp-content/uploads/2009/12/GrandVJ-FFmpeg.png" alt=" " width="419" height="225" /><p class="wp-caption-text"> </p></div>
<p style="text-align: center;">(The same information is also available in <a title="GrandVJ - Eight channels VJ software for real time HD video mixing" href="../../vj-dj/grandvj/" target="_blank">GrandVJ</a> for each movie listed in the visual library and in <a title="MediaMaster - DMX video software for lighting designers" href="../../show-lihting/mediamaster/" target="_blank">MediaMaster</a> you can get that information from the file library window.)</p>
<h5 style="text-align: left;">Conclusion</h5>
<p style="text-align: left;">During the first days of the release of <a title="GrandVJ - Eight channels VJ software for real time HD video mixing" href="../../vj-dj/grandvj/" target="_blank">GrandVJ</a> 1.2 beta 3 with the new audio engine (which relies on FFmpeg) some users have complained that some old .mov files were not playing audio correctly with the beta version, this was most of the time caused by the Resource Fork and flattening the files fixed the problem. As a bonus, it will make your files cross platform.</p>
<p style="text-align: left;">This should give you some lights on what is happening when you drop a file on <a title="GrandVJ - Eight channels VJ software for real time HD video mixing" href="../../vj-dj/grandvj/" target="_blank">GrandVJ</a> or <a title="MediaMaster - DMX video software for lighting designers" href="http://www.arkaos.net/show-lihting/mediamaster/" target="_blank">MediaMaster</a>, as you can see a lot of work is being done under the hood :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arkaos.net/blog/2009/12/tips/using-the-right-decoder-for-your-video-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New video codec based on texture compression</title>
		<link>http://www.arkaos.net/blog/2009/07/engineering/codec-texture-compression/</link>
		<comments>http://www.arkaos.net/blog/2009/07/engineering/codec-texture-compression/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 15:06:34 +0000</pubDate>
		<dc:creator>FraKtus</dc:creator>
				<category><![CDATA[Engineering]]></category>
		<category><![CDATA[codec]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[quicktime]]></category>
		<category><![CDATA[texture]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.arkaos.net/blog/?p=137</guid>
		<description><![CDATA[When it comes to media playback, at ArKaos we always fight to get the best out of current computer configuration.]]></description>
			<content:encoded><![CDATA[<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">When it comes to media playback, at ArKaos we always fight to get the best out of current computer configuration.</p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">When you are in the show industry and try to find out the best way to compress your content it’s still a little bit of black magic. While some codec are able to compress video very well they are heavy to handle for the machines, even more, the codec that does the best job at compressing while keeping a good quality such as H264 are very bad when you need to scratch your media.</p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">The best codec for users that need to interact a lot with the content should allow to play forward and backward easily and should allow to jump into the content quickly.</p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">Recently, I&#8217;ve heard about experiments with a file format designed by graphic card manufacturers and based on texture compression DXT1 DXT3 or DXT5 and I was wondering how hard it would be to add support for such a format to QuickTime through a new codec. Being programing for the QuickTime API since it’s version 1.0 beta I was considering the challenge fun and interesting.</p>
<p><span id="more-137"></span></p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">I started by resuscitating an old sample code from 1999 found on the Apple web site and after a few hours of coding and testing I had an ArKaos codec generating video files that could be played back by QuickTime.</p>
<div id="attachment_144" class="wp-caption aligncenter" style="width: 490px"><a href="http://www.arkaos.net/blog/wp-content/uploads/2009/07/qtplayer.jpg" rel="shadowbox[sbpost-137];player=img;"><img class="size-full wp-image-144 " src="http://www.arkaos.net/blog/wp-content/uploads/2009/07/qtplayer.jpg" alt="ArKaos codec in the QuickTime player" width="480" height="322" /></a><p class="wp-caption-text">ArKaos codec in the QuickTime player</p></div>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">Then I jumped on the DXT texture compression problem and chose to use the squish library to handle the job. A few more hours later and my experimental codec was working with texture compression.</p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">The codec when used by QuickTime at that point was not efficient because the texture decompression was done on the CPU, so there&#8217;s no advantage of using the GPU to handle that texture format.</p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">To measure the speed up I used an experimental player I am working on, and patched ffmpeg to handle my new codec. This allowed me to leave the texture data untouched and pass it to the GPU via the OpenGL extensions that handle texture compression.</p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">When this was done I could start enjoying the show and make some performance tests; in the table below the file size is in MB and CPU load is taken from running top in the console:</p>
<table border="1" width="100%">
<tbody>
<tr style="text-align: center;">
<td><strong>Name</strong></td>
<td><strong>Resolution</strong></td>
<td><strong>Data</strong></td>
<td><strong>H264</strong></td>
<td><strong>Photo JPEG</strong></td>
<td><strong>Dxt1</strong></td>
<td><strong>Dxt5</strong></td>
<td><strong>Dxt1 Compressed</strong></td>
<td><strong>Dxt5 Compressed</strong></td>
</tr>
<tr style="text-align: center;">
<td>Alternate Rotate DI</td>
<td>640*480</td>
<td>File Size</td>
<td>9,3</td>
<td>14,3</td>
<td>22</td>
<td>43,9</td>
<td>17,5</td>
<td>19,7</td>
</tr>
<tr style="text-align: center;">
<td></td>
<td></td>
<td>CPU Load</td>
<td>31</td>
<td>30</td>
<td>7</td>
<td>9</td>
<td>15</td>
<td>18</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr style="text-align: center;">
<td>1920 HD</td>
<td>1920*1080</td>
<td>File Size</td>
<td>36,5</td>
<td>41,8</td>
<td>90</td>
<td>180</td>
<td>55,7</td>
<td>63,8</td>
</tr>
<tr style="text-align: center;">
<td></td>
<td></td>
<td>CPU Load</td>
<td>99</td>
<td>95</td>
<td>13</td>
<td>22</td>
<td>42</td>
<td>56</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr style="text-align: center;">
<td>T25 Random Twirls</td>
<td>1280*720</td>
<td>File Size</td>
<td>35,9</td>
<td>73,2</td>
<td>65,9</td>
<td>131,8</td>
<td>51,5</td>
<td>58,4</td>
</tr>
<tr style="text-align: center;">
<td></td>
<td></td>
<td>CPU Load</td>
<td>78</td>
<td>72</td>
<td>10</td>
<td>16</td>
<td>32</td>
<td>41</td>
</tr>
</tbody>
</table>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">If you are curious about frame quality here is a crop from an original frame in Apple intermediate :</p>
<p style="margin: 0px; padding: 7px 0px; text-align: center;">
<div id="attachment_147" class="wp-caption aligncenter" style="width: 522px"><a href="http://www.arkaos.net/blog/wp-content/uploads/2009/07/frame-original.jpg" rel="shadowbox[sbpost-137];player=img;"><img class="size-full wp-image-147 " src="http://www.arkaos.net/blog/wp-content/uploads/2009/07/frame-original.jpg" alt="Original frame - Apple intermediate" width="512" height="384" /></a><p class="wp-caption-text">Original frame - Apple intermediate (click for full size)</p></div>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">Here is the same cropped frame using Dxt1 with texture compression:</p>
<div id="attachment_149" class="wp-caption aligncenter" style="width: 522px"><a href="http://www.arkaos.net/blog/wp-content/uploads/2009/07/frame-dxt1.jpg" rel="shadowbox[sbpost-137];player=img;"><img class="size-full wp-image-149 " src="http://www.arkaos.net/blog/wp-content/uploads/2009/07/frame-dxt1.jpg" alt="HD frame - Dxt1 compressed" width="512" height="384" /></a><p class="wp-caption-text">HD frame - Dxt1 compressed (click for full size)</p></div>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">And here is the same cropped frame with Dxt5 compression:</p>
<p style="margin: 0px; padding: 7px 0px; text-align: center;">
<div id="attachment_151" class="wp-caption aligncenter" style="width: 522px"><a href="http://www.arkaos.net/blog/wp-content/uploads/2009/07/frame-dxt5.jpg" rel="shadowbox[sbpost-137];player=img;"><img class="size-full wp-image-151 " src="http://www.arkaos.net/blog/wp-content/uploads/2009/07/frame-dxt5.jpg" alt="Same frame with Dxt5 compression" width="512" height="384" /></a><p class="wp-caption-text">Same frame with Dxt5 compression (click for full size)</p></div>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">So the results of these tests are that pure Dxt1 is the best format when it comes to CPU load, Dxt5 is better if you focus on quality but it generates files that are twice bigger. Actually, using Dxt1 I could have played 7 HD loops at the same time with my laptop … I mean, if hard drive&#8217;s data rate would&#8217;ve allowed it!</p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">The problem with pure Dxt5 or even Dxt1 files is that they are huge, about 4 times bigger than photo jpeg or H264 encoded files. So my workaround was to use data compression on the CPU, since it&#8217;s almost unused!</p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">To conclude, it looks like using Dxt1 with texture compression is the best solution to optimize both CPU and disk usage with a file size that is almost the same as Photo jpeg and a little bit bigger than H264. And the codec is still twice faster than any other codec I tested when using the CPU to decompress the texture data from disk.</p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">On my venerable old MacBook pro I can’t smoothly play a loop in Full HD and even at 1280*720 my machine is still struggling. Thanks to Dxt1 with texture compression I can play two HD layers and three 720p layers.</p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">Now I know you guys would like to play with this new toy so here&#8217;s a .dmg file with the test player I have used, along with a set of video loops. Beware that this dmg file is for Mac OS X x86 only (no Power PC): <a title="ArKaos Compressed Texture Demo" href="http://blog.fraktus.com/files/downloads/CompressedTextureDemo.dmg">and here&#8217;s the link</a></p>
<p style="padding-top: 7px; padding-right: 0px; padding-bottom: 7px; padding-left: 0px; margin: 0px;">You can be sure that we will bundle that new experimental codec in the next update of <a title="GrandVJ - VJ Software" href="http://www.arkaos.net/vj-dj/grandvj/" target="_blank">GrandVJ</a> and <a title="MediaMaster - Media Server Software" href="http://www.arkaos.net/show-lighting/mediamaster/" target="_blank">MediaMaster</a>, so everyone can enjoy it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.arkaos.net/blog/2009/07/engineering/codec-texture-compression/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

