<?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>geobray.com &#187; streaming</title> <atom:link href="http://geobray.com/tag/streaming/feed/" rel="self" type="application/rss+xml" /><link>http://geobray.com</link> <description>Letters home from the high bandwidth future</description> <lastBuildDate>Mon, 26 Mar 2012 11:14:26 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Live TV Streaming to iPhone with HTTP</title><link>http://geobray.com/2010/03/26/live-tv-streaming-to-iphone-with-http/</link> <comments>http://geobray.com/2010/03/26/live-tv-streaming-to-iphone-with-http/#comments</comments> <pubDate>Fri, 26 Mar 2010 04:26:58 +0000</pubDate> <dc:creator>George Bray</dc:creator> <category><![CDATA[HowTo]]></category> <category><![CDATA[iphone]]></category> <category><![CDATA[streaming]]></category><guid
isPermaLink="false">http://geobray.com/?p=317</guid> <description><![CDATA[How to set up VLC with Apple's stream segmenter to transcode a UDP multicast MPEG-2 TV stream to iPhone compatible MPEG-4 using HTTP Live Streaming.]]></description> <content:encoded><![CDATA[<p>This &quot;How To&quot; recipe builds a transcoder to process live multicast streams into live and on-demand streams suitable for iPhone and similar devices.&nbsp;</p><p>This single-stream example uses a multicast transport stream containing MPEG-2, but could easily use a multicast or unicast stream in a different format. This example runs on Xserve and MacPro machines, it&#39;s a requirement that mediastreamsegmenter runs on OS X.</p><p><span
style="color:#f00;">Warning</span>: Reticulation of broadcast TV services requires the permission of the broadcaster.</p><p>Thanks to <a
href="http://www.anu.edu.au">ANU</a> for the opportunity to test this on a multicast-rich network.</p><p>&nbsp;</p><p
style="text-align: center; "><img
alt="" class="aligncenter size-full wp-image-355" height="320" src="http://geobray.com/wp-content/uploads/2010/03/BBCiPhone.jpg" title="BBCiPhone" width="480" /></p><p
style="text-align: center; ">Live BBC stream on iPhone via HTTP at 750Kbps</p><p>&nbsp;</p><h2>The Result</h2><p>One live MPEG-2 transport stream transcoded to be visible on the iPhone. VLC (and x264) transcode the stream to the required format for mediastreamsegmenter, which then saves the stream on disk under the webserver. It continually updates the index file so viewers can keep up. Depending on the content, the bitrate of the stream can be 500-900Kbps.</p><p>&nbsp;</p><p
style="text-align: center; "><a
href="http://geobray.com/wp-content/uploads/2010/03/HTML-menu.png"><img
alt="" class="aligncenter size-full wp-image-331" height="480" src="http://geobray.com/wp-content/uploads/2010/03/HTML-menu.png" style="cursor: default; " title="HTML menu" width="320" /></a></p><p
style="text-align: center; ">Web page on iPhone with text links to .m3u8 index file</p><p
style="text-align: center; ">&nbsp;</p><p
style="text-align: center; "><img
alt="" class="aligncenter size-full wp-image-328" height="266" src="http://geobray.com/wp-content/uploads/2010/03/iPhoneSim.jpg" title="iPhoneSim" width="503" /></p><p
style="text-align: center; ">Viewing the stream in the iPhone simulator</p><p
style="text-align: center; ">&nbsp;</p><p
style="text-align: center; "><img
alt="" class="aligncenter size-full wp-image-330" height="320" src="http://geobray.com/wp-content/uploads/2010/03/iPhoneScreenLive.png" title="iPhoneScreenLive" width="480" /></p><p
style="text-align: center; ">Screen shot of iPhone movieplayer without controls overlaid</p><p>&nbsp;</p><p
style="text-align: center; "><img
alt="" class="aligncenter size-full wp-image-348" height="301" src="http://geobray.com/wp-content/uploads/2010/03/screenshot_09.jpg" title="screenshot_09" width="317" /></p><p
style="text-align: center; ">A mid-range server can transcode three standard-definition 720&#215;576 MPEG-2 services.</p><p
style="text-align: center; ">&nbsp;</p><p
style="text-align: center; ">&nbsp;</p><h2>Required Parts</h2><ul><li>A live MPEG-2 TV service</li><li>The VLC application from <a
href="http://www.videolan.org">www.videolan.org</a></li><li>The mediastreamsegmenter program, free from Apple&#39;s <a
href="http://connect.apple.com/">Developer Connect</a></li></ul><h2>Documentation</h2><p
style="margin-left: 40px; "><a
href="http://developer.apple.com/mac/library/DOCUMENTATION/Darwin/Reference/ManPages/man1/mediastreamsegmenter.1.html">mediastreamsegmenter</a> Man Page</p><p
style="margin-left: 40px; ">Apple&#39;s <a
href="http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008332-CH1-DontLinkElementID_26">HTTP Live Streaming Documentation</a></p><p
style="margin-left: 40px; "><a
href="http://tools.ietf.org/id/draft-pantos-http-live-streaming">IETF Standard Submission</a></p><p
style="margin-left: 40px; "><a
href="http://wiki.videolan.org/VLC_command-line_help">VLC Command Line Help</a></p><h2>Installation</h2><p><strong>The Apache webserver</strong> is running above a directory that will contain the media.<br
/> (&nbsp;<span
class="Apple-style-span" style="font-family: monospace; ">/Volumes/mydisk/www/abc/&nbsp;<span
class="Apple-style-span" style="font-family: Arial, Verdana, sans-serif; ">in this example).</span></span></p><p><span
class="Apple-style-span" style="font-family: monospace; "><span
style="font-family:arial,helvetica,sans-serif;">The webserver is available to the outside</span><br
/> (<font
class="Apple-style-span">http://mywebserver.edu/abc/</font><font
class="Apple-style-span" face="Arial, Verdana, sans-serif"> &nbsp;in this example)</font></span></p><p
style="margin-left: 40px; "><span
class="Apple-style-span" style="font-family: monospace; "><span
class="Apple-style-span" style="font-family: Arial, Verdana, sans-serif; ">Apache mime types to be added:<br
/> <span
class="Apple-style-span" style="font-family: monospace; ">AddType application/x-mpegURL m3u8<br
/> AddType video/MP2T ts</span></span></span></p><p><strong>VLC</strong> is expected to be at <span
style="font-family:courier new,courier,monospace;">/Applications/VLC.app/</span></p><p><strong>mediastreamsegmenter</strong>&nbsp;gets installed to&nbsp;<span
style="font-family:courier new,courier,monospace;">/usr/bin/mediastreamsegmenter</span></p><p><strong>Your source stream</strong> is playable in VLC.<br
/> (&nbsp;<span
class="Apple-style-span" style="font-family: monospace; ">udp://@239.224.0.2:1234&nbsp;<span
class="Apple-style-span" style="font-family: Arial, Verdana, sans-serif; ">in this example<span
class="Apple-style-span" style="font-family: monospace; ">)</span></span></span></p><h2>The Script</h2><p>Save the script below to a text file, say&nbsp;<span
class="Apple-style-span" style="font-family: 'courier new', courier, monospace; ">abcstreamer.sh</span>&nbsp;- ensure there are no carriage returns in the command lines. Customise the <strong>bold</strong> items in the command lines to suit your environment.</p><hr
/><p><span
style="font-family:courier new,courier,monospace;"><span
style="background-color:yellow;">#!/bin/sh</span></span></p><p><span
style="font-family:courier new,courier,monospace;"><span
style="background-color:yellow;">rm -rf <strong>/Volumes/mydisk/www/abc/*</strong></span></span></p><p><span
style="font-family:courier new,courier,monospace;"><span
style="background-color:yellow;">/Applications/VLC.app/Contents/MacOS/VLC <strong>udp://@239.224.0.2:1234</strong> &#8211;intf=dummy &#8211;sout-transcode-audio-sync &#8211;sout=&#39;#transcode{vcodec=h264,venc=x264{aud,profile=baseline,level=30,keyint=30,bframes=0,ref=1,nocabac},acodec=mp4a,ab=56,deinterlace}:duplicate{dst=std{access=file,mux=ts,dst=-}}&#39; | mediastreamsegmenter -O -b <strong>http://mywebserver.edu/abc/</strong> -f <strong>/Volumes/mydisk/www/abc/</strong> -t 10 -s 4 -D &nbsp;</span></span></p><div><hr
/></div><div><p>Change permissions for you to execute it<br
/> <span
style="font-family: 'courier new', courier, monospace; ">chmod 744 abcstreamer.sh</span></p><p>Run it with<br
/> <span
style="font-family: 'courier new', courier, monospace; ">./abcstreamer.sh</span></p></div><h2>The Stream</h2><p><span
class="Apple-style-span" style="font-weight: normal; font-size: 12px; ">Watch the directory in the Finder to see the segments arrive. &nbsp;After a while the index file will be written, so you can now get the stream from your iPhone.</span></p><p>&nbsp;</p><p
style="text-align: center; "><img
alt="Screenshot of Folder collecting video segments" height="315" src="http://geobray.com/wp-content/uploads/image/screenshot_01.jpg" width="313" /></p><p>&nbsp;</p><div>The stream should be available at</div><div>&nbsp;</div><div><span
style="font-family:courier new,courier,monospace;">http://mywebserver.edu/abc/prog_index.m3u8</span></div><div>&nbsp;</div><div>Open the URL in Safari on your iPhone. You can also use QuickTime Player X on a Mac desktop to &quot;Open URL&quot;.</div><div>&nbsp;</div><div>&nbsp;</div><div
style="text-align: center; "><img
alt="" class="aligncenter size-full wp-image-340" height="122" src="http://geobray.com/wp-content/uploads/2010/03/openurl.jpg" title="openurl" width="508" /></div><div
style="text-align: center; ">&nbsp;</div><div>&nbsp;</div><div
style="text-align: center; "><a
href="http://geobray.com/wp-content/uploads/2010/03/MoviePlayerX.png"><img
alt="" class="aligncenter size-medium wp-image-339" height="252" src="http://geobray.com/wp-content/uploads/2010/03/MoviePlayerX-300x151.png" title="MoviePlayerX" width="500" /></a></div><div>&nbsp;</div><h2><font
class="Apple-style-span" size="3"><span
class="Apple-style-span" style="font-size: 12px; font-weight: normal;"><font
class="Apple-style-span" size="5"><span
class="Apple-style-span" style="font-size: 18px;"><b><br
/> </b></span></font></span></font></h2><h2>Serve It Up</h2><div>Here&#39;s an <span
style="font-family:courier new,courier,monospace;">index.html</span> file for your web server showing text links to your stream. Alternatively, try the <a
href="http://diveintohtml5.org/video.html">video tag</a> in that fancy new HTML5 browser you downloaded.</div><div>&nbsp;</div><div>&nbsp;</div><div><div
style="margin-left: 40px; "><span
class="Apple-style-span" style="font-family: monospace; ">&lt;html lang=&quot;en&quot;&gt;</span></div><div
style="margin-left: 40px; "><code>&lt;head&gt;</code></div><div
style="margin-left: 40px; "><span
class="Apple-style-span" style="font-family: monospace; ">&lt;title&gt;iPhoneTV&lt;/title&gt;</span></div><div
style="margin-left: 40px; "><span
class="Apple-style-span" style="font-family: monospace; ">&lt;/head&gt;</span></div><div
style="margin-left: 40px; "><code>&lt;body&gt;</code></div><div
style="margin-left: 40px; "><code><br
/> </code></div><div
style="margin-left: 40px; "><code>iPhone TV&lt;P&gt;</code></div><div
style="margin-left: 40px; "><code>&lt;HR&gt;</code></div><div
style="margin-left: 40px; "><code>&lt;H1&gt;&lt;a href=&quot;./abc/prog_index.m3u8&quot;&gt;ABC&lt;/H1&gt;</code></div><div
style="margin-left: 40px; "><code>&lt;HR&gt;</code></div><div
style="margin-left: 40px; "><code>&lt;H1&gt;&lt;a href=&quot;./bbc/prog_index.m3u8&quot;&gt;BBC&lt;/H1&gt;</code></div><div
style="margin-left: 40px; ">&nbsp;</div><div
style="margin-left: 40px; "><code>&lt;!-- &lt;video width=&quot;320&quot; height=&quot;240&quot;&gt;</code></div><div
style="margin-left: 40px; "><code>&lt;source src=&quot;./bbc/prog_index.m3u8&quot; /&gt;</code></div><div
style="margin-left: 40px; "><code>&lt;/video&gt;</code></div><div
style="margin-left: 40px; "><code>&nbsp;--&gt;</code></div><div
style="margin-left: 40px; "><code><br
/> </code></div><div
style="margin-left: 40px; "><code>&lt;/body&gt;</code></div><div
style="margin-left: 40px; "><code>&lt;/html&gt;</code></div><div
style="margin-left: 40px; "><font
class="Apple-style-span" face="monospace"><br
/> </font></div><h2>Stats</h2><div>&nbsp;</div><div
style="text-align: center; "><a
href="http://geobray.com/wp-content/uploads/2010/03/TrafficGraph1.jpg"><img
alt="" class="aligncenter size-full wp-image-373" height="311" src="http://geobray.com/wp-content/uploads/2010/03/TrafficGraph1.jpg" title="TrafficGraph1" width="659" /></a></div><div
style="text-align: center; ">Peaks are starting a new stream.</div><div
style="text-align: center; ">&nbsp;</div><div
style="text-align: center; "><a
href="http://geobray.com/wp-content/uploads/2010/03/cpugraph2.jpg"><img
alt="" class="aligncenter size-full wp-image-372" height="548" src="http://geobray.com/wp-content/uploads/2010/03/cpugraph2.jpg" title="cpugraph2" width="695" /></a></div><div
style="text-align: center; ">&nbsp;</div><div
style="text-align: center; "><a
href="http://geobray.com/wp-content/uploads/2010/03/trafficgraph33.jpg"><img
alt="" class="aligncenter size-full wp-image-371" height="566" src="http://geobray.com/wp-content/uploads/2010/03/trafficgraph33.jpg" title="trafficgraph33" width="723" /></a></div><div
style="text-align: center; ">&nbsp;</div><h2>Tips</h2><ul><li>These are by no means optimal settings, please post improvements in the comments.</li><li>Reset VLC&#39;s preferences to be sure you don&#39;t have any clashing settings.</li><li>Use mediastreamvalidator to debug the transport stream.</li><li>Consider <a
href="http://www.videolan.org/projects/dvblast.html">DVBlast</a> or <a
href="http://www.videolan.org/projects/multicat.html">Multicat</a> as additional tools for streaming and routing.&nbsp;</li></ul><h2>Updates</h2><ul><li>Added stats</li></ul><p>&nbsp;</p><p>&nbsp;</p><div
style="text-align: center; "><hr
/></div></div><div>&nbsp;</div><div
style="text-align: center; ">Many thanks to the&nbsp;<a
href="http://www.videolan.org">Videolan</a>&nbsp;and <a
href="http://www.videolan.org/developers/x264.html">x264</a> devs, and hats off to <a
href="http://www.ioncannon.net/programming/452/iphone-http-streaming-with-ffmpeg-and-an-open-source-segmenter/">ioncannon</a> and <a
href="http://www.nerdlogger.com/2010/03/how-to-stream-live-hdvdv-to-iphone.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+nerdlogger+%28N.E.R.D.%29">nerdlogger</a> for prior art.</div> ]]></content:encoded> <wfw:commentRss>http://geobray.com/2010/03/26/live-tv-streaming-to-iphone-with-http/feed/</wfw:commentRss> <slash:comments>22</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using xcache
Page Caching using xcache (User agent is rejected)
Database Caching 3/9 queries in 0.066 seconds using xcache
Object Caching 230/235 objects using xcache

Served from: geobray.com @ 2012-05-19 15:16:16 -->
