<?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>TikiRobot! &#187; commandline</title>
	<atom:link href="http://www.tikirobot.net/wp/tag/commandline/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tikirobot.net/wp</link>
	<description>Mai Tais and Blinky Lights, Ahoy!</description>
	<lastBuildDate>Wed, 01 Feb 2012 22:14:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Hardware volume key support on XFCE</title>
		<link>http://www.tikirobot.net/wp/2010/07/20/hardware-volume-key-support-on-xfce/</link>
		<comments>http://www.tikirobot.net/wp/2010/07/20/hardware-volume-key-support-on-xfce/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 18:21:09 +0000</pubDate>
		<dc:creator>shag</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[beats]]></category>
		<category><![CDATA[code code]]></category>
		<category><![CDATA[commandline]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/?p=3165</guid>
		<description><![CDATA[XFCE4 from Debian unstable (&#8220;sid&#8221;) does not seem to bind the hardware volume-up, volume-down, and mute keyboard buttons on my ThinkPad to any actions.  It&#8217;s convenient to be able to control the sound card with these dedicated buttons &#8211; no twiddling around with the mouse to reach for a volume slider when NWA hits your playlist [...]]]></description>
			<content:encoded><![CDATA[<p>XFCE4 from Debian unstable (&#8220;sid&#8221;) does not seem to bind the hardware volume-up, volume-down, and mute keyboard buttons on my ThinkPad to any actions.  It&#8217;s convenient to be able to control the sound card with these dedicated buttons &#8211; no twiddling around with the mouse to reach for a volume slider when NWA hits your playlist and the boss walks over.  I suppose this is just a rough edge with the current XFCE integration; Gnome seems to handle this pretty well out of the box, but then again, Gnome is a bloated pig compared to XFCE.  So here&#8217;s one way to make the buttons work in XFCE.</p>
<p>First, you&#8217;ll need to make sure some prerequisite packages are installed: the package that provides the &#8220;amixer&#8221; binary, and some variant of awk.  Open an XFCE terminal window by clicking on the XFCE &#8220;mouse&#8221; logo in the XFCE panel, then clicking &#8220;Terminal&#8221;.  Become root by running the following and entering your root password:</p>
<p><code><br />
su -<br />
</code></p>
<p>Then install the appropriate packages &#8212; here&#8217;s how to do it in Debian:</p>
<p><code><br />
apt-get install alsa-utils mawk<br />
</code></p>
<p>Once the packages are installed, drop root privileges:</p>
<p><code><br />
exit<br />
</code></p>
<p>Then let&#8217;s pick a place for our scripts to live.  This example will assume that they will go into a &#8216;bin&#8217; directory underneath your home directory; so, let&#8217;s make sure that exists:</p>
<p><code><br />
mkdir ~/bin<br />
</code></p>
<p>Now, on to the scripts. Copy and paste the following script as &#8220;~/bin/alsa-toggle-mute&#8221;.  Probably the easiest way to do this with a stock Debian system is to start the &#8216;nano&#8217; editor with:</p>
<p><code><br />
nano ~/bin/alsa-toggle-mute<br />
</code></p>
<p>highlighting the script below, and then using your middle mouse button to paste the script into the nano terminal window, then using &#8220;Ctrl-x y ENTER&#8221; to save the file:</p>
<p><code><br />
&#35;!/bin/sh<br />
&#35;<br />
&#35; alsa-toggle-mute<br />
&#35;<br />
&#35;#########################################################<br />
&#35;<br />
&#35; AMIXER: path to your 'amixer' binary<br />
AMIXER=/usr/bin/amixer<br />
&#35;<br />
&#35; CONTROL: sound card control to adjust: run 'amixer' to find this<br />
CONTROL="Master,0"<br />
&#35;<br />
&#35; LEVELKEY: pattern on 'amixer' output lines to search for that provides<br />
&#35;           the current control level<br />
LEVELKEY=Mono:<br />
&#35;<br />
&#35;#########################################################<br />
&#35;<br />
$AMIXER sset $CONTROL \<br />
`$AMIXER sget $CONTROL |<br />
awk "(/$LEVELKEY/) { if (\\$NF == \\"[on]\\") { print \\"mute\\" } else { print \\"unmute\\" } }"` &gt; /dev/null<br />
</code></p>
<p>Make the script executable:</p>
<p><code><br />
chmod 700 ~/bin/alsa-toggle-mute<br />
</code></p>
<p>Then attach it to the hardware mute button with the XFCE keyboard settings manager GUI.  Click on the XFCE &#8220;mouse&#8221; logo that should be on the edge of your XFCE panel; click &#8220;Settings&#8221; from the pop-up menu; then click &#8220;Keyboard&#8221;.  Click on the &#8220;Application Shortcuts&#8221; tab.  Then click &#8220;Add&#8221;.  XFCE will ask for a path to the command; enter the full path to your alsa-toggle-mute script, e.g., &#8220;/home/username/bin/alsa-toggle-mute&#8221; &#8212; of course, you will have to substitute your username in that command.  XFCE will then pop up a box waiting for the &#8220;Command Shortcut&#8221; &#8212; at this point, press your hardware mute button.</p>
<p>That should be it! Your mute button should now work.</p>
<p>Now let&#8217;s add support for the volume-up button.  Save this script to &#8220;~/bin/alsa-volume-up&#8221;:</p>
<p><code><br />
&#35;!/bin/sh<br />
&#35;<br />
&#35; alsa-volume-up<br />
&#35;<br />
&#35;#########################################################<br />
&#35;<br />
&#35; OFFSET: amount to increment/decrement the control level: e.g., -1<br />
&#35;         decrements the volume, 1 increments the volume; values with<br />
&#35;         a greater absolute magnitude will decrement or increment the<br />
&#35;         control level more quickly.  Use "$1" if you wish to pass<br />
&#35;         the offset in from command line parameters<br />
OFFSET=1<br />
&#35;<br />
&#35; AMIXER: path to your 'amixer' binary<br />
AMIXER=/usr/bin/amixer<br />
&#35;<br />
&#35; CONTROL: sound control to adjust: run 'amixer' to find this<br />
CONTROL="Master,0"<br />
&#35;<br />
&#35; LEVELKEY: pattern on 'amixer' output lines to search for that provides<br />
&#35;           the current control level<br />
LEVELKEY=Mono:<br />
&#35;<br />
&#35; LEVELFIELD: awk field number of the current control level<br />
LEVELFIELD=3<br />
&#35;<br />
&#35;#########################################################<br />
&#35;<br />
$AMIXER sset $CONTROL \<br />
`$AMIXER sget $CONTROL | \<br />
awk "(/$LEVELKEY/) { print \\$$LEVELFIELD + $OFFSET }"` &gt; /dev/null<br />
</code></p>
<p>Make it executable:</p>
<p><code><br />
chmod 700 ~/bin/alsa-volume-up<br />
</code></p>
<p>Attach it to the hardware volume up button by following the same instructions as for the mute script (above), but in place of &#8220;/home/username/bin/alsa-toggle-mute&#8221;, use &#8220;/home/username/bin/alsa-volume-up&#8221;.  And rather than pressing the hardware mute button, press the hardware volume up button.</p>
<p>Then let&#8217;s handle the hardware volume down button.  This time we will take a shortcut.  Rather than copying and pasting another script, we&#8217;ll just copy and edit the volume-up script that you&#8217;ve already saved:</p>
<p><code><br />
cp ~/bin/alsa-volume-up ~/bin/alsa-volume-down<br />
</code></p>
<p>Then edit the ~/bin/alsa-volume-down script in nano to change the line that reads &#8220;OFFSET=1&#8243; to &#8220;OFFSET=-1&#8243;:</p>
<p><code><br />
nano ~/bin/alsa-volume-down<br />
</code></p>
<p>.. edit the script, then use &#8220;CTRL-x y ENTER&#8221; to save.</p>
<p>Then, as before, attach the script to the hardware volume down button by following the same instructions as for the mute script (above), but in place of &#8220;/home/username/bin/alsa-toggle-mute&#8221;, use &#8220;/home/username/bin/alsa-volume-down&#8221;.  And rather than pressing the hardware mute button, press the hardware volume down button.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2010/07/20/hardware-volume-key-support-on-xfce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to automate installs of Sun Java 6 on Ubuntu using cli</title>
		<link>http://www.tikirobot.net/wp/2009/01/12/how-to-automate-installs-of-sun-java-6-on-ubuntu-using-cli/</link>
		<comments>http://www.tikirobot.net/wp/2009/01/12/how-to-automate-installs-of-sun-java-6-on-ubuntu-using-cli/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 22:10:21 +0000</pubDate>
		<dc:creator>rajbot</dc:creator>
				<category><![CDATA[commandline]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[sucky companies]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/?p=2230</guid>
		<description><![CDATA[I couldn&#8217;t figure this out, so Andy had to help me.. Thanks Andy! Hopefully in the future we can use open-source, gpl&#8217;ed java, but until then: /bin/echo -e 'sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true\nsun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true' &#124; sudo debconf-set-selections DEBIAN_FRONTEND=noninteractive apt-get --force-yes -qq install sun-java6-bin]]></description>
			<content:encoded><![CDATA[<p>I couldn&#8217;t figure this out, so Andy had to help me.. Thanks Andy!</p>
<p>Hopefully in the future we can use open-source, gpl&#8217;ed java, but until then:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true\nsun-java6-jre shared/accepted-sun-dlj-v1-1 boolean true'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> debconf-set-selections
<span style="color: #007800;">DEBIAN_FRONTEND</span>=noninteractive <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #660033;">--force-yes</span> <span style="color: #660033;">-qq</span> <span style="color: #c20cb9; font-weight: bold;">install</span> sun-java6-bin</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2009/01/12/how-to-automate-installs-of-sun-java-6-on-ubuntu-using-cli/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Compile FlowPlayer on Ubuntu 8.04</title>
		<link>http://www.tikirobot.net/wp/2008/05/28/how-to-compile-flowplayer-on-ubuntu-804/</link>
		<comments>http://www.tikirobot.net/wp/2008/05/28/how-to-compile-flowplayer-on-ubuntu-804/#comments</comments>
		<pubDate>Wed, 28 May 2008 23:33:07 +0000</pubDate>
		<dc:creator>rajbot</dc:creator>
				<category><![CDATA[video]]></category>
		<category><![CDATA[code code]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[flowplayer]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/?p=1587</guid>
		<description><![CDATA[Here is how I compiled FlowPlayer on Hardy: sudo apt-get install ant sudo apt-get install java-gcj-compat-dev #without java-gcj-compat-dev, ant throws this error: Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-1.5.0-gcj-4.2-1.5.0.0/lib/tools.jar &#160; sudo apt-get install mtasc &#160; #need old version of swfmill; version in repo is 0.2.12 wget http://swfmill.org/releases/swfmill-0.2.11.tar.gz tar xvzf swfmill-0.2.11.tar.gz cd swfmill-0.2.11 [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how I compiled <a href="http://flowplayer.org/">FlowPlayer</a> on Hardy:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ant
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> java-gcj-compat-dev
<span style="color: #666666; font-style: italic;">#without java-gcj-compat-dev, ant throws this error: Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-1.5.0-gcj-4.2-1.5.0.0/lib/tools.jar</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> mtasc
&nbsp;
<span style="color: #666666; font-style: italic;">#need old version of swfmill; version in repo is 0.2.12</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>swfmill.org<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span>swfmill-0.2.11.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf swfmill-0.2.11.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> swfmill-0.2.11
.<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #666666; font-style: italic;">#install in /usr/local/bin</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> ..
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>internap.dl.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>sourceforge<span style="color: #000000; font-weight: bold;">/</span>flowplayer<span style="color: #000000; font-weight: bold;">/</span>flowplayer-<span style="color: #000000;">2.2</span>-src.zip
<span style="color: #c20cb9; font-weight: bold;">unzip</span> flowplayer-<span style="color: #000000;">2.2</span>-src.zip
<span style="color: #7a0874; font-weight: bold;">cd</span> flowplayer-src
emacs build.properties <span style="color: #666666; font-style: italic;">#edit DEPLOY_DIR</span>
ant</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2008/05/28/how-to-compile-flowplayer-on-ubuntu-804/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to tunnel VPN over SSH</title>
		<link>http://www.tikirobot.net/wp/2008/02/12/how-to-tunnel-vpn-over-ssh/</link>
		<comments>http://www.tikirobot.net/wp/2008/02/12/how-to-tunnel-vpn-over-ssh/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 00:43:11 +0000</pubDate>
		<dc:creator>rajbot</dc:creator>
				<category><![CDATA[archive]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[vnc]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/2008/02/12/how-to-tunnel-vpn-over-ssh/</guid>
		<description><![CDATA[Today I had to use VNC to debug a remote machine, but firewalls were blocking VNC ports. After I failed to get my VNC client (Chicken of the VNC) to use a SOCKS proxy, I was able to use SSH port forwarding to get it working. On your local machine type: ssh user@remotehost -L 5900/localhost/5900 [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had to use VNC to debug a remote machine, but firewalls were blocking VNC ports.</p>
<p>After I failed to get my VNC client (Chicken of the VNC) to use a SOCKS proxy, I was able to use SSH port forwarding to get it working. On your local machine type:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> user<span style="color: #000000; font-weight: bold;">@</span>remotehost <span style="color: #660033;">-L</span> <span style="color: #000000;">5900</span><span style="color: #000000; font-weight: bold;">/</span>localhost<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5900</span></pre></div></div>

<p>This forwards port 5900 on localhost to port 5900 on the remotehost. Then in Chicken of the VNC, open a new connection to localhost. That&#8217;s it! EEZ!</p>
<p>It turned out that Xorg was eating all available memory and invoking the oom killer. Sigh.</p>
<p>I guess I could have figured this out without VNC, but I couldn&#8217;t reproduce the bug locally, so I watched as a remote user was working on the machine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2008/02/12/how-to-tunnel-vpn-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Quickly Find the Size of an Image</title>
		<link>http://www.tikirobot.net/wp/2007/12/20/how-to-quickly-find-the-size-of-an-image/</link>
		<comments>http://www.tikirobot.net/wp/2007/12/20/how-to-quickly-find-the-size-of-an-image/#comments</comments>
		<pubDate>Thu, 20 Dec 2007 23:38:08 +0000</pubDate>
		<dc:creator>rajbot</dc:creator>
				<category><![CDATA[code code]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[exiftool]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[identify]]></category>
		<category><![CDATA[ImageMagick]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/2007/12/20/how-to-quickly-find-the-size-of-an-image/</guid>
		<description><![CDATA[To find the size of an image, I usually use ImageMagick&#8217;s identify command. Unfortuantely, identify is horribly slow, especially for JPEG 2000 images (thanks to a very slow libjasper). So instead of using identify: identify -format "%wx%h" image.jp2 Use exiftool instead: exiftool -s -s -s -ImageSize image.jp2 exiftool is 62.5 times faster(!!!) than identify for [...]]]></description>
			<content:encoded><![CDATA[<p>To find the size of an image, I usually use ImageMagick&#8217;s identify command. Unfortuantely, identify is horribly slow, especially for JPEG 2000 images (thanks to a very slow libjasper).</p>
<p>So instead of using identify:<br />
<code>identify -format "%wx%h" image.jp2</code></p>
<p>Use exiftool instead:<br />
<code>exiftool -s -s -s -ImageSize image.jp2</code></p>
<p>exiftool is 62.5 times faster(!!!) than identify for finding image size on my dual 2.0Ghz Athlon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2007/12/20/how-to-quickly-find-the-size-of-an-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Timelapse: OSS Secrets</title>
		<link>http://www.tikirobot.net/wp/2007/11/17/timelapse-oss-secrets/</link>
		<comments>http://www.tikirobot.net/wp/2007/11/17/timelapse-oss-secrets/#comments</comments>
		<pubDate>Sat, 17 Nov 2007 18:40:46 +0000</pubDate>
		<dc:creator>peliom</dc:creator>
				<category><![CDATA[photos]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[jhead]]></category>
		<category><![CDATA[timelapse]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/2007/11/17/timelapse-oss-secrets/</guid>
		<description><![CDATA[I thought I would share a couple of helpful GPL command lines that really get the job done if you want to animate a sequence of images. First (via Mike) is news of the jhead project. Unbelievably the ImageCapture.app application that ships with Mac OS X cannot handle more than several thousand images. ImageCapture.app will [...]]]></description>
			<content:encoded><![CDATA[<p>I thought I would share a couple of helpful GPL command lines that really get the job done if you want to animate a sequence of images.</p>
<p>
First (via Mike) is news of the <a href="http://www.sentex.net/~mwandel/jhead/">jhead</a> project.  Unbelievably the ImageCapture.app application that ships with Mac OS X cannot handle more than several thousand images.  ImageCapture.app will copy all of the image files, but the number sequence wraps around and it overwrites thousands of the earlier images in the sequence!!  <a href="http://www.sentex.net/~mwandel/jhead/">jhead</a> fixes all that by renaming all of the image files based on the EXIF timestamp in the JPG file.  brilliant!  Here is the commandline he recommends:</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">jhead -nfpx<span style="color: #000000; font-weight: bold;">%</span>Y<span style="color: #000000; font-weight: bold;">%</span>m<span style="color: #000000; font-weight: bold;">%</span>d-<span style="color: #000000; font-weight: bold;">%</span>H<span style="color: #000000; font-weight: bold;">%</span>M<span style="color: #000000; font-weight: bold;">%</span>S <span style="color: #660033;">-dt</span> <span style="color: #660033;">-ft</span> <span style="color: #007800;">$*</span></pre></div></div>

<p>
Now you have a nifty sequence of hopefully hi-res images.  One of the cool things about timelapse is you can shoot 5 megapixel images and then scale them down to NTSC (720&#215;480) or HD (1920&#215;1024) resolution.  In fact if some crazy 5 megapixel video format comes out 10 years from now, you will be able to support that as well! (As an aside, the <a href="http://www.dolby.com/professional/motion_picture/solutions_digitalcinemas.html">Digital Cinema</a> releases that are dribbling out to theaters these days are at 2,000 pixels wide.  Eventually that will go up to 4,000 pixels wide, but there are not currently projectors that can support that resolution!)</p>
<p>
So anyway, megapixels.  How do you scale the images without fudging it up?  A little known fact is that most video that looks crappy because of &#8220;the video compression&#8221; actually looks crappy because of the way the video was scaled down to its postage stamp resolution.  So here is what you do: Use the fantastic <a href="http://www.imagemagick.org/">ImageMagick</a> &#8220;convert&#8221; command to scale your images down at even higher quality than photoshop! for free! and without using a dumb GUI scripting language.  You can read about image scaling in <a href="http://www.xs4all.nl/~bvdwolf/main/foto/down_sample/down_sample.htm">laborious detail</a> or you can just use this command line:</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">convert  <span style="color: #660033;">-filter</span> sinc <span style="color: #660033;">-resize</span> 720x480 foo.JPG foo_ntsc.JPG</pre></div></div>

<p>
I put the following bash script into a makefile to process my timelapse library:</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*</span>; <span style="color: #000000; font-weight: bold;">do</span>  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>  <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span>/ntsc_jpg/&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>  <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span>/ntsc_jpg&quot;</span>; <span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> orig_jpg<span style="color: #000000; font-weight: bold;">/*</span>.JPG; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$i</span>; <span style="color: #7a0874; font-weight: bold;">echo</span> convert  <span style="color: #660033;">-filter</span> sinc <span style="color: #660033;">-resize</span> 720x480 ntsc_jpg<span style="color: #000000; font-weight: bold;">/`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #007800;">$i</span><span style="color: #000000; font-weight: bold;">`</span>;  <span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">fi</span> <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>And finally I would like to share the &#8220;ghetto HD&#8221; format that VJ Science came up with for doing 16:9 format on an XGA projector.  This command includes cropping to get my 1600&#215;1200 images into 16:9 aspect ratio &#8230; if you have a different source resolution, I&#8217;m going to leave it to you multiply your image width by 9 and divide by 16 to figure out the how many pixels to crop on top and bottom.  The idea is to crop first and then scale down.  Although I guess in terms of quality it doesn&#8217;t matter the order.</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">convert  <span style="color: #660033;">-crop</span> 1600x900+<span style="color: #000000;">0</span>+<span style="color: #000000;">150</span> <span style="color: #660033;">-filter</span> sinc <span style="color: #660033;">-resize</span> 1024x576 foo.JPG foo_xga.JPG</pre></div></div>

<p>
Now you&#8217;ve got a nifty sequence of beautifully scaled images.  Time to make video!  Which of the <a href="http://www.fourcc.org/codecs.php">7 bajillion </a> video codecs are you going to use?  My recommendation is to use <a href="http://ffmpeg.mplayerhq.hu/">ffmpeg</a> to make an mpeg-2 &#8220;master&#8221; that you can distribute by uploading to youtube, archive.org, and so on.  ffmpeg understands image sequences! So here is a quick way to get your mpeg-2 video (no audio).  This command assumes your images are named like &#8220;IMG_0001.JPG&#8221; and so on &#8230; I know that doesn&#8217;t jive with the <a href="http://www.sentex.net/~mwandel/jhead/">jhead</a> naming I&#8217;ve outlined above, but you are a <a href="http://blackhole.sk/big-unix-haxor">big unix haxor</a> and can figure that out.</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ffmpeg</span>  <span style="color: #660033;">-i</span> <span style="color: #ff0000;">&quot;IMG_%04d.JPG&quot;</span> <span style="color: #660033;">-b</span> <span style="color: #000000;">10000</span> test.m2v</pre></div></div>

<p>
For my purpose I am building up a video library for doing VJ/video mixing stuff.  In this use case video quality and decode speed is much more important than bitrate.  Since decoding mpeg-2 &#8220;I&#8221; frames is about 3x faster than decoding &#8220;P&#8221; or &#8220;B&#8221; (difference) frames I use this command to get a high quality I-frame only mpeg-2 stream:</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ffmpeg</span>  <span style="color: #660033;">-i</span> <span style="color: #ff0000;">&quot;IMG_%04d.JPG&quot;</span> <span style="color: #660033;">-vcodec</span> mpeg2video <span style="color: #660033;">-intra</span> <span style="color: #660033;">-qscale</span> <span style="color: #000000;">4</span> test.m2v</pre></div></div>

<p>
You can get higher quality by dropping qscale down even lower, but I think if you do qscale=1 your video basically won&#8217;t be compressed at all :-)  rajbot?</p>
<p>
So there you have it! The basics of an Open Source timelapse production pipeline.  I use these tools on <a href="http://finkproject.org/">Mac OS X</a>.  Of course they are available on <a href="http://www.gnu.org/gnu/linux-and-gnu.html">GNU/Linux</a>.  And you can also get them working under windows using <a href="http://www.cygwin.com/">Cygwin</a> &#8230; We need more timelapse!</p>
<p>
<a href="http://www.sentex.net/~mwandel/jhead/">Link</a> to jhead project<br />
<a href="http://www.imagemagick.org/">Link</a> to ImageMagick project<br />
<a href="http://ffmpeg.mplayerhq.hu/">Link</a> to FFmpeg project</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2007/11/17/timelapse-oss-secrets/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to quickly convert a bunch of JPEG2000s to JPEGs</title>
		<link>http://www.tikirobot.net/wp/2007/11/13/how-to-quickly-convert-a-bunch-of-jpeg2000s-to-jpegs/</link>
		<comments>http://www.tikirobot.net/wp/2007/11/13/how-to-quickly-convert-a-bunch-of-jpeg2000s-to-jpegs/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 21:18:58 +0000</pubDate>
		<dc:creator>rajbot</dc:creator>
				<category><![CDATA[code code]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[jpeg]]></category>
		<category><![CDATA[jpeg2000]]></category>
		<category><![CDATA[kakadu]]></category>
		<category><![CDATA[mogrify]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/2007/11/13/how-to-quickly-convert-a-bunch-of-jpeg2000s-to-jpegs/</guid>
		<description><![CDATA[Let&#8217;s say you have a directory full of jp2 files, and you want to convert them to jpg. The usual way of doing something like this is to use ImageMagick&#8217;s mogrify command: mogrify -format jpg *.jp2 ImageMagick uses JasPer to decompress the jp2, and it is unbelievably slow. If you want to do the same [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you have a directory full of jp2 files, and you want to convert them to jpg. The usual way of doing something like this is to use <a href="http://www.imagemagick.org">ImageMagick&#8217;s</a> mogrify command:<br />
<code>mogrify -format jpg *.jp2</code><br />
ImageMagick uses <a href="http://www.ece.uvic.ca/~mdadams/jasper/">JasPer</a> to decompress the jp2, and it is unbelievably slow. If you want to do the same conversion, but five times faster, use the free <a href="http://www.kakadusoftware.com/">Kakadu</a> software instead. </p>
<p>Here is a script that will quickly convert the jp2s in the current directory to jpegs. You will have to edit the paths to the Kakadu binary and library.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #483d8b;">&quot;&quot;&quot;
mogrify -format jpg *.jp2 is taking 24.5 seconds/image.
The same jp2-&gt;jpg process takes 4.5 seconds/image on the same box when using 
Kakadu, even when creating a temporary ppm file.
&nbsp;
You can get the free Kakadu binary here:
http://www.kakadusoftware.com/
&nbsp;
This script operates on jp2 files in the current dir.
&quot;&quot;&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">commands</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">glob</span>
&nbsp;
files = <span style="color: #dc143c;">glob</span>.<span style="color: #dc143c;">glob</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;*.jp2&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> <span style="color: #008000;">file</span> <span style="color: #ff7700;font-weight:bold;">in</span> files:
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Processing &quot;</span> + <span style="color: #008000;">file</span>
&nbsp;
    <span style="color: #dc143c;">cmd</span> = <span style="color: #483d8b;">&quot;LD_LIBRARY_PATH=/usr/local/lib/kakadu /usr/local/bin/kdu_expand -i %s -o tmp.ppm&quot;</span> <span style="color: #66cc66;">%</span><span style="color: black;">&#40;</span><span style="color: #008000;">file</span><span style="color: black;">&#41;</span>    
    retval = <span style="color: #dc143c;">commands</span>.<span style="color: black;">getstatusoutput</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">cmd</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">assert</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span> == retval<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #dc143c;">cmd</span> = <span style="color: #483d8b;">&quot;pnmtojpeg tmp.ppm &gt; %s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span><span style="color: #008000;">file</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.jp2'</span>, <span style="color: #483d8b;">'.jpg'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    retval = <span style="color: #dc143c;">commands</span>.<span style="color: black;">getstatusoutput</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">cmd</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">assert</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span> == retval<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">os</span> <span style="color: #ff7700;font-weight:bold;">import</span> unlink
unlink<span style="color: black;">&#40;</span><span style="color: #483d8b;">'tmp.ppm'</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2007/11/13/how-to-quickly-convert-a-bunch-of-jpeg2000s-to-jpegs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Timer for OS X</title>
		<link>http://www.tikirobot.net/wp/2007/06/03/simple-timer-for-os-x/</link>
		<comments>http://www.tikirobot.net/wp/2007/06/03/simple-timer-for-os-x/#comments</comments>
		<pubDate>Sun, 03 Jun 2007 17:15:34 +0000</pubDate>
		<dc:creator>rajbot</dc:creator>
				<category><![CDATA[commandline]]></category>
		<category><![CDATA[lifehacking]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/2007/06/03/simple-timer-for-os-x/</guid>
		<description><![CDATA[Jess needed a simple timer that would beep after 10 minutes, and asked if one shipped with OS X. Sadly, there isn&#8217;t one, and my first thought was to search VersionTracker for a timer. But I was feeling lazy and didn&#8217;t want to have to test 50 different crappy timers written in RealBasic and another [...]]]></description>
			<content:encoded><![CDATA[<p>Jess needed a simple timer that would beep after 10 minutes, and asked if one shipped with OS X. Sadly, there isn&#8217;t one, and my first thought was to search VersionTracker for a timer. But I was feeling lazy and didn&#8217;t want to have to test 50 different crappy timers written in RealBasic and another fifty MyFirstCocoaApp projects. Also, I was feeling too cheap to shell out $50 for EnterpriseTimer.jar.</p>
<p>My next thought was to just echo ^G (the beep character) in Terminal after sleeping for 10 minutes, but how was I going to explain to Jess that you have to type &#8216;echo control-v control-g&#8217; to put the beep character on the command line? So on a lark I tried typing &#8216;say beep&#8217; on the command line and it worked.</p>
<p>So here is your absolutely free 10 minute timer for OS X. Launch Terminal, which is the Utilities Folder inside your Applications folder, and copy/paste this line into the command line:</p>
<blockquote><pre>sleep 600; say beep</pre>
</blockquote>
<p>Hit return to start the timer. When it&#8217;s done, you can start another one by hitting the up-arrow and then hitting return. 600 is the number of seconds to sleep, and you can change this to be larger or smaller.</p>
<p>From across the living room I occasionally hear Jess&#8217; mac saying &#8216;beep&#8217; in the Vicki voice. It&#8217;s very cute :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2007/06/03/simple-timer-for-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to render text using HTML Canvas</title>
		<link>http://www.tikirobot.net/wp/2007/02/28/how-to-render-text-using-html-canvas/</link>
		<comments>http://www.tikirobot.net/wp/2007/02/28/how-to-render-text-using-html-canvas/#comments</comments>
		<pubDate>Wed, 28 Feb 2007 22:59:30 +0000</pubDate>
		<dc:creator>rajbot</dc:creator>
				<category><![CDATA[typography]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[code code]]></category>
		<category><![CDATA[commandline]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/2007/02/28/how-to-render-text-using-html-canvas/</guid>
		<description><![CDATA[I&#8217;ve been using HTML5 Canvas for a few web apps, and for the last year I&#8217;ve been avoiding rendering any text because Canvas lacks text support. Over the last year, several people have come up with workarounds. Firefox decided to add a non-standard method called drawWindow(), which lets you composite a hidden iframe with html [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using HTML5 Canvas for a few web apps, and for the last year I&#8217;ve been avoiding rendering any text because Canvas lacks text support. Over the last year, several people have come up with workarounds.</p>
<ul>
<li>Firefox decided to add <a href="http://developer.mozilla.org/en/docs/Drawing_Graphics_with_Canvas#Rendering_Web_Content_Into_A_Canvas">a non-standard method called drawWindow()</a>, which lets you composite a hidden iframe with html text.
<li>The <a href="http://osteele.com/sources/javascript/docs/textcanvas">TextCanvas project</a> adds a drawString method to the canvas api, which positions a HTML element on top of the canvas.
<li>The <a href="http://www.random.abrahamjoffe.com.au/public/JavaScripts/canvas/fonts.htm">Variable Width Canvas Fonts</a> project pre-generates an image containing characters at known locations and then uses drawImage to display the necessary characters.
<li>The very cool <a href="http://canvaspaint.org">CanvasPaint</a> project went nuts and <a href="http://canvaspaint.org/font/postscript/">implemented vector fonts in canvas!</a> (more info <a href="http://canvaspaint.org/blog/2006/12/rendering-text/">here</a>)
<li>None of the above links work in Safari. Despite being the original developers of Canvas, Safari&#8217;s Canvas support is extremely buggy. Things work better with the nightly builds, but even then, many things are broken.
</ul>
<p>I&#8217;ve been thinking about giving up on supporting Safari completely, and maybe trying out <a href="http://dojotoolkit.org">dojo&#8217;s gfx 2D graphics API</a>, which has text support but uses SVG/VML instead of Canvas. For the time being though, I found a silly workaround. Since I only need to display numbers, I can just create 10 pngs, one for each digit. Here is a bash script that creates the number pngs using ImageMagick:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">i</span>=<span style="color: #000000;">0</span>;i<span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #000000;">10</span>;i++<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">do</span> 
     convert <span style="color: #660033;">-size</span> 75x100 xc:transparent <span style="color: #660033;">-quality</span> <span style="color: #000000;">100</span> <span style="color: #660033;">-font</span> Courier-Bold <span style="color: #660033;">-pointsize</span> <span style="color: #000000;">144</span> <span style="color: #660033;">-fill</span> green <span style="color: #660033;">-draw</span> <span style="color: #ff0000;">&quot;text -5,95 '<span style="color: #007800;">$i</span>'&quot;</span> g<span style="color: #007800;">$i</span>.png; 
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>Here&#8217;s a blurry screenshot of how it looks:<br />
<img id="image929" src="http://www.tikirobot.net/wp/wp-content/uploads/2007/02/6.jpg" alt="6.jpg" width="500" height="115"/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2007/02/28/how-to-render-text-using-html-canvas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The best WordPress theme ever!</title>
		<link>http://www.tikirobot.net/wp/2007/01/31/the-best-wordpress-theme-ever/</link>
		<comments>http://www.tikirobot.net/wp/2007/01/31/the-best-wordpress-theme-ever/#comments</comments>
		<pubDate>Thu, 01 Feb 2007 06:06:32 +0000</pubDate>
		<dc:creator>rajbot</dc:creator>
				<category><![CDATA[commandline]]></category>
		<category><![CDATA[old timers]]></category>

		<guid isPermaLink="false">http://www.tikirobot.net/wp/2007/01/31/the-best-wordpress-theme-ever/</guid>
		<description><![CDATA[This guy gave his WP blog a command-line interface! It&#8217;s really well done.. I love how even the graphics look like they are on a green monocrome display!]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.elinc.ca/rodcli/index.php">This guy gave his WP blog a command-line interface!</a> It&#8217;s really well done.. I love how even the graphics look like they are on a <a href="http://blog.elinc.ca/rodcli/index.php?p=292">green monocrome display</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tikirobot.net/wp/2007/01/31/the-best-wordpress-theme-ever/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

