<?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>Creative Workflow Hacks &#187; Advanced</title>
	<atom:link href="http://www.creative-workflow-hacks.com/category/advanced/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.creative-workflow-hacks.com</link>
	<description>Sharing tips, scripts and hacks for your creative workflow.</description>
	<lastBuildDate>Mon, 10 May 2010 17:40:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Converting a Web Color to an RGB float array for After Effects</title>
		<link>http://www.creative-workflow-hacks.com/2006/05/29/converting-a-web-color-to-an-rgb-float-array-for-after-effects/</link>
		<comments>http://www.creative-workflow-hacks.com/2006/05/29/converting-a-web-color-to-an-rgb-float-array-for-after-effects/#comments</comments>
		<pubDate>Mon, 29 May 2006 21:59:21 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[After Effects ]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://www.creative-workflow-hacks.com/2006/05/29/converting-a-web-color-to-an-rgb-float-array-for-after-effects/</guid>
		<description><![CDATA[I&#8217;m writing  a script that needs hexadecimal color input, sometimes referred to as a web color, converted to a value usable for a solid in After Effects. After Effects wants an array of RGB values in the range 0 to 1: [R, G, B]. Luckily Javascript supports bit-wise operators so the conversion is pretty [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m writing  a script that needs <strong>hexadecimal color</strong> input, sometimes referred to as a <strong>web color</strong>, converted to a value usable for a solid in <strong>After Effects</strong>. After Effects wants an array of RGB values in the range 0 to 1: [R, G, B]. Luckily Javascript supports <strong>bit-wise operators</strong> so the conversion is pretty straight forward. I used this function.</p>
<p><code></p>
<pre>
var hex = 'ffaadd';
var colors = hexToRGBArray(hex);

alert("red =" + colors[0] + " green=" + colors[1] + " blue=" + colors[2]);

function hexToRGBArray(hex){
	var rgb = parseInt(hex, 16);
	var red   = (rgb >>16) &#038; 0xFF;
	var green = (rgb >>8) &#038; 0xFF;
	var blue  = rgb &#038; 0xFF;

	var colorArray = [red/255.0, green/255.0, blue/255.0];

	return colorArray;

}
</pre>
<p></code><br />
<a href="http://creative-workflow-hacks.com/downloads/colorConversion.jsx">Source for this script</a><br />
<a href="http://creative-workflow-hacks.com/downloads/colorConversion.zip">Downloadable version of  this script</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.creative-workflow-hacks.com/2006/05/29/converting-a-web-color-to-an-rgb-float-array-for-after-effects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving toward reading FCP source timecode from imported Quicktimes in After Effects</title>
		<link>http://www.creative-workflow-hacks.com/2006/05/09/moving-toward-reading-fcp-source-timecode-from-imported-quicktimes-in-after-effects/</link>
		<comments>http://www.creative-workflow-hacks.com/2006/05/09/moving-toward-reading-fcp-source-timecode-from-imported-quicktimes-in-after-effects/#comments</comments>
		<pubDate>Tue, 09 May 2006 16:59:44 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[Advanced]]></category>
		<category><![CDATA[After Effects ]]></category>
		<category><![CDATA[Final Cut Pro]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://www.creative-workflow-hacks.com/2006/05/09/moving-toward-reading-fcp-source-timecode-from-imported-quicktimes-in-after-effects/</guid>
		<description><![CDATA[A recent thread on aenhancers discussed reading source timecode from Quicktimes imported from Final Cut Pro captures in After Effects. Seems like a perfectly reasonable request, there could be a bunch of situations where this information would be useful in an After Effects project. Problem is, it doesn&#8217;t seem really easy to grab that data. [...]]]></description>
			<content:encoded><![CDATA[<p>A recent <a title="Reading Timecode from a QT file?" href="http://www.aenhancers.com/viewtopic.php?t=430">thread</a> on <a title="aenhancers" href="http://www.aenhancers.com">aenhancers</a> discussed reading source timecode from Quicktimes imported from Final Cut Pro captures in After Effects. Seems like a perfectly reasonable request, there could be a bunch of situations where this information would be useful in an After Effects project. Problem is, it doesn&#8217;t seem really easy to grab that data. <span style="text-decoration: line-through;">When you view the timecode track in the imported quicktime, the timecode is in reference to the source Quicktime not the source tape from the capture.</span></p>
<h2>Correction</h2>
<p>Mark Burton posted on the thread mentioned above that actually the timecode <strong>is</strong> written to the Quicktime.  He offered a link to <a href="http://www.dharmafilm.com/sebskytools/download.html">Sebsky Tools</a> as an example of an app using that info. I simply <a href="http://aenhancers.com/viewtopic.php?p=1510#1510">misread</a> the Quicktime player info. There is still useful info from Final Cut we can access and I think the ideas in this article are interesting so I&#8217;m leaving it up with this correction. Thanks Mark.
</p>
<p><span style="text-decoration: line-through;">At least until Apple decides to put that information into the captured Quicktime</span> We&#8217;ll need to find a <span style="text-decoration: line-through;">workaround</span> way to read FCP info and that&#8217;s what I&#8217;m going to cover in this post.</p>
<p><span id="more-14"></span></p>
<p>In approaching this problem the first order of business is to figure out what information we <strong>do</strong> have access to. We know we can use the <strong>file</strong> attribute of <strong>footage item</strong> via extendscript to grab the path of the selected footage in After Effects. We know we have access to the original capture information via FCP-XML. We also know we have access to external applications in After Effects via <strong>system.callSytem()</strong>.</p>
<p>At first glance, what are we missing? We don&#8217;t really know <strong>which</strong> FCP-XML file has the source information and we have to figure out how to get that information into a usable form back into After Effects.</p>
<p>Let&#8217;s tackle the FCP-XML part first. In my<a title="Stupid Scripting Tricks: Import every Quicktime available" href="http://www.creative-workflow-hacks.com/2006/05/04/stupid-scripting-tricks-import-every-quicktime-available/"> last post</a> I had a bit of teaser info about <strong>metadata</strong> via <strong>spotlight</strong> in<strong> OSX10.4(Tiger)</strong>. I&#8217;ve had some problems with <strong>Spotlight</strong>, mostly related to the bizarre behavior of the GUI find command and indexing that happens at inopportune times, but the more I research it I think the benefits will eventually outweigh the negatives as the technology is tweaked and enhanced.</p>
<p>What exactly does <strong>Spotlight</strong> do? For our purposes, <strong>Spotlight</strong> works on a couple of different levels. It gives us access to metadata <strong>keywords</strong> and it <strong>indexes</strong> our content. In my teaser, I used:</p>
<p><code>  </code></p>
<pre>mdfind 'kMDItemKind == "QuickTime Movie"'</pre>
<p>The <strong>kMDItemKind</strong> is an example of a metadata keyword. In this case this is a keyword Apple has set aside as a <a title="Spotlight Metadata Attributes" href="http://developer.apple.com/documentation/Carbon/Reference/MetadataAttributesRef/Reference/CommonAttrs.html">&#8220;common metadata attribute key&#8221;</a>. This means that Apple has reserved some metadata keywords that all application developers should use because they are common enough that some consistency is useful. Application developers will also develop their own dictionaries of keywords for their particular application.</p>
<p>In addition, an indexing process grabs the <strong>content</strong> of your files based on an <a href="http://www.apple.com/downloads/macosx/spotlight/">importer</a> tailored to the individual application. What is unclear is how the balance of keywords and indexing will play out. If you play with the <strong>mdls</strong> command line it is clear that the keyword store is much smaller than the matching indexed content which appears to be just a really large string. I&#8217;ll be reporting back with more research as I learn more.<br />
I&#8217;ll go into more detail about metadata in future posts, but if you want to do your own research in the meantime, John Siracusa has a pretty <a href="http://arstechnica.com/reviews/os/metadata.ars">definitive article </a>at <a href="http://arstechnica.com/">arstechnica</a>.</p>
<p>So great, we&#8217;ll just grab the <strong>Final Cut Pro</strong> metadata importer and we&#8217;re on our way. uh, umm, well&#8230;there <strong>isn&#8217;t</strong> a FCP importer at this point. I&#8217;m sure we&#8217;ll see one soon enough, but in the meantime there are some workarounds. If we feed a file to <strong>mdimport -d1 -f</strong> on the command line we find out some interesting stuff. <strong>mdimport</strong> is the command line spotlight indexer. The <strong>-d1</strong> flag tells it to output the type and which mdimporter is being used and the <strong>-f</strong> flag forces that file to be updated no matter what indexing rules are set.</p>
<p>Which importer is used is based on something called &#8220;<a href="http://developer.apple.com/macosx/uniformtypeidentifiers.html">Uniform Type Identifiers</a>&#8221; . UTI&#8217;s, despite their <a href="http://en.wikipedia.org/wiki/Urinary_tract_infection">unfortunate name</a>, are really an advance in how files are handled. It&#8217;s like a file extension, but much more. While we&#8217;re waiting for the FCP importer we&#8217;re going to use an xml importer for our <strong>mdimport</strong>. The one I&#8217;m working with right now is <a href="http://media.wiley.com/product_ancillary/5X/07645834/DOWNLOAD/20.%20Spotlight%20for%20XML.zip">here</a>. It&#8217;s from a Wiley book called <a href="http://www.amazon.com/exec/obidos/redirect?link_code=ur2&#038;tag=creativeworkf-20&#038;camp=1789&#038;creative=9325&#038;path=http%3A%2F%2Fwww.amazon.com%2Fgp%2Fproduct%2F076458345X%2Fsr%3D1-1%2Fqid%3D1147191871%2Fref%3Dsr_1_1%3F%255Fencoding%3DUTF8">Hacking Mac OSX Tiger</a><img width="1" height="1" border="0" style="border: medium none  ! important; margin: 0px ! important" src="http://www.assoc-amazon.com/e/ir?t=creativeworkf-20&#038;l=ur2&#038;o=1" />. (note)The one caveat if you build this yourself is to make sure you do a <strong>development</strong> style build in Xcode, not a <strong>deployment</strong> style build. There are some broken dependencies in the <strong>deployment</strong> style.</p>
<p>We build the <strong>mdimporter</strong> above, move it to <strong>/Library/Spotlight</strong>, run our <strong>mdimport -d1 -f</strong> on a test FCP-XML file and search with <strong>mdfind /path/to/our/file | grep xml</strong> and&#8230;wow. It worked.</p>
<p>We could then run something like:</p>
<p><code>    </code></p>
<pre>var selectedItems = app.project.selection;
var selectedFootage = new Array();

for (var i = 0; i < selectedItems.length; i++){
if (selectedItems[i].typeName == "Footage"){
selectedFootage[selectedFootage.length] = selectedItems[i];
}
}
for(var x= 0; x < selectedFootage.length; x++){
var file = String(selectedFootage[x].file);
var osString = "mdfind '" +  file +  "' | grep xml";

var xml = system.callSystem(osString);
var osString = "./qtFileInfo -x " + xml + " -f " + file;
var timecodeRef = system.callSystem(osString);

return timeCodeRef;
}</pre>
<p>from After Effects. where <strong>qtFileInfo</strong> had an Xquery like so:</p>
<pre>for  $i in //clipitem/file   where contains($i/pathurl, $file)
return $i</pre>
<p>This would match all of the node for the captured clip, including the source tape time code. My initial experiments have been very promising. I'm putting this out there as a sort of "sanity check" to see if I've missed anything. Off the top of my head, I can see us matching on multiple xml files, duplicating file paths, etc. but I think these things could be sorted out. It would be much like <strong>guess 3:2 pulldown</strong>, you occasionally miss your guess, but your right enough to be useful. We'll also need to develop an indexing workflow. I'm thinking a <strong>launchd</strong> chron job with <strong>smart folders</strong> or perhaps an <strong>automator</strong> set up.<br />
I'm not putting up any files until I've done a bit more research, figured out a useful gui and gotten some feedback on gotchas, but I thought i'd put this out there to document the thought process I'm going through. Hope you find it useful.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-1255425405534744";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "336699";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
//--></script><br />
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.creative-workflow-hacks.com/2006/05/09/moving-toward-reading-fcp-source-timecode-from-imported-quicktimes-in-after-effects/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
