<?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>Christopher Lavender</title>
	<atom:link href="http://www.christopherlavender.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.christopherlavender.com</link>
	<description>Lateral thinker, software architect, technology artist &#38; rabid learner of new information.</description>
	<lastBuildDate>Wed, 09 Jan 2013 08:21:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>HTTP Live Streaming Part 1: Setup, Segment, &amp; Stream</title>
		<link>http://www.christopherlavender.com/2012/07/14/http-live-streaming-part-1-setup-segment-stream/</link>
		<comments>http://www.christopherlavender.com/2012/07/14/http-live-streaming-part-1-setup-segment-stream/#comments</comments>
		<pubDate>Sun, 15 Jul 2012 02:23:25 +0000</pubDate>
		<dc:creator>clavender</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Apple Computers]]></category>
		<category><![CDATA[HTTP Live Streaming]]></category>
		<category><![CDATA[Objective C]]></category>

		<guid isPermaLink="false">http://www.christopherlavender.com/?p=42</guid>
		<description><![CDATA[One of my recent projects deals heavily with an open source Apple technology called HTTP Live Streaming. It&#8217;s an HTTP based streaming protocol that at its most fundamental level provides a way to stream video and audio from just about &#8230; <a href="http://www.christopherlavender.com/2012/07/14/http-live-streaming-part-1-setup-segment-stream/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>One of my recent projects deals heavily with an <a href="https://developer.apple.com/resources/http-streaming/">open source Apple technology called HTTP Live Streaming</a>. It&#8217;s an HTTP based streaming protocol that at its most fundamental level provides a way to stream video and audio from just about any server with nothing but a few free software tools provided by <a href="#note">Apple**</a>. However, it has a few additionally features that I think make it a really exciting tool. Yet, I haven&#8217;t seen HTTP Live Streaming used very much. This is probably mainly due to Adobe Flash being so popular (<a href="http://mashable.com/2012/06/29/flash-in-android-4-1/">although it looks like that might change pretty soon</a>). However, I also think that the combination of a lack of good/clear documentation, and Apple&#8217;s Live Streaming Developer Tools being command line based also make the barrier to entry higher than many developers want to deal with.</p>
<p>The hope is to share my understanding of how to use this technology to:</p>
<ul>
<li>try to lower the barrier to entry for others</li>
<li>serve as a reference for myself when I forget parts of the process</li>
</ul>
<p>For simplicity sake, this blog post focuses on using HTTP Live Streaming to deliver prerecorded material rather than an actual Live broadcast. However, the process is nearly identical. Also, I&#8217;ll be assuming that the assets to be streamed are being prepped using OSX based machines.</p>
<p>Each post in this series will focus on one of Apple&#8217;s HLS Developer Tools. This post is going to cover prepping a single .mp4 file for streaming using the mediafilesegmenter. Part 2 will cover prepping multiple versions of the same video, each encoded at a different bit rate to accommodate varying connection speeds, using the mediafilesegmenter together with the variantplaylistcreator. Part 3 I&#8217;ll take a look at including timed metadata using the mediafilesegmenter with the id3taggenerator.</p>
<h2>Setup</h2>
<p>The basic concept behind HTTP Live Streaming (or HLS) is relatively straight forward. Chop up the video into smaller chunks that are easier to transmit and create a header file (or &#8220;playlist&#8221;), which has the location and other information about the stream files so that the client knows where to go to get the video.</p>
<p>The first thing you need is some video encoded in .mp4 format. A popular cross platform tool for this is <a href="http://handbrake.fr/" target="_blank">HandBrake</a> and it is <a href="http://handbrake.fr/downloads.php" target="_blank">freely available</a> with decent <a href="https://trac.handbrake.fr/wiki/HandBrakeGuide" target="_blank">online documentation</a>.</p>
<p>Additionally, the one bit of setup needed for your server is to configure the .htaccess file to be aware of what to do with the two file types associated with HLS. The two file types are</p>
<ol>
<li>.m3u8: playlists that in this use-case point to different file segment &#8220;streams&#8221;</li>
<li>.ts: the segmented video files. Each series of .ts files constitutes a &#8220;stream&#8221;</li>
</ol>
<p>To make sure your server knows how to handle these file types, you&#8217;ll need to locate the .htaccess file on your server. Note the &#8220;.&#8221; prefix, which means you&#8217;ll need to use a ftp client that will show hidden files. In your .htaccess file add these two lines:</p>
<pre>AddHandler application/x-mpegURL m3u8
AddHandler video/MP2T ts</pre>
<p>One gotcha (or at least it got me): note that the extensions do not have a &#8220;.&#8221; prefix on them. Just use &#8220;ts&#8221; rather than &#8220;.ts&#8221;.</p>
<p>At this point your server should be ready to roll.</p>
<h2>Segment</h2>
<p>First you&#8217;ll need to install Apple&#8217;s HTTP Live Streaming Developer Tools from the Apple Developer website. To segment a video, the only one of these tools you&#8217;ll need is the mediafilesegmenter command line program. You&#8217;ll know if it&#8217;s installed or not by going to the Terminal, typing mediaf, and hit TAB.</p>
<p>If installed it should autocomplete. Press Return and you should get a list of all the options for the mediafilesegmentor. There&#8217;s lots of options but we&#8217;re only interested in this:</p>
<pre>-f &lt;path&gt; | --file-base=&lt;path&gt;  : path at which to store index and media files</pre>
<p>Obviously from the list of options there&#8217;s lots more you can do, but for basic segmentation for streaming this is all you need.</p>
<p>Now we&#8217;re ready to rock. Just type in mediafilesegmenter -f and drag and drop into the Terminal window the folder in which you want the segmented files to be put. Then drag and drop your .mp4 file into the Terminal window. Finally, hit Return.</p>
<p>In my case the entire command line looked like this:</p>
<pre>mediafilesegmenter -f /Users/Chris/Desktop/test/segment_example  /Users/Chris/Desktop/test/thePianist.mp4</pre>
<p>Relative paths will work here as well, so if I had navigated to the &#8220;test&#8221; folder and manually typed the relative paths it would have looked like this:</p>
<pre>mediafilesegmenter -f segment_example thePianist.mp4</pre>
<p>Now you should have lots of segmented .ts files and a couple .m3u8 files in your destination folder (in my case called segmented_example). Next, take the entire folder and put it on the Apache server that has the .htaccess file you edited earlier.</p>
<h2>Stream</h2>
<p>Essentially you&#8217;re done at this point right? Let&#8217;s see if it worked. You can do this quick an easy by using the free open source media playback software <a href="http://www.videolan.org/vlc/index.html">VLC</a>. Just use the &#8220;Advanced Open File&#8230;&#8221; option under the File menu and select &#8220;Network&#8221;. Then type the URL path to your prog_index.m3u8 file and choose Open. If it starts streaming everything went according to plan.</p>
<p>However, I&#8217;m guessing that doing all of this to simply play it back in an app like VLC is not what brought you here. You want to stream to a website or mobile device right?</p>
<h2>HTML5 Playback</h2>
<p>This is probably the most flexible option. Supposedly any HTML5 video player should work, <a href="http://videojs.com/">but I use Video.js</a>. There&#8217;s even <a href="http://wordpress.org/extend/plugins/videojs-html5-video-player-for-wordpress/">a WordPress plugin</a> that will allow you to play a stream from within a post!</p>
<p><video id="something" width="640" height="480" class="video-js vjs-default-skin" controls="controls" preload="auto" data-setup="{}"><source src="http://www.thumbafon.com/code_examples/video/segment_example/prog_index.m3u8" type="application/x-mpegURL" /></video></p>
<p>&nbsp;</p>
<p>Once installed, all you need to do is point the player to your prog_index.m3u8 file like this:</p>
<pre> &lt;source src="http://www.thumbafon.com/code_examples/video/segment_example/prog_index.m3u8" type='application/x-mpegURL' / &gt;</pre>
<h2>iOS AVPlayer</h2>
<p>If you&#8217;re interested in streaming to an iOS device and don&#8217;t want to use HTML5 (seriously don&#8217;t be boner&#8230; go native) you can do it with code like this:</p>
<pre>#import &lt;;MediaPlayer/MediaPlayer.h&gt;;
@interface ViewController ()
@property (strong, nonatomic) MPMoviePlayerController *streamPlayer;
@end

@implementation ViewController
@synthesize streamPlayer = _streamPlayer;

- (void)viewDidLoad
{
    NSURL *streamURL = [NSURL URLWithString:@"http://www.thumbafon.com/code_examples/video/segment_example/prog_index.m3u8"];

    _streamPlayer = [[MPMoviePlayerController alloc] initWithContentURL:streamURL];

    [self.streamPlayer.view setFrame: self.view.bounds ];

    self.streamPlayer.controlStyle = MPMovieControlStyleEmbedded;

    [self.view addSubview: self.streamPlayer.view];

    [self.streamPlayer play];
}

- (void)dealloc
{
     // if non-ARC don't forget!
    // [_streamPlayer release];
    // [super dealloc];
}

@end</pre>
<p>If you&#8217;ve got the hang of this, between the mediafilesegmenter options and the built in playback capabilities of your chosen playback framework, there&#8217;s a ton more to experiment with. I tried to give the most basic foot-in-the-door explanation that I could to here.</p>
<p>Now&#8230; why use this at all? I mean, you can just playback any .mp4 while it loads right? Well yes, but HTTP Live Streaming has some additional features that make it suitable for the right situation.</p>
<ol>
<li>Of course there&#8217;s the <em>Live Streaming</em> part. And the magic is that it&#8217;s fundamentally the same process. However, instead of using mediafilesegmenter you use mediastreamsegmentor. Of course this is happening continuously in real-time so it is a little more complex.</li>
<li>There&#8217;s also <em>Variant Playlists</em>. This adds the ability to offer different streams depending on connection quality. The streams can be switched <em>IN REAL TIME</em>. Plus, the audio can be abstracted away from the video allowing you to also provide separate audio tracks for your video streams that are switchable in real time. Why would you do that? Localization.</li>
<li>There&#8217;s also the addition of Timed Metadata, or meta data that can be imprinted at explicit times in the video playback. This is a feature that I think is very under exploited and can offer a way to tightly bind a UI with video playback.</li>
</ol>
<p>I&#8217;ll be covering #2 &amp; #3 in future posts. Maybe even #1 time permitting.</p>
<p>Happy coding!</p>
<p><span style="font-size: small;"><a name="note"></a><strong>**Note</strong><br />
Apple&#8217;s software tools are free for registered Apple Developers. Of course the registration is not free. I understand that there are free third party tools available. <a href="http://www.tandasoft.com/2011/02/01/iphone-ipad-ipod-http-live-streaming-hls-with-free-tools-on-windows/">Here&#8217;s one example of someone prepping data for HTTP Live Streaming using a Windows machine</a>. I have no experience with this, and it&#8217;s unclear if all functionality (i.e. Timed Metadata) is available with these third party tools.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.christopherlavender.com/2012/07/14/http-live-streaming-part-1-setup-segment-stream/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on Music Making for Money</title>
		<link>http://www.christopherlavender.com/2012/07/09/thoughts-on-music-making-for-money/</link>
		<comments>http://www.christopherlavender.com/2012/07/09/thoughts-on-music-making-for-money/#comments</comments>
		<pubDate>Tue, 10 Jul 2012 05:22:01 +0000</pubDate>
		<dc:creator>clavender</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Music Business]]></category>
		<category><![CDATA[Music Technology]]></category>

		<guid isPermaLink="false">http://www.christopherlavender.com/?p=28</guid>
		<description><![CDATA[It&#8217;s no secret that in a former life I was a professional musician. Recently, a good friend and colleague of mine, Scott Collins, wrote a really great blog post on what is being talked about as a new business model &#8230; <a href="http://www.christopherlavender.com/2012/07/09/thoughts-on-music-making-for-money/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s no secret that in a former life I was a professional musician. Recently, a good friend and colleague of mine, Scott Collins, wrote a <a href="http://guitarchitecture.org/2012/06/27/from-diy-to-diy-ofs-lim-adb-or-an-immodest-proposal-part-1/">really great blog post</a> on what is being talked about as a new business model for emerging artists.</p>
<p>Before posting <a href="http://guitarchitecture.org/2012/07/09/emily-white-and-potential-customers-or-an-immodest-proposal-part-2/">Part 2</a> of the above blog post, Scott sent out a draft for some opinions. Since I now have a blog for which I feel obligated to contribute, I thought I would repost my response <img src='http://www.christopherlavender.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . </p>
<p>My ideas are based partly in personal experience, partly in research, and partly on gut instinct. That being said, this issue is something I&#8217;ve been thinking about and discussing with other musicians and technologists for the last 3 &#8211; 4 years.  You should also note that my responses are to a rough draft of Scott&#8217;s article.  After which he made some revisions. <a href="http://guitarchitecture.org/2012/07/09/emily-white-and-potential-customers-or-an-immodest-proposal-part-2/">I HIGHLY RECOMMEND reading the final draft of the article</a>.  It&#8217;s right on.  At any rate, arguments against some of the points in the rough draft aren&#8217;t really valid with regards to the final draft, but the core ideas are still worthy of a post.</p>
<p>I feel that this kind of discourse is long over due. These issues don&#8217;t just affect the music industry. The astute realize that this conversation really bleeds over into all of the entertainment industry as well as the software and hardware industries. Things are changing and they&#8217;re changing fast.</p>
<blockquote><p>Thanks Scott!</p>
<p>So as always a great article!  And as usual I agree with you&#8230; mostly <img src='http://www.christopherlavender.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>(WARNING: Personal opinions to follow.)</p>
<p><strong>SC: Reason #1: People no longer need to be musicians to make music.</strong></p>
<p>I disagree.  Good music requires musicianship.  In fact, whenever I hear music that people love, whether I like it or not I feel that I have to accept that it was created with a certain level of musicianship.  What I think YOU are getting at (and correct me if I&#8217;m wrong) is that one doesn&#8217;t need to be trained (formerly or otherwise) on a physical musical instrument to make music, and thus implying that training on a musical instrument is what makes a musician. THAT is what I disagree with.</p>
<p>I think that one of the things that technology has exposed is that technical skill on a traditional instrument does not equate to musicianship in a 1 to 1 way.  Any Joe can NOT spend years practicing, gain chops, and get his &#8220;musicianship&#8221; certificate.  Musicianship is an intangible skill that absolutely MUST be developed, but now it can be developed in a way that is independent of traditional modalities. I&#8217;m not suggesting that this is a good or bad thing&#8230; it&#8217;s just the way it is.</p>
<p>In fact, you hinted at this in your first article.  I&#8217;m saying that you don&#8217;t have to practice a traditional musical instrument in a traditional way, BUT YOU DO HAVE TO PRACTICE.  Technology does not replace paying dues.</p>
<p><strong>SC: Reason #3: The $.99 song. We have created an arbitrary price for a song</strong></p>
<p>Remember&#8230; we didn&#8217;t create it.  Apple did.  Also remember that Apple is not a music company or label.  In fact, I&#8217;m pretty sure they don&#8217;t need (nor ever have needed) to make their money from selling media.  Apple sells hardware.  Not any hardware. They sell highly optimized hardware packages with integrated proprietary software targeted toward the masses.  Their main concern is that it &#8220;just works&#8221; for the consumer, and that the consumer can literally <a href="http://www.nytimes.com/2011/10/01/opinion/you-love-your-iphone-literally.html">FALL IN LOVE WITH THE HARDWARE</a>. Their operating systems, software packages, and services are built to insure that their hardware KICKS ASS. And it does. Microsoft can&#8217;t deliver on that.  DELL can&#8217;t deliver on that. And most assuredly Warner Bros, Sony, etc&#8230; don&#8217;t have a fighting chance.  Particularly when Apple doesn&#8217;t really need to make a profit on the media distribution.  They just need to make it profitable enough for the studios so they retain the right to sell said media.  And since iTunes&#8217; user base is massive, and they actually pay money, the studios don&#8217;t have much of a choice in my estimation.</p>
<p>Additionally, I think that all of this is skirting the issue.  Recorded music is so ubiquitous now <em>THAT IT&#8217;S HARDLY WORTH MORE THAN THE AIR WE BREATH</em> (which as of this writing is free).</p>
<p>Finally,  here&#8217;s the really tough news about your app idea.  Just like the iTunes model, the only people making money from selling apps is Apple (again even though they probably don&#8217;t need to). Bargain basement price for developing a solid kick ass app that works well is around $50,000 at the end of the day. Now you could get a pile of shit thrown together for less, but I&#8217;m talking about a KILLER app that works solidly with social integration and a web backend plus cool audio features, great graphic design&#8230;etc. All standard now a days for a mobile app.  Rock bottom I would say $50k but realistically probably closer to $100k.  And that&#8217;s just to release (design, development, testing, marketing, blah blah blah). What about ongoing maintenance? Updates? Bug fixes? Apple&#8217;s cut on each app sale (for which they basically do almost nothing) is about $.20 on the dollar.  At $.99 a pop you need roughly 125,000 downloads just to break even.  Probably a snap for Louie CK!</p>
<p>The successful apps are tied into larger ideas and concepts (think Instagram, Draw Something, Flipboard, etc&#8230; Angry Birds is the 1 in a million exception). Or they provide on going services purchasable from within the app (think AmpliTube). These apps cost nothing or almost nothing for the user.  The main thing that the first group uses for monetization is a massive user base like Facebook has.  <a href="http://gigaom.com/cloud/the-next-generation-business-data-is-the-new-platform/">Now of course that hasn&#8217;t proven profitable yet, but it will</a>.  To think otherwise is delusional.</p>
<p>I say it&#8217;s not about the app.  It&#8217;s about the artist.  Just like it&#8217;s not about the recordings any more.  It&#8217;s about the artist.  In this environment you simply have to be the entire package.  You have to be a creative musician.  You have to be a creative performer.  You have to be a creative business person.  You have to be good at what I&#8217;m calling &#8220;lateral thinking&#8221;.  Or thinking creatively across multiple domains.</p>
<p>I simply believe: gone are the days where you could practice hard, stand up on stage, play some music, and people just liked your music or not and then paid you for recordings. Actually&#8230; did those day&#8217;s ever exist?</p>
<p>- Chris</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.christopherlavender.com/2012/07/09/thoughts-on-music-making-for-money/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Chipping Away</title>
		<link>http://www.christopherlavender.com/2012/07/03/chipping-away/</link>
		<comments>http://www.christopherlavender.com/2012/07/03/chipping-away/#comments</comments>
		<pubDate>Tue, 03 Jul 2012 18:57:10 +0000</pubDate>
		<dc:creator>clavender</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.christopherlavender.com/?p=20</guid>
		<description><![CDATA[I have finally started chipping away at getting this web site back up to snuff.  Instead of knocking it out in one go I&#8217;ve decided to hit it a little bit every week, which is a much more realistic plan &#8230; <a href="http://www.christopherlavender.com/2012/07/03/chipping-away/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>I have finally started chipping away at getting this web site back up to snuff.  Instead of knocking it out in one go I&#8217;ve decided to hit it a little bit every week, which is a much more realistic plan given my current work schedule.</p>
<p>Over the next few weeks I&#8217;ll also be posting some recent thoughts on all aspects of iOS software development, but for now it&#8217;s back to work.  So stay tuned&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.christopherlavender.com/2012/07/03/chipping-away/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Under Construction</title>
		<link>http://www.christopherlavender.com/2012/05/06/under-construction/</link>
		<comments>http://www.christopherlavender.com/2012/05/06/under-construction/#comments</comments>
		<pubDate>Sun, 06 May 2012 22:21:16 +0000</pubDate>
		<dc:creator>clavender</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.christopherlavender.com/?p=4</guid>
		<description><![CDATA[Due to an untimely need to switch hosting companies, my old site is down for the count.  (Probably a good thing really.)  Thus, necessitating a website redo. Problem is that since I have started working as an independent contractor, have been &#8230; <a href="http://www.christopherlavender.com/2012/05/06/under-construction/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Due to an untimely need to switch hosting companies, my old site is down for the count.  (Probably a good thing really.)  Thus, necessitating a website redo.</p>
<p>Problem is that since I have started working as an independent contractor, have been completely overwhelmed with work and have had absolutely no extra time to focus on this.  It will happen eventually however.</p>
<p>In the meantime, if you&#8217;re simply trying to find out more information about me I&#8217;ll direct you to my <a href="http://www.linkedin.com/pub/chris-lavender/38/8a5/73a">LinkedIn page</a> where you can also find contact information.</p>
<p>Thanks!</p>
<p>-Chris</p>
]]></content:encoded>
			<wfw:commentRss>http://www.christopherlavender.com/2012/05/06/under-construction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
