<?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>Brett Terpstravideo - Brett Terpstra</title>
	<atom:link href="http://brettterpstra.com/tag/video/feed/" rel="self" type="application/rss+xml" />
	<link>http://brettterpstra.com</link>
	<description>Elegant solutions to complex problems.</description>
	<lastBuildDate>Thu, 09 Feb 2012 15:01:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Seriously easy HTML5 video encoding</title>
		<link>http://brettterpstra.com/seriously-easy-html5-video-encoding/</link>
		<comments>http://brettterpstra.com/seriously-easy-html5-video-encoding/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 18:38:39 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/seriously-easy-html5-video-encoding/</guid>
		<description><![CDATA[<p>I recently discovered an app which takes input video in various formats and encodes all of the necessary formats for cross-browser, cross-platform HTML5 video embedding. It even outputs the tags for you. It’s called, appropriately, Easy HTML5 Video. While I will probably continue to use my homebrew script for this, I wanted to mention it for anyone not really digging&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/seriously-easy-html5-video-encoding/">Seriously easy HTML5 video encoding</a></p>]]></description>
			<content:encoded><![CDATA[<p>I recently discovered an app which takes input video in various formats and encodes all of the necessary formats for cross-browser, cross-platform HTML5 video embedding. It even outputs the tags for you. It’s called, appropriately, <a href="http://easyhtml5video.com/">Easy HTML5 Video</a>.</p>

<p>While I will probably continue to use <a href="http://brettterpstra.com/automated-html5-video-encoding-revisited/">my homebrew script</a> for this, I wanted to mention it for anyone not really digging the command line approach. The lack of an app that could do an all-in-one batch encode for HTML5 video was what inspired my script in the first place. Easy HTML5 Video keeps things very, very simple. No quality adjustments or ffmpeg flags, just an output size setting and the option to publish the final videos to an FTP server.</p>

<p>Easy HTML5 Video is a cross-platform Java app. It’s not terribly pretty, but it works and the quality of output looks great on my tests. The free version puts a small logo on the output. It’s relatively unobtrusive, but if you want to remove it or replace it with your own logo, you’ll need to license the app: $49 for a single-website license, $69 for an unlimited license.</p>

<p>If you’re working with video these days, you need to be working with HTML5 formats. This makes it drop-dead easy. More info <a href="http://easyhtml5video.com/">on the website</a>.</p>

<p><strong>Addendum:</strong> As <a href="https://twitter.com/joeworkman/status/128183442021154817">Joe Workman pointed out on Twitter</a>, I should probably mention <a href="http://www.mirovideoconverter.com/">Miro</a> as a very flexible and free HTML5 video converter. However, the problem that Easy HTML5 Video solves for me is not flexibility or just the ability to handle the necessary formats, it’s the ability to drop one file in and automatically get out everything I need without manually setting up each format. Automation.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/automating-html5-video-encodes/' rel='bookmark' title='Automating HTML5 video encodes'>Automating HTML5 video encodes</a></li>
<li><a href='http://brettterpstra.com/quick-notes-on-cross-browser-html5-video/' rel='bookmark' title='Quick notes on cross-browser HTML5 video'>Quick notes on cross-browser HTML5 video</a></li>
<li><a href='http://brettterpstra.com/automated-html5-video-encoding-revisited/' rel='bookmark' title='Automated HTML5 video encoding revisited'>Automated HTML5 video encoding revisited</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/seriously-easy-html5-video-encoding/">Seriously easy HTML5 video encoding</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/seriously-easy-html5-video-encoding/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Fog In The Valley</title>
		<link>http://brettterpstra.com/fog-in-the-valley/</link>
		<comments>http://brettterpstra.com/fog-in-the-valley/#comments</comments>
		<pubDate>Sat, 10 Sep 2011 18:28:45 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2741</guid>
		<description><![CDATA[<p>As some of you may know, my wife Aditi and I moved into a new house last week. It’s been a crazy week of settling in, but it’s already starting to feel like home. As it turns out, I’m less opposed to weekend projects than I had thought I would be. I’m not exactly handy, but I’m learning as I&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/fog-in-the-valley/">Fog In The Valley</a></p>]]></description>
			<content:encoded><![CDATA[<p><img src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/09/morning_fog_in_the_valley.jpg?9d7bd4" alt="Morning fog in the Valley" /></p>

<p>As some of you may know, my wife Aditi and I <a href="http://brettterpstra.com/moving-day/">moved into a new house</a> last week. It’s been a crazy week of settling in, but it’s already starting to feel like home. As it turns out, I’m less opposed to weekend projects than I had thought I would be. I’m not exactly handy, but I’m learning as I go.</p>

<p>Our house is on one of the highest ridges in our town in the unglaciated<sup id="fnref:unglaciated"><a href="#fn:unglaciated" rel="footnote">1</a></sup> region of the <a href="http://maps.google.com/maps?ll=43.964156,-91.636963&amp;spn=0.445795,1.056747&amp;t=h&amp;z=11&amp;vpsrc=6&amp;lci=com.panoramio.all">Mississippi River Valley</a>. My office includes an eight-foot-wide sliding glass door that faces out onto the valley below, and the view is incredible. I watch the fog roll into the valley every morning, roil and roll over itself and then dissipate as the sun rises. It very well might be one of those things I never get bored with seeing, much like the rest of this gorgeous area.</p>

<p>I made a time-lapse video of the view from my porch using a Nikon D60 connected to my MacBook Air and DSLRemote on my iPhone. A few hundred snaps later, here’s the video…</p>

<p><span id="more-2741"></span></p>


  <!-- Begin Video.js -->
  <video class="video-js vjs-default-skin" width="600" height="338" poster="/share/video/FogInTheValley/FogInTheValleyPoster.jpg" controls 0 data-setup="{}">
    <source src="/share/video/FogInTheValley/FogInTheValley.mp4" type='video/mp4' />
    <source src="/share/video/FogInTheValley/FogInTheValley.webm" type='video/webm; codecs="vp8, vorbis"' />
    <source src="/share/video/FogInTheValley/FogInTheValley.ogv" type='video/ogg; codecs="theora, vorbis"' />
  </video>
  <!-- End Video.js -->


<div class="footnotes">
<hr />
<ol>

<li id="fn:unglaciated">
<p>It wasn’t flattened by glaciers. It’s a hard word to find a definition of, but I swear it’s a real word. <a href="#fnref:unglaciated" rev="footnote">↩</a></p>
</li>

</ol>
</div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/quick-notes-on-cross-browser-html5-video/' rel='bookmark' title='Quick notes on cross-browser HTML5 video'>Quick notes on cross-browser HTML5 video</a></li>
<li><a href='http://brettterpstra.com/an-average-morning/' rel='bookmark' title='An average morning'>An average morning</a></li>
<li><a href='http://brettterpstra.com/automating-html5-video-encodes/' rel='bookmark' title='Automating HTML5 video encodes'>Automating HTML5 video encodes</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/fog-in-the-valley/">Fog In The Valley</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/fog-in-the-valley/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Automated HTML5 video encoding revisited</title>
		<link>http://brettterpstra.com/automated-html5-video-encoding-revisited/</link>
		<comments>http://brettterpstra.com/automated-html5-video-encoding-revisited/#comments</comments>
		<pubDate>Sun, 01 May 2011 15:21:51 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2285</guid>
		<description><![CDATA[<p>A little while ago I approached the subject of scripting automated encoding for HTML5 video formats. I started using the process regularly as I built the Blogsmith Bundle video site. Pretty soon I got some help from friend and TUAW editor Mike Rose, and working together we refined the script and improved the speed tremendously. It was built for use&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/automated-html5-video-encoding-revisited/">Automated HTML5 video encoding revisited</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/05/html5automatorTV-small.jpg?9d7bd4" alt="HTML5 Automator" title="HTML5 Automator" width="328" height="257" class="alignright size-full wp-image-2296" />A little while ago I approached the subject of scripting <a href="http://brettterpstra.com/automating-html5-video-encodes/">automated encoding for HTML5 video formats</a>. I started using the process regularly as I built the <a href="http://bundle.weblogzinc.com/video/">Blogsmith Bundle video site</a>. Pretty soon I got some help from friend and TUAW editor <a href="http://www.tuaw.com/bloggers/michael-rose">Mike Rose</a>, and working together we refined the script and improved the speed tremendously. It was built for use on Mac OS X, but with just a few lines modified, it should work on any *NIX system.
<span id="more-2285"></span></p>

<h3>What it does</h3>

<p>The script is specifically designed to take an MPEG-4, H.264 file, move it to a new folder based on the filename, create WEBM and OGV versions of it in the new folder, and upload the whole folder to a server using <code>rsync</code>. SSH information and target directories are specified in the config at the top of the script. At the end, it takes what it knows about the files and filenames and creates a TextMate Markdown blog template, inserts the video shortcode for the <a href="http://wordpress.org/extend/plugins/videojs-html5-video-player-for-wordpress/">VideoJS WordPress plugin</a> (which is common syntax for other plugins as well) and opens it for editing in TextMate. The <code>rsync</code> command really needs <a href="http://www.rootsilver.com/2007/10/keyless-ssh-sshkeygen-setup-an">keyless SSH login</a> for this to be considered fully-automated.</p>

<p>If you run this script with <a href="http://www.noodlesoft.com/hazel.php">Hazel</a>, you can just render an <a href="http://en.wikipedia.org/wiki/H.264">H.264</a> video (<code>.mov</code> files that pass the H.264 test<sup id="fnref:fnh264"><a href="#fn:fnh264" rel="footnote">1</a></sup> will automatically be renamed to <code>.mp4</code>) to that folder from your screen-recording application of choice, sit back for a few minutes (or start writing the post) and wait for the pre-populated TextMate blog post to pop open. Then type or paste your text in, hit Control-Command-P (assuming you’re set up for TextMate-&gt;WordPress blogging) and your video is posted.</p>

<h3>Improvements</h3>

<p>The first thing that happened in this rewrite was a major simplification of the WEBM encoding process, which now only takes a third of the time it did before and the files are not significantly larger in most cases. They may even look better. The old command involved two passes, one of them turning out to be unnecessary; <code>ffmpeg</code> is smarter than I thought. The new command (using the variables from the script) is just <code>/usr/local/bin/ffmpeg -i "$FILENAME" -b 614400 -s $MAXSIZE -aspect 16:9 "$BASENAME".webm</code>.</p>

<p>I also added better logging, optional progress reports with <a href="http://growl.info/">Growl</a>, batch file handling and a few other refinements. The logging, if enabled in the config at the top, will output information including processing time for each file and total processing time to STDOUT (command line) and to the system log where you can watch it from Console. If you enable growl notifications, the messages at the beginning and end of each conversion will be “growled” on your screen.</p>

<h3>Using the script</h3>

<p>You’ll need a couple of additional utilities to do the conversions.</p>

<h4>Requirements</h4>

<p>To run the script and do the encoding, you’ll need <code>ffmpeg</code> and <code>ffmpeg2theora</code>. You can install <code>ffmpeg</code> from <a href="https://github.com/mxcl/homebrew">Homebrew</a> (<code>brew install ffmpeg</code>) quite easily, if you’re set up for that. You can also pull the binary out of <a href="http://www.ffmpegx.com/">ffmpegX</a> with a <a href="http://hints.macworld.com/article.php?story=20061220082125312">few simple steps</a>. You can, of course, <a href="http://troykelly.com/2007/01/18/building-ffmpeg-on-os-x/">build your own</a> if you have the developer tools installed.</p>

<p>ffmpeg2theora (needed for OGV conversion) no longer appears to be available from <code>brew</code>, but there are OS X binaries (and source) <a href="http://v2v.cc/~j/ffmpeg2theora/download.html">available for download</a>.</p>

<p>The <a href="#thescript">script is below</a>. You’ll want to modify the information in the configuration section at the top, and modify the template output at the bottom to suit your needs. Anything between <code>&lt;&lt;-POSTTEMPLATE</code> and <code>POSTTEMPLATE</code> is freeform text that you can edit in any way you like, including the use of $variables. If you’d rather do something such as copy a shortcode to your clipboard and show a Growl message, just use <code>pbcopy</code> and <code>growlnotify</code>. You could also just comment out the template part and let Hazel tell you when it’s done, if you want to handle things more manually. I’ll let you work out the details on that.</p>

<h4>Command line usage</h4>

<p>To use the script from the command line, save it as “html5encode.sh” somewhere in your path, change to its parent folder in Terminal and run <code>chmod a+x html5encode.sh</code>. The you can run it on any h.264 .mov or .mp4 file and it will handle the rest. It also handles batches, so you can specify multiple targets or use <code>*.mp4</code> to run it on all .mp4 files in a folder. It will process them one by one, creating new folders for each.</p>

<h4>Hazel</h4>

<p>If you want to run it with Hazel, you can follow the same procedure and set up a rule that runs a shell script when a .mov or .mp4 is detected in a watch folder. The script can then be run as a command or be pasted in its entirety into the Hazel script editor within the rule.</p>

<p>You should be able to pull off using this with OS X Folder Actions, as well, but I haven’t played with that yet.</p>

<p><strong>Bonus tip:</strong> <em>If you name your original .mov or .mp4 file with a CamelCased name, it will break apart the filename and create the title of your post based on it. Not an essential feature, but kind of nifty. Well, I think so anyway.</em></p>

<h3 id="thescript">The script</h3>

<p><a href="http://brettterpstra.com/share/html5encode.sh.txt">View Raw</a> | <a href="http://brettterpstra.com/share/html5encode.sh">Download</a></p>


<div class="wp_syntax"><div class="code"><pre class="bash"><span class="co0">#!/bin/bash</span>
<span class="co0">#################################################################</span>
<span class="co0">### html5encode.sh by Brett Terpstra and Mike Rose</span>
<span class="co0">### Published 05/01/2011</span>
<span class="co0">### Freely distributed, modifications welcomed (with attribution)</span>
<span class="co0">#################################################################</span>
<span class="co0">### Configuration ###############################################</span>
<span class="co0">#################################################################</span>
<span class="re2">MAXSIZE</span>=<span class="st0">&quot;960x540&quot;</span>
<span class="re2">DISPLAYWIDTH</span>=<span class="st0">&quot;600&quot;</span>
<span class="re2">DISPLAYHEIGHT</span>=<span class="st0">&quot;338&quot;</span>
<span class="re2">SSHURL</span>=<span class="st0">&quot;username@ssh.host.name&quot;</span>
<span class="re2">SSHDIR</span>=<span class="st0">&quot;/server/folder/target/for/rsync/&quot;</span>
<span class="re2">WEBDIR</span>=<span class="st0">&quot;/front-end/url/path/video/&quot;</span> <span class="co0"># used for blog template</span>
<span class="re2">LOGGING</span>=<span class="kw2">true</span> <span class="co0"># send status messages and times to STDOUT and syslog</span>
<span class="re2">GROWLLOG</span>=<span class="kw2">false</span> <span class="co0"># duplicate messages to growl, if installed</span>
<span class="co0">##################################################################</span>
<span class="co0">### END Configuration ############################################</span>
<span class="co0">##################################################################</span>
&nbsp;
<span class="co0"># function to handle logging (if enabled) to STDOUT and STDERR </span>
<span class="co0"># as well as Growl (if enabled)</span>
<span class="kw1">function</span> logit<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
  <span class="kw1">if</span> <span class="re1">$LOGGING</span> ; <span class="kw1">then</span>
    logger <span class="re5">-st</span> <span class="st0">&quot;HTML5 Encoder&quot;</span> <span class="st0">&quot;$1&quot;</span>
    <span class="kw1">if</span> <span class="re1">$GROWLLOG</span> ; <span class="kw1">then</span>
      <span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span>growlnotify <span class="re5">-t</span> <span class="st0">&quot;HTML5 Encoder&quot;</span> <span class="re5">-a</span> <span class="st0">&quot;Terminal&quot;</span> <span class="re5">-m</span> <span class="st0">&quot;$1&quot;</span>
    <span class="kw1">fi</span>
  <span class="kw1">fi</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="co0"># Count the inputs for log message</span>
<span class="kw1">if</span> <span class="br0">&#91;</span><span class="br0">&#91;</span> <span class="re4">$#</span> <span class="re5">-gt</span> <span class="nu0">1</span> <span class="br0">&#93;</span><span class="br0">&#93;</span>; <span class="kw1">then</span>
  logit <span class="st0">&quot;Starting batch conversion.&quot;</span>
  <span class="re2">maintimer1</span>=<span class="sy0">`</span><span class="kw2">date</span> <span class="st_h">'+%s'</span><span class="sy0">`</span>
<span class="kw1">else</span>
  logit <span class="st0">&quot;Starting HTML5 Encoder&quot;</span>
<span class="kw1">fi</span>
&nbsp;
<span class="co0"># Loop through each passed file</span>
<span class="kw1">for</span> <span class="kw2">file</span> <span class="kw1">in</span> <span class="st0">&quot;$@&quot;</span>; <span class="kw1">do</span>
  <span class="re2">timer1</span>=<span class="sy0">`</span><span class="kw2">date</span> <span class="st_h">'+%s'</span><span class="sy0">`</span>
  <span class="re2">INPUT</span>=<span class="re1">$file</span>
  <span class="co0"># Check that input file is H.264</span>
  <span class="re2">isH264</span>=<span class="sy0">`</span>mdls <span class="re5">-raw</span> <span class="re5">-name</span> kMDItemCodecs <span class="re1">$INPUT</span><span class="sy0">|</span><span class="kw2">grep</span> H.264<span class="sy0">`</span>
&nbsp;
  <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="sy0">!</span><span class="re1">$isH264</span> <span class="br0">&#93;</span> ; <span class="kw1">then</span>
    logit <span class="st0">&quot;<span class="es2">$INPUT</span> is not h.264&quot;</span>
    <span class="kw3">continue</span>
  <span class="kw1">fi</span>
&nbsp;
  <span class="re2">DIRNAME</span>=<span class="sy0">`</span><span class="kw2">dirname</span> <span class="st0">&quot;<span class="es2">$INPUT</span>&quot;</span><span class="sy0">`</span>
  <span class="re2">FILENAME</span>=<span class="sy0">`</span><span class="kw2">basename</span> <span class="st0">&quot;<span class="es2">$INPUT</span>&quot;</span><span class="sy0">`</span>
  <span class="re2">BASENAME</span>=<span class="co1">${FILENAME%%.*}</span>
  logit <span class="st0">&quot;Conversion of <span class="es2">$FILENAME</span> started on <span class="es5">`date '+%D'`</span> at <span class="es5">`date '+%r'`</span>&quot;</span>
  <span class="re2">bytesize</span>=<span class="sy0">`</span><span class="kw2">stat</span> <span class="re5">-f</span> <span class="st_h">'%z'</span> <span class="re1">$FILENAME</span><span class="sy0">`</span>
  <span class="re2">filesize</span>=<span class="sy0">`</span><span class="kw3">echo</span> <span class="st0">&quot;scale = 2 ; <span class="es2">$bytesize</span>/1048576&quot;</span><span class="sy0">|</span><span class="kw2">bc</span> -lq<span class="sy0">`</span>
  <span class="kw3">cd</span> <span class="st0">&quot;<span class="es2">$DIRNAME</span>&quot;</span>
  <span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re5">-d</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>&quot;</span> <span class="br0">&#93;</span>; <span class="kw1">then</span>
    logit <span class="st0">&quot;Found <span class="es2">$FILENAME</span>, but directory <span class="es2">$BASENAME</span> already exists. Aborting&quot;</span>
    <span class="kw3">continue</span>
  <span class="kw1">fi</span>
  <span class="kw2">mkdir</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>&quot;</span>
  <span class="kw2">mv</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>/&quot;</span>
  <span class="kw3">cd</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>&quot;</span>
  <span class="kw1">if</span> <span class="br0">&#91;</span><span class="br0">&#91;</span> <span class="co1">${FILENAME#*.}</span> <span class="re5">-eq</span> <span class="st0">&quot;mov&quot;</span> <span class="br0">&#93;</span><span class="br0">&#93;</span>; <span class="kw1">then</span> <span class="kw2">mv</span> <span class="re1">$FILENAME</span> <span class="co1">${BASENAME}</span>.mp4; <span class="kw1">fi</span>  
  <span class="re2">FILENAME</span>=<span class="co1">${BASENAME}</span>.mp4
  <span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span><span class="kw2">ffmpeg</span> <span class="re5">-i</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="re5">-b</span> <span class="nu0">614400</span> <span class="re5">-s</span> <span class="re1">$MAXSIZE</span> <span class="re5">-aspect</span> <span class="nu0">16</span>:<span class="nu0">9</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>&quot;</span>.webm
  logit <span class="st0">&quot;Completed webm conversion&quot;</span>
  <span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span>ffmpeg2theora <span class="re5">--videoquality</span> <span class="nu0">5</span> <span class="re5">--audioquality</span> <span class="nu0">1</span> --max_size <span class="re1">$MAXSIZE</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="re5">-o</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>.ogv&quot;</span>
  logit <span class="st0">&quot;Completed ogv conversion&quot;</span>
  <span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span><span class="kw2">ffmpeg</span> <span class="re5">-i</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="re5">-ss</span> <span class="nu0">0</span> <span class="re5">-vframes</span> <span class="nu0">1</span> <span class="re5">-vcodec</span> mjpeg <span class="re5">-f</span> image2 <span class="st0">&quot;<span class="es3">${BASENAME}</span>Poster.jpg&quot;</span>
  logit <span class="st0">&quot;Created poster image&quot;</span>
&nbsp;
  <span class="co0"># Create a title from camelcased filename</span>
  <span class="re2">TITLE</span>=<span class="sy0">`</span><span class="kw3">echo</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>&quot;</span><span class="sy0">|</span><span class="kw2">sed</span> <span class="st_h">'s/\([A-Z][^A-Z]*\)/&amp; /g'</span><span class="sy0">|</span><span class="kw2">sed</span> <span class="st_h">'s/ $//'</span><span class="sy0">`</span>
  <span class="re2">SERVER</span>=<span class="sy0">`</span><span class="kw3">echo</span> <span class="st0">&quot;<span class="es2">$SSHURL</span>&quot;</span><span class="sy0">|</span><span class="kw2">sed</span> <span class="st_h">'s/^.*\@//'</span><span class="sy0">`</span>
  logit <span class="st0">&quot;Uploading to <span class="es2">$SERVER</span>...&quot;</span>
  <span class="kw3">cd</span> ..
  rsync <span class="re5">-v</span> <span class="re5">-r</span> <span class="re5">-e</span> <span class="kw2">ssh</span> <span class="st0">&quot;<span class="es5">`pwd`</span>/<span class="es2">$BASENAME</span>&quot;</span> <span class="re1">$SSHURL</span>:<span class="re1">$SSHDIR</span>
  logit <span class="st0">&quot;Finished Uploading&quot;</span>
  <span class="co0"># remove trailing slash from $WEBDIR</span>
  <span class="re2">WEBDIR</span>=<span class="sy0">`</span><span class="kw3">echo</span> <span class="st0">&quot;<span class="es2">$WEBDIR</span>&quot;</span><span class="sy0">|</span><span class="kw2">sed</span> <span class="st_h">'s/\/$//'</span><span class="sy0">`</span>
  <span class="kw2">cat</span> <span class="sy0">&gt;</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>/<span class="es2">$BASENAME</span>.blog.markdown&quot;</span> <span class="co2">&lt;&lt;-POSTTEMPLATE
Type: Blog Post (Markdown)
Blog: BlogsmithVideo
Title: $TITLE
Keywords: 
Status: draft
Pings: On
Comments: On
Category: Tutorial
&nbsp;
Synopsis
&nbsp;
[video mp4=&quot;$WEBDIR/$BASENAME/$BASENAME.mp4&quot; ogg=&quot;$WEBDIR/$BASENAME/$BASENAME.ogv&quot; webm=&quot;$WEBDIR/$BASENAME/$BASENAME.webm&quot; poster=&quot;$WEBDIR/$BASENAME/${BASENAME}Poster.jpg&quot; preload=&quot;true&quot; width=&quot;$DISPLAYWIDTH&quot; height=&quot;$DISPLAYHEIGHT&quot;]
&nbsp;
&lt;!--more--&gt;
Transcript
&nbsp;
POSTTEMPLATE</span>
&nbsp;
  open <span class="st0">&quot;<span class="es2">$BASENAME</span>/<span class="es2">$BASENAME</span>.blog.markdown&quot;</span> <span class="re5">-a</span> <span class="st0">&quot;TextMate.app&quot;</span>
  <span class="re2">timer2</span>=<span class="sy0">`</span><span class="kw2">date</span> <span class="st_h">'+%s'</span><span class="sy0">`</span>
  <span class="re2">time</span>=<span class="sy0">`</span><span class="kw3">echo</span> <span class="st0">&quot;scale=2 ; (<span class="es2">$timer2</span>-<span class="es2">$timer1</span>)/60&quot;</span><span class="sy0">|</span><span class="kw2">bc</span> -lq<span class="sy0">`</span>
  logit <span class="st0">&quot;Conversion of <span class="es2">$FILENAME</span> complete&quot;</span>
  logit <span class="st0">&quot;It took <span class="es2">$time</span> minutes to process a <span class="es3">${filesize}</span>M MP4 to webm and ogv and upload to <span class="es5">`echo &quot;$SSHURL&quot;|sed 's/^.*\@//'`</span>.&quot;</span>
<span class="kw1">done</span>
<span class="kw1">if</span> <span class="br0">&#91;</span><span class="br0">&#91;</span> <span class="re4">$#</span> <span class="re5">-gt</span> <span class="nu0">1</span> <span class="br0">&#93;</span><span class="br0">&#93;</span>; <span class="kw1">then</span>
  <span class="re2">maintimer2</span>=<span class="sy0">`</span><span class="kw2">date</span> <span class="st_h">'+%s'</span><span class="sy0">`</span>
  <span class="re2">total</span>=<span class="sy0">`</span><span class="kw3">echo</span> <span class="st0">&quot;scale=2 ; (<span class="es2">$maintimer2</span>-<span class="es2">$maintimer1</span>)/60&quot;</span><span class="sy0">|</span><span class="kw2">bc</span> -lq<span class="sy0">`</span>
  logit <span class="st0">&quot;Batch conversion complete, total time <span class="es2">$total</span> minutes.&quot;</span>
<span class="kw1">fi</span></pre></div></div>


<p>Hopefully this will make a few people’s lives easier. Mike and I have battle tested it and it seems to be a pretty great fit for our needs. If you modify it for your own needs, please share (with credit) so that it can become as well-rounded as possible!</p>

<div class="footnotes">
<hr />
<ol>

<li id="fn:fnh264">
<p>The script runs a quick check using <code>mdls</code> to look for the h.264 codec. It will skip the file if it doesn’t match the criteria. It doesn’t check for AAC, but assumes that you know what you’re doing to <em>some</em> extent. If you’re running Hazel, just check for the specific extension you’re rendering to (<code>.mov</code> or <code>.mp4</code>) to avoid any hassle from the start. <a href="#fnref:fnh264" rev="footnote">↩</a></p>
</li>

</ol>
</div>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/automating-html5-video-encodes/' rel='bookmark' title='Automating HTML5 video encodes'>Automating HTML5 video encodes</a></li>
<li><a href='http://brettterpstra.com/seriously-easy-html5-video-encoding/' rel='bookmark' title='Seriously easy HTML5 video encoding'>Seriously easy HTML5 video encoding</a></li>
<li><a href='http://brettterpstra.com/oft-bash-function-for-opening-a-specific-filetype/' rel='bookmark' title='oft: Bash function for opening a specific filetype'>oft: Bash function for opening a specific filetype</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/automated-html5-video-encoding-revisited/">Automated HTML5 video encoding revisited</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/automated-html5-video-encoding-revisited/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A couple of TextMate Macros for Markdown lists</title>
		<link>http://brettterpstra.com/a-couple-of-textmate-macros-for-markdown-lists/</link>
		<comments>http://brettterpstra.com/a-couple-of-textmate-macros-for-markdown-lists/#comments</comments>
		<pubDate>Sun, 24 Apr 2011 17:59:51 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[markdown]]></category>
		<category><![CDATA[multimarkdown]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2238</guid>
		<description><![CDATA[<p>I was playing with the new TextMate Markdown bundle for MultiMarkdown 3 when I remembered an old nit I had with the list commands: no single-keystroke way to move list items up and down. Unless I’m completely forgetting about a shortcut, moving list items around involves selecting the entire line and using Control-Command-Up/Down to move it. Obviously, not a big&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/a-couple-of-textmate-macros-for-markdown-lists/">A couple of TextMate Macros for Markdown lists</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2011/04/getting_out_of_order.jpg?9d7bd4" alt="That's funny. If you can't see this picture, you're missing out." class="alignright"/>I was playing with the new <a href="http://macromates.com">TextMate</a> Markdown bundle for <a href="https://github.com/fletcher/peg-multimarkdown">MultiMarkdown 3</a> when I remembered an old nit I had with the list commands: no single-keystroke way to move list items up and down. Unless I’m completely forgetting about a shortcut, moving list items around involves selecting the entire line and using Control-Command-Up/Down to move it. Obviously, not a big deal, but 5 minutes with the Macro recorder in TextMate saves the time.</p>

<p>Control-Right and Control-Left are already set up in the Markdown bundle to indent and outdent lines within lists. These two macros just add Control-Up and Control-Down for quickly shifting the order of a list. They only work with single lines; if you want to move a chunk of lines, you’ll want to use the old select and hit Control-Command-Up/Down method.</p>

<p>You can <a href="http://brettterpstra.com/downloads/MarkdownListMacros.zip?9d7bd4">download the TextMate List Macros</a> from here, but for more details, check out the video I added to the <a href="http://bundle.weblogzinc.com/video/?p=123">Blogsmith Bundle Video Site</a>.</p>

<p>Here’s a quick, semi-related tip: TextMate’s Web Preview running through MultiMarkdown 3 is wicked fast. There’s no visible latency. It’s practically an nvALT killer for people who primarily use nvALT for its MultiMarkdown preview. Definitely give it a shot. Fletcher Penney’s <a href="http://fletcherpenney.net/2011/04/multimarkdown_in_textmate_preview">video on setup and usage</a> is all you need. Well, that and <a href="https://github.com/fletcher/peg-multimarkdown/downloads/">MultiMarkdown 3</a>. By the way, the next release of <a href="http://brettterpstra.com/project/nvalt/">nvALT</a> deals much better with custom MultiMarkdown 3 installs. Coming soon.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/autotag2-smarter-tagging-for-textmate-and-wordpress/' rel='bookmark' title='AutoTag2: smarter tagging for TextMate and WordPress'>AutoTag2: smarter tagging for TextMate and WordPress</a></li>
<li><a href='http://brettterpstra.com/nvalt-2-1-progress-report/' rel='bookmark' title='nvALT 2.1 progress report'>nvALT 2.1 progress report</a></li>
<li><a href='http://brettterpstra.com/new-markdown-service-tool-html-to-clipboard/' rel='bookmark' title='New Markdown Service tool: HTML to Clipboard'>New Markdown Service tool: HTML to Clipboard</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/a-couple-of-textmate-macros-for-markdown-lists/">A couple of TextMate Macros for Markdown lists</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/a-couple-of-textmate-macros-for-markdown-lists/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Automating HTML5 video encodes</title>
		<link>http://brettterpstra.com/automating-html5-video-encodes/</link>
		<comments>http://brettterpstra.com/automating-html5-video-encodes/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 00:19:08 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=2113</guid>
		<description><![CDATA[<p>I spent an inordinate amount of time not doing useful things today. During this non-productivity bender, I got a little obsessed with making the HTML5 video encoding process easier. I’ve been working on a tutorial site for the Blogsmith Bundle, so this whole deal needed to be sped up. I came out with a script which, when combined with the&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/automating-html5-video-encodes/">Automating HTML5 video encodes</a></p>]]></description>
			<content:encoded><![CDATA[<p>I spent an inordinate amount of time <em>not</em> doing useful things today. During this non-productivity bender, I got a little obsessed with making the HTML5 video encoding process easier. I’ve been working on a <a href="http://bundle.weblogzinc.com/video">tutorial site</a> for the Blogsmith Bundle, so this whole deal needed to be sped up. I came out with a script which, when combined with the right command line utilities, takes 90% of the manual labor out of creating the multiple formats needed.</p>

<p>HTML5 video, if you’re not familiar, provides a means to supply modern browsers with high-quality video <em>without</em> using Flash. It works across iOS devices beautifully, and the markup is highly semantic. The problem is that every browser has chosen a different format to promote, and using HTML5 video effectively means providing the same video in three formats (OGV, MP4, WEBM). Then, you need to code in a Flash fallback for older browsers. This would all be fine if my usual video conversion tools had a multiple-encode feature. They don’t. The only one that comes close is <a href="http://thelittleappfactory.com/evom/">Evom</a>, which has an HTML5 preset to encode OGV and MP4 at the same time, but the OGV files won’t play in Firefox and it can’t do WEBM at <em>all</em> right now.</p>

<p>So, taking matters into my own hands…</p>

<p><span id="more-2113"></span></p>

<h3>The workflow</h3>

<p>Here’s the workflow I’m using now:</p>

<ol>
<li>Export a screencast as an MP4 file to a bucket folder</li>
<li>Hazel detects a new MP4 file and runs a shell script on it which:

<ol>
<li>Creates a new folder based on the file’s base name and moves the file into it</li>
<li>Runs an ffmpeg sequence to create a webm version</li>
<li>Runs an ffmpeg2theora command to create an ogv</li>
<li>Uses ffmpeg to create a poster image from the first frame of the mp4</li>
<li>Uses rsync to put the finished folder on my server</li>
</ol></li>
<li>I get a growl notification from Hazel that files are converted and uploaded</li>
<li>I insert the ungodly-long “shortcode” for the <a href="http://wordpress.org/extend/plugins/videojs-html5-video-player-for-wordpress/installation/">VideoJS plugin</a> using TextExpander into a new WordPress post.</li>
</ol>

<p>Four steps, and I only have to interact with two of them. The script is pretty hardcoded for my setup, but I moved some of the config up to the top for convenience. You’ll need ffmpeg and ffmpeg2theora installed, both of which are really easy to set up with <a href="https://github.com/mxcl/homebrew">homebrew</a>. You can probably find binaries, too, but I just used <code>brew</code> for these.</p>

<h3>The script</h3>

<p>Here’s the script, hope it helps someone else, too:</p>


<div class="wp_syntax"><div class="code"><pre class="bash"><span class="co0">#!/bin/bash</span>
<span class="co0"># html5encode.sh</span>
<span class="co0"># Brett Terpstra, 2011 - http://brettterpstra.com/automating-html5-video-encodes</span>
<span class="co0"># Requires ffmpeg and ffmpeg2theora</span>
<span class="co0">##################</span>
<span class="co0">### CONFIG #######</span>
<span class="re2">MAXSIZE</span>=<span class="st0">&quot;960x540&quot;</span>
<span class="re2">SSHURL</span>=<span class="st0">&quot;username@your.webserver.com&quot;</span>
<span class="re2">SSHDIR</span>=<span class="st0">&quot;/www/video/media/&quot;</span>
<span class="co0">### END CONFIG ###</span>
&nbsp;
<span class="re2">INPUT</span>=<span class="re4">$1</span>
<span class="re2">DIRNAME</span>=<span class="sy0">`</span><span class="kw2">dirname</span> <span class="st0">&quot;<span class="es2">$INPUT</span>&quot;</span><span class="sy0">`</span>
<span class="re2">FILENAME</span>=<span class="sy0">`</span><span class="kw2">basename</span> <span class="st0">&quot;<span class="es2">$INPUT</span>&quot;</span><span class="sy0">`</span>
<span class="re2">BASENAME</span>=<span class="co1">${FILENAME%%.*}</span>
&nbsp;
<span class="kw3">cd</span> <span class="st0">&quot;<span class="es2">$DIRNAME</span>&quot;</span>
<span class="kw1">if</span> <span class="br0">&#91;</span> <span class="re5">-d</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>&quot;</span> <span class="br0">&#93;</span>; <span class="kw1">then</span>
  <span class="co0"># /usr/local/bin/growlnotify -s -i &quot;Terminal.app&quot; -m &quot;Found $FILENAME, but directory $BASENAME already exists. Aborting&quot;</span>
  <span class="kw3">exit</span> <span class="nu0">1</span>
<span class="kw1">fi</span>
<span class="kw2">mkdir</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>&quot;</span>
<span class="kw2">mv</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>/&quot;</span>
<span class="kw3">cd</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>&quot;</span>
&nbsp;
<span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span><span class="kw2">ffmpeg</span> <span class="re5">-pass</span> <span class="nu0">1</span> <span class="re5">-passlogfile</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="re5">-threads</span> <span class="nu0">16</span>  -keyint_min <span class="nu0">0</span> \
<span class="re5">-g</span> <span class="nu0">250</span> -skip_threshold <span class="nu0">0</span> <span class="re5">-qmin</span> <span class="nu0">1</span> <span class="re5">-qmax</span> <span class="nu0">51</span> <span class="re5">-i</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="re5">-vcodec</span> libvpx <span class="re5">-b</span> <span class="nu0">614400</span> \
<span class="re5">-s</span> <span class="re1">$MAXSIZE</span> <span class="re5">-aspect</span> <span class="nu0">16</span>:<span class="nu0">9</span> <span class="re5">-an</span> <span class="re5">-y</span> temp.webm
&nbsp;
<span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span><span class="kw2">ffmpeg</span> <span class="re5">-pass</span> <span class="nu0">2</span> <span class="re5">-passlogfile</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="re5">-threads</span> <span class="nu0">16</span>  -keyint_min <span class="nu0">0</span> \
<span class="re5">-g</span> <span class="nu0">250</span> -skip_threshold <span class="nu0">0</span> <span class="re5">-qmin</span> <span class="nu0">1</span> <span class="re5">-qmax</span> <span class="nu0">51</span> <span class="re5">-i</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="re5">-vcodec</span> libvpx <span class="re5">-b</span> <span class="nu0">614400</span> \
<span class="re5">-s</span> <span class="re1">$MAXSIZE</span> <span class="re5">-aspect</span> <span class="nu0">16</span>:<span class="nu0">9</span> <span class="re5">-acodec</span> libvorbis <span class="re5">-y</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>&quot;</span>.webm
&nbsp;
<span class="kw2">rm</span> temp.webm
<span class="kw2">rm</span> <span class="sy0">*</span>.log
&nbsp;
<span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span>ffmpeg2theora <span class="re5">--videoquality</span> <span class="nu0">5</span> <span class="re5">--audioquality</span> <span class="nu0">1</span> --max_size <span class="re1">$MAXSIZE</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="re5">-o</span> <span class="st0">&quot;<span class="es2">$BASENAME</span>.ogv&quot;</span>
<span class="sy0">/</span>usr<span class="sy0">/</span>local<span class="sy0">/</span>bin<span class="sy0">/</span><span class="kw2">ffmpeg</span> <span class="re5">-i</span> <span class="st0">&quot;<span class="es2">$FILENAME</span>&quot;</span> <span class="re5">-ss</span> <span class="nu0">0</span> <span class="re5">-vframes</span> <span class="nu0">1</span> <span class="re5">-vcodec</span> mjpeg <span class="re5">-f</span> image2 <span class="st0">&quot;<span class="es3">${BASENAME}</span>Poster.jpg&quot;</span>
<span class="kw3">cd</span> ..
rsync <span class="re5">-v</span> <span class="re5">-r</span> <span class="re5">-e</span> <span class="kw2">ssh</span> <span class="st0">&quot;<span class="es5">`pwd`</span>/<span class="es2">$BASENAME</span>&quot;</span> <span class="re1">$SSHURL</span>:<span class="re1">$SSHDIR</span></pre></div></div>


<p>The Hazel rule I’m running simply looks for files in the bucket folder with the <code>.mp4</code> extension and passes them to the shell script.</p>

<p>Let me know if you have a better way to automate this. Also, let me know if you’ve found a good way to encode h.264 from the command line on a Mac. I haven’t been able to get ffmpeg to compile with x/h.264 support yet, but it was irrelevant as I had to output <em>some</em> format to begin with. Might as well save to the one format I can’t encode properly from a shell script…</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/automated-html5-video-encoding-revisited/' rel='bookmark' title='Automated HTML5 video encoding revisited'>Automated HTML5 video encoding revisited</a></li>
<li><a href='http://brettterpstra.com/quick-notes-on-cross-browser-html5-video/' rel='bookmark' title='Quick notes on cross-browser HTML5 video'>Quick notes on cross-browser HTML5 video</a></li>
<li><a href='http://brettterpstra.com/fog-in-the-valley/' rel='bookmark' title='Fog In The Valley'>Fog In The Valley</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/automating-html5-video-encodes/">Automating HTML5 video encodes</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/automating-html5-video-encodes/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Quick notes on cross-browser HTML5 video</title>
		<link>http://brettterpstra.com/quick-notes-on-cross-browser-html5-video/</link>
		<comments>http://brettterpstra.com/quick-notes-on-cross-browser-html5-video/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 14:49:29 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=993</guid>
		<description><![CDATA[<p>I’ve been doing some screencasts lately, and have wanted to post them as HTML5 videos in many cases. I also wanted to serve them from my Cloudfront CDN. This is not a how-to post, just some things I learned that I couldn’t find existing answers to. For an excellent primer, see Video On the Web from Dive Into HTML5. I&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/quick-notes-on-cross-browser-html5-video/">Quick notes on cross-browser HTML5 video</a></p>]]></description>
			<content:encoded><![CDATA[<p><img style=' display:none'  class="headerimg" src="http://cdn2.brettterpstra.com/wp-content/uploads/2010/09/html5videodromeheader.jpg?9d7bd4" alt="Header image" /></p>

<p><img style=' float: right; padding: 4px; margin: 0 0 2px 7px;'  src="http://cdn2.brettterpstra.com/wp-content/uploads/2010/09/catholictv.jpg?9d7bd4" alt="Catholic TV Screenshot" border="0" width="300" height="180" class="alignright" />I’ve been doing some screencasts lately, and have wanted to post them as HTML5 videos in many cases. I also wanted to serve them from my <a href="http://aws.amazon.com/cloudfront/">Cloudfront</a> <abbr title="Content Distribution Network">CDN</abbr>. This is not a how-to post, just some things I learned that I couldn’t find existing answers to. For an excellent primer, see <a href="http://diveintohtml5.org/video.html">Video On the Web</a> from <a href="http://diveintohtml5.org/">Dive Into HTML5</a>.</p>

<p>I kept running into hurdles, whether it was the content-type of the file being served, or the OGV encoding not working in Firefox, weird sizing, slight variations in syntax, etc. So here are my notes on how I got from <a href="http://www.telestream.net/screen-flow/overview.htm">ScreenFlow</a> to a cross-browser HTML5 video embed. They may not be of much use outside of that situation, but they might help somebody.</p>

<p><span id="more-993"></span>
1. The only way I could get an OGV file that actually played in Firefox was to export from ScreenFlow in a DV format, and use <a href="http://thelittleappfactory.com/evom/">Evom</a> or <a href="http://v2v.cc/~j/ffmpeg2theora/">ffmpeg2theora</a> to convert. Note that Evom requires the file extension to be <code>mov</code>, as it doesn’t recognize (and won’t accept) <code>dv</code> files. Evom has a setting called HTML5 that will create both MP4 and OGV files.
2. Aside from writing my own Ruby scripts to handle the upload to my <a href="http://aws.amazon.com/s3/">Amazon S3</a> account, <a href="http://www.panic.com/transmit/">Transmit</a> is the only app I could find that would let me automatically set appropriate MIME headers on uploaded video files, and allow me to automatically make them public. I now have a Transmit droplet in <a href="http://aptonic.com/">Dropzone</a> that will upload my files directly to the S3 bucket that my Cloudfront account uses, set their Content-Type to video/ogg and video/mp4, respectively, and make them public-readable.
3. The embed code is a little bit flexible, with parameters like “preload” and “autobuffer” seemingly being interchangeable. My current, working embed code looks like:</p>

<div markdown=0>
<pre><code>
&lt;video width=&quot;476&quot; height=&quot;324&quot; controls=&quot;&quot; autobuffer=&quot;autobuffer&quot;&gt;
  &lt;source src=&quot;http://cdn.brettterpstra.com/media/TablinksDemo2.mp4&quot; type=&#x27;video/mp4; codecs=&quot;avc1.42E01E, mp4a.40.2&quot;&#x27;&gt;
  &lt;source src=&quot;http://cdn.brettterpstra.com/media/TablinksDemo2.ogv&quot;  type=&#x27;video/ogg; codecs=&quot;theora, vorbis&quot;&#x27;&gt;
&lt;/video&gt;
</code></pre>
</div>

<p>With those steps in place, I’ve got video that plays (and looks decent) in Safari 5, Firefox 4 and Chrome. Obviously, I’d normally want a Flash fallback, but given that the videos I’m currently working on are about Safari 5, I’m not overly concerned whether Internet Explorer can see them or not. There’s always good-looking plugins like <a href="http://flarevideo.com/">FlareVideo</a> if that’s a requirement.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/automating-html5-video-encodes/' rel='bookmark' title='Automating HTML5 video encodes'>Automating HTML5 video encodes</a></li>
<li><a href='http://brettterpstra.com/seriously-easy-html5-video-encoding/' rel='bookmark' title='Seriously easy HTML5 video encoding'>Seriously easy HTML5 video encoding</a></li>
<li><a href='http://brettterpstra.com/automated-html5-video-encoding-revisited/' rel='bookmark' title='Automated HTML5 video encoding revisited'>Automated HTML5 video encoding revisited</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/quick-notes-on-cross-browser-html5-video/">Quick notes on cross-browser HTML5 video</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/quick-notes-on-cross-browser-html5-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My weather report. Seriously.</title>
		<link>http://brettterpstra.com/my-weather-report-seriously/</link>
		<comments>http://brettterpstra.com/my-weather-report-seriously/#comments</comments>
		<pubDate>Wed, 26 May 2010 02:15:54 +0000</pubDate>
		<dc:creator>Brett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[multimedia]]></category>
		<category><![CDATA[personal]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://brettterpstra.com/?p=476</guid>
		<description><![CDATA[<p>I did some massive Spring cleaning over the weekend, and found a lot of “treasures” that, after having been momentarily cherished, are on their way to the dump. A pile of Dead Kennedy’s and TCHC cassettes from High School that had been severely devastated by an extended stay in the garage, original vinyl pressings from some of my old bands,&#8230;</p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/my-weather-report-seriously/">My weather report. Seriously.</a></p>]]></description>
			<content:encoded><![CDATA[<p>I did some massive Spring cleaning over the weekend, and found a lot of “treasures” that, after having been momentarily cherished, are on their way to the dump. A pile of Dead Kennedy’s and <acronym title="Twin Cities Hard Core">TCHC</acronym> <a href="http://farm5.static.flickr.com/4021/4633577642_922f15e6b0.jpg">cassettes</a> from High School that had been severely devastated by an extended stay in the garage, original <a href="http://farm4.static.flickr.com/3173/4633576422_eb89101ffc.jpg" title="Onward to Mayhem test pressing">vinyl pressings</a> from some of my old bands, <a href="http://www.aboutphone.info/lib/phreak/boxes-2.html">Phreak boxes</a>, and more defunct electronics than I could possibly E-bay. Amongst all of it, though, I found a CD of work from my Interactive Multimedia degree at the <a href="http://www.mcad.edu/">Minneapolis College of Art and Design</a>. Aside from my diploma, it’s really the only proof I have left that I was ever there. There was definitely some interesting work on there, though.</p>

<p>We were given a weather report from a local cable station. Our assignment was to make it interesting, and this is what I did with it. The sound design, especially, makes me chuckle.</p>

<p>httpv://www.youtube.com/watch?v=6WUmr9FM3GY</p>

<p><a href="http://www.youtube.com/watch?v=6WUmr9FM3GY&amp;fmt=21">YouTube Link…</a></p>

<p>Thank you. That is all.</p>
<p>Related posts:<ol>
<li><a href='http://brettterpstra.com/now-something-happier/' rel='bookmark' title='And now… something happier'>And now… something happier</a></li>
<li><a href='http://brettterpstra.com/adding-a-tinymce-button/' rel='bookmark' title='Adding a TinyMCE button to WordPress'>Adding a TinyMCE button to WordPress</a></li>
<li><a href='http://brettterpstra.com/nvalt-2-1-progress-report/' rel='bookmark' title='nvALT 2.1 progress report'>nvALT 2.1 progress report</a></li>
</ol></p><p>Originally posted on <a href="http://brettterpstra.com" title="BrettTerpstra.com">BrettTerpstra.com</a> at <a href="http://brettterpstra.com/my-weather-report-seriously/">My weather report. Seriously.</a></p>]]></content:encoded>
			<wfw:commentRss>http://brettterpstra.com/my-weather-report-seriously/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 19/90 queries in 0.249 seconds using xcache
Object Caching 2395/2482 objects using xcache
Content Delivery Network via cdn2.brettterpstra.com

Served from: brettterpstra.com @ 2012-02-09 17:19:46 -->
