<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>loosy|goosy|ness - Blog - movies</title>
    <link>http://www.loosy-goosy-ness.com/</link>
    <description>]..lost &amp; found in translation between bits &amp; bytes..[</description>
    <language>en-us</language>
    <copyright>Christian Maier</copyright>
    <lastBuildDate>Fri, 22 Aug 2008 14:17:55 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>agentcoyote@googlemail.com</managingEditor>
    <webMaster>agentcoyote@googlemail.com</webMaster>
    <item>
      <trackback:ping>http://www.loosy-goosy-ness.com/Trackback.aspx?guid=d659f8b5-dd8e-4c2f-a1c2-508aa7f8bf45</trackback:ping>
      <pingback:server>http://www.loosy-goosy-ness.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.loosy-goosy-ness.com/PermaLink,guid,d659f8b5-dd8e-4c2f-a1c2-508aa7f8bf45.aspx</pingback:target>
      <dc:creator>Christian</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
This tutorial is about how to configure your web server to stream your own movies
on your web page just like <a href="http://video.google.com/" name="">video.google.com</a> does.
</p>
        <p>
          <strong>Requirements:</strong>
        </p>
        <ul>
          <li>
Windows Server 2003 
</li>
          <li>
IIS 5.0/6.0 
</li>
          <li>
ffmpeg.exe (from <a title="http://ffmpeg.mplayerhq.hu/" href="http://ffmpeg.mplayerhq.hu">http://ffmpeg.mplayerhq.hu</a> or <a title="Download latest beta version here" href="http://sourceforge.net/project/showfiles.php?group_id=205275&amp;package_id=248632">download
latest beta version here</a>) 
</li>
          <li>
flvtool2 (from <a title="http://inlet-media.de/flvtool2" href="http://inlet-media.de/flvtool2">http://inlet-media.de/flvtool2</a>) 
</li>
          <li>
a GUI for ffmpeg (if you don't want to use the console, e.g. Avanti <a title="http://avanti.arrozcru.com/" href="http://avanti.arrozcru.com">http://avanti.arrozcru.com</a>) 
</li>
          <li>
a FLV Streaming Player (e.g. FLV-Scrubber 3.0 by Fabian Topfstedt: <a title="http://topfstedt.de/FLVScrubber3/FLVScrubber.swf" href="http://topfstedt.de/FLVScrubber3/FLVScrubber.swf">http://topfstedt.de/FLVScrubber3/FLVScrubber.swf</a>) 
</li>
          <li>
a FLV Player (e.g. <a title="http://flv-player.softonic.de/" href="http://flv-player.softonic.de">http://flv-player.softonic.de</a>)<br /></li>
        </ul>
        <p>
          <strong>
            <font color="#0000a0" size="4">1. Configuring Windows Server 2003 and IIS</font>
          </strong>
        </p>
        <p>
Add a new web site in your IIS and don't forget to select "Run Scripts (such as ASP)".
</p>
        <p>
Using this HTTP handler you can easily FLV streaming downloads just like . All you
need is to install on your IIS 5.0/6.0 the following HTTP handler and to get this
to work correctly, you will need to make sure that IIS handles request for .flv files.
In your site's properties, click the "Home directory tab" and click the "Configuration"
button. You'll get a form like this:
</p>
        <p align="center">
          <img src="http://stage.orchestra.it/kfra/images/iis1.jpg" />
        </p>
        <p>
Add the entry for .flv, click edit, and copy the path in the executable field. This
is the aspnet_isapi.dll for the current version of the .NET Framework of your virtual
site. Cancel out of that dialog and click "add." Paste the path into the executable,
use the extension .flv and set your verbs limited to "GET, POST, HEAD, DEBUG" like
this:
</p>
        <p align="center">
          <img src="http://stage.orchestra.it/kfra/images/iis2.jpg" />
        </p>
        <p>
Now any request for a .flv file on the site will be handled by ASP.NET. Since the
server-wide machine.config file doesn't specify what class should handle the request,
a default handler is used unless we add the following lines to the web.config file
(of your web site): 
</p>
        <p>
          <strong>
            <font color="#0000a0" size="4">2. Coding</font>
          </strong>
        </p>
        <p>
          <strong>Web.config</strong>
        </p>
        <blockquote>
          <font face="Courier New">&lt;httpHandlers&gt;<br />
verb="*" path="*.flv" type="FLVStreaming" /&gt;<br />
&lt;/httpHandlers&gt;</font>
        </blockquote>
        <p>
          <strong>FLVStreaming.cs</strong>
        </p>
        <blockquote>
          <p>
            <font face="Courier New">using System;<br />
using System.IO;<br />
using System.Web;<br />
public class FLVStreaming : IHttpHandler<br />
{</font>
          </p>
          <p>
            <font face="Courier New">    // FLV header<br />
private static readonly byte[] _flvheader = HexToByte("464C5601010000000900000009");</font>
          </p>
          <p>
            <font face="Courier New">public FLVStreaming()<br />
    {<br />
    }<br />
public void ProcessRequest(HttpContext context)<br />
    {<br />
try<br />
{<br />
int pos;<br />
int length;<br />
// Check start parameter if present<br />
string filename = Path.GetFileName(context.Request.FilePath);<br />
using (FileStream fs = new FileStream(context.Server.MapPath(filename), FileMode.Open,
FileAccess.Read, FileShare.Read))<br />
            {<br />
string qs = context.Request.Params["start"];<br />
if (string.IsNullOrEmpty(qs))<br />
               
{<br />
                   
pos = 0;<br />
                   
length = Convert.ToInt32(fs.Length);<br />
               
}<br />
else<br />
{<br />
                   
pos = Convert.ToInt32(qs);<br />
                   
length = Convert.ToInt32(fs.Length - pos) + _flvheader.Length;<br />
               
}<br />
// Add HTTP header stuff: cache, content type and length        
<br />
context.Response.Cache.SetCacheability(HttpCacheability.Public);<br />
               
context.Response.Cache.SetLastModified(DateTime.Now);<br />
               
context.Response.AppendHeader("Content-Type", "video/x-flv");<br />
               
context.Response.AppendHeader("Content-Length", length.ToString());<br />
// Append FLV header when sending partial file<br />
if (pos &gt; 0)<br />
               
{<br />
                   
context.Response.OutputStream.Write(_flvheader, 0, _flvheader.Length);<br />
                   
fs.Position = pos;<br />
               
}<br />
// Read buffer and write stream to the response stream<br />
const int buffersize = 16384;<br />
byte[] buffer = new byte[buffersize];<br />
int count = fs.Read(buffer, 0, buffersize);<br />
while (count &gt; 0)<br />
               
{<br />
if (context.Response.IsClientConnected)<br />
                   
{<br />
                       
context.Response.OutputStream.Write(buffer, 0, count);<br />
                       
count = fs.Read(buffer, 0, buffersize);<br />
                   
}<br />
else<br />
{<br />
                       
count = -1;<br />
                   
}<br />
               
}<br />
            }<br />
        }<br />
catch (Exception ex)<br />
        {<br />
            System.Diagnostics.Debug.WriteLine(ex.ToString());<br />
        }<br />
    }<br />
public bool IsReusable<br />
    {<br />
get { return true; }<br />
    }<br />
private static byte[] HexToByte(string hexString)<br />
    {<br />
byte[] returnBytes = new byte[hexString.Length / 2];<br />
for (int i = 0; i &lt; returnBytes.Length; i++)<br />
            returnBytes[i]
= Convert.ToByte(hexString.Substring(i * 2, 2), 16);<br />
return returnBytes;<br />
    }</font>
          </p>
          <p>
            <font face="Courier New">}</font>
          </p>
        </blockquote>
        <p>
All you need now to stream your favorite FLV movies is a custom-made player which
is fetching the contents passing to the request the<strong> ?start=</strong> parameter
in order to seek the current position inside the video file. 
</p>
        <p>
          <a href="http://www.topfstedt.de/weblog/?page_id=208" target="_blank">Fabian Topfstedt</a> has
one available onto his site (<a href="http://topfstedt.de/FLVScrubber3/FLVScrubber.swf" target="_blank">get
the player</a> and place it in your site document root).
</p>
        <p>
To use Fabian player you have to embed the following HTML code inside your page (and
of course you should change the path to you .flv video and player):
</p>
        <p>
 <textarea style="WIDTH: 516px; HEIGHT: 256px" rows="1" cols="1">&lt;object id="FLVScrubber"
width="450" height="253" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"&gt;&lt;param
name="movie" value="http://topfstedt.de/FLVScrubber3/FLVScrubber.swf"/&gt;&lt;param
name="bgcolor" value="#000000"/&gt;&lt;param name="allowScriptAccess" value="sameDomain"/&gt;&lt;param
name="allowFullScreen" value="true"/&gt;&lt;param name="flashVars" value="file=http://www.nibbler.at/republicofideas.flv&amp;previewImage=http://nibbler.at/republicofideas.jpg"/&gt;&lt;embed
src="http://www.topfstedt.de/FLVScrubber3/FLVScrubber.swf" bgcolor="#000000" width="450"
height="253" name="FLVScrubber" allowScriptAccess="sameDomain" allowFullScreen="true"
flashVars="file=http://www.nibbler.at/republicofideas.flv&amp;previewImage=http://nibbler.at/republicofideas.jpg"
type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"&gt;&lt;/object&gt;</textarea></p>
        <p>
There are three attributes of interest: Width and height define the resolution of
FLV-Scrubber. If your videos’ native resolution is eg. 320×240 pixels, you might want
to set width to 320 and height to 240. No problem if does not match, the video just
will be scaled up or down. The third attribute is “flashvars”. That’s where you change
the bahaviour and pass over information to FLVScrubber. You need to set at least <i>file</i> here,
to link to the video you want to play. Everything else is optional (key/value pairs
inside the flashvar attribute are separated using <i>&amp;</i>). Here is a complete
list: 
</p>
        <ul>
          <li>
            <i>file=[URL]</i> defines which video to show 
</li>
          <li>
            <i>&amp;autoStart</i> lets the video start immediately 
</li>
          <li>
            <i>&amp;bufferTime=[number]</i> changes the buffer time (default is 3 seconds) 
</li>
          <li>
            <i>&amp;clickTag=[URL]</i> defines a target to call after video ended 
</li>
          <li>
            <i>&amp;credit=[(URL encoded) text]</i> to show a credit like your company name in
the context menu 
</li>
          <li>
            <i>&amp;link=[URL]</i> defines a website to open when user clicks into the video 
</li>
          <li>
            <i>&amp;linkTarget=[blank,parent,self,top]</i> defines the target of the website above
(default: blank) 
</li>
          <li>
            <i>&amp;loop=true</i> lets your video replay itself instead of ending (default: false) 
</li>
          <li>
            <i>&amp;previewImage=[URL]</i> sets an backgroundimage as preview before playback
starts 
</li>
          <li>
            <i>&amp;scrubbing=false</i> use that, if you’re webserver has no enabled module for
fake streaming (default: true) 
</li>
          <li>
            <i>&amp;seeking=false</i> disallows the user to seek inside the video (default: true) 
</li>
          <li>
            <i>&amp;secondsToHide=[number]</i> defines amount of seconds that the controlbar waits
before hiding (0 means never, default is 5) 
</li>
          <li>
            <i>&amp;startAt=[number]</i> defines the the second where the playback will start
(default:0) 
</li>
        </ul>
        <p>
          <br />
          <strong>
            <font color="#0000a0" size="4">3. Converting your movie into FLV format</font>
          </strong>
        </p>
        <p>
Now you need to convert/encode a video file (e.g. .avi) into a .flv by using <a href="http://ffmpeg.mplayerhq.hu/" name="">ffmpeg</a> and <a href="http://inlet-media.de/flvtool2" name="">flvtool2</a> to
index your in order to add the correct metadata inside the FLV file. You can do this
by using the console (e.g): 
</p>
        <blockquote>
          <p>
            <font face="Courier New">ffmpege.exe -i test.avi test.flv<br />
flvtool2.exe -U test.flv</font>
          </p>
        </blockquote>
        <p>
or by using a GUI for ffmpeg like Avanti (<a title="http://avanti.arrozcru.com" href="http://avanti.arrozcru.com">http://avanti.arrozcru.com</a>):
</p>
        <p align="center">
          <img src="http://avanti.arrozcru.com/avanti_gui.png" />
        </p>
        <p>
(don't forget to copy the ffmpeg.exe in your ../avanti/ffmpeg folder and load the
"FLASH HQ" template from the Avanti menu). If you are a proud owner of Adobe Flash
Professional 8 you can use the <a href="http://www.adobe.com/products/flash/flashpro/productinfo/encoder/" target="_blank">Flash
8 Video Encoder</a> and you don't need ffmpeg and flvtool2 to encode and index your
videos. 
</p>
        <p>
After encoding your video you can use a PLV Player (e.g. <a title="http://flv-player.softonic.de/" href="http://flv-player.softonic.de">http://flv-player.softonic.de</a>)
to check if .flv file match your needs (e.g. correct resolution, bitrate...).
</p>
        <p>
Now upload all file to your web server and your web site root should look like:
</p>
        <blockquote>
          <p>
yourdirectory/App_Code/FLVStreaming.cs<br />
yourdirectory/Web.Config<br />
yourdirectory/default.htm<br />
yourdirectory/FLVScrubber.swf<br />
yourdirectory/yourmovie.flv
</p>
        </blockquote>
        <img width="0" height="0" src="http://www.loosy-goosy-ness.com/aggbug.ashx?id=d659f8b5-dd8e-4c2f-a1c2-508aa7f8bf45" />
      </body>
      <title>FLV Flash video streaming with ASP.NET 2.0, IIS and HTTP handler</title>
      <guid isPermaLink="false">http://www.loosy-goosy-ness.com/PermaLink,guid,d659f8b5-dd8e-4c2f-a1c2-508aa7f8bf45.aspx</guid>
      <link>http://www.loosy-goosy-ness.com/2008/08/22/FLVFlashVideoStreamingWithASPNET20IISAndHTTPHandler.aspx</link>
      <pubDate>Fri, 22 Aug 2008 14:17:55 GMT</pubDate>
      <description>&lt;p&gt;
This tutorial is about how to configure your web server to stream your own movies
on your web page just like &lt;a href="http://video.google.com/" name=""&gt;video.google.com&lt;/a&gt; does.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Requirements:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Windows Server 2003 
&lt;li&gt;
IIS 5.0/6.0 
&lt;li&gt;
ffmpeg.exe (from &lt;a title=http://ffmpeg.mplayerhq.hu/ href="http://ffmpeg.mplayerhq.hu"&gt;http://ffmpeg.mplayerhq.hu&lt;/a&gt; or &lt;a title="Download latest beta version here" href="http://sourceforge.net/project/showfiles.php?group_id=205275&amp;amp;package_id=248632"&gt;download
latest beta version here&lt;/a&gt;) 
&lt;li&gt;
flvtool2 (from &lt;a title=http://inlet-media.de/flvtool2 href="http://inlet-media.de/flvtool2"&gt;http://inlet-media.de/flvtool2&lt;/a&gt;) 
&lt;li&gt;
a GUI for ffmpeg (if you don't want to use the console, e.g. Avanti &lt;a title=http://avanti.arrozcru.com/ href="http://avanti.arrozcru.com"&gt;http://avanti.arrozcru.com&lt;/a&gt;) 
&lt;li&gt;
a FLV Streaming Player (e.g. FLV-Scrubber 3.0 by Fabian Topfstedt: &lt;a title=http://topfstedt.de/FLVScrubber3/FLVScrubber.swf href="http://topfstedt.de/FLVScrubber3/FLVScrubber.swf"&gt;http://topfstedt.de/FLVScrubber3/FLVScrubber.swf&lt;/a&gt;) 
&lt;li&gt;
a FLV Player (e.g. &lt;a title=http://flv-player.softonic.de/ href="http://flv-player.softonic.de"&gt;http://flv-player.softonic.de&lt;/a&gt;)&lt;br&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;&lt;font color=#0000a0 size=4&gt;1. Configuring Windows Server 2003 and IIS&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Add a new web site in your IIS and don't forget to select "Run Scripts (such as ASP)".
&lt;/p&gt;
&lt;p&gt;
Using this HTTP handler you can easily FLV streaming downloads just like . All you
need is to install on your IIS 5.0/6.0 the following HTTP handler and to get this
to work correctly, you will need to make sure that IIS handles request for .flv files.
In your site's properties, click the "Home directory tab" and click the "Configuration"
button. You'll get a form like this:
&lt;/p&gt;
&lt;p align=center&gt;
&lt;img src="http://stage.orchestra.it/kfra/images/iis1.jpg"&gt; 
&lt;/p&gt;
&lt;p&gt;
Add the entry for .flv, click edit, and copy the path in the executable field. This
is the aspnet_isapi.dll for the current version of the .NET Framework of your virtual
site. Cancel out of that dialog and click "add." Paste the path into the executable,
use the extension .flv and set your verbs limited to "GET, POST, HEAD, DEBUG" like
this:
&lt;/p&gt;
&lt;p align=center&gt;
&lt;img src="http://stage.orchestra.it/kfra/images/iis2.jpg"&gt; 
&lt;/p&gt;
&lt;p&gt;
Now any request for a .flv file on the site will be handled by ASP.NET. Since the
server-wide machine.config file doesn't specify what class should handle the request,
a default handler is used unless we add the following lines to the web.config file
(of your web site): 
&lt;p&gt;
&lt;strong&gt;&lt;font color=#0000a0 size=4&gt;2. Coding&lt;/font&gt;&lt;/strong&gt; 
&lt;p&gt;
&lt;strong&gt;Web.config&lt;/strong&gt; &lt;blockquote&gt;&lt;font face="Courier New"&gt;&amp;lt;httpHandlers&amp;gt;&lt;br&gt;
verb="*" path="*.flv" type="FLVStreaming" /&amp;gt;&lt;br&gt;
&amp;lt;/httpHandlers&amp;gt;&lt;/font&gt;&lt;/blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;FLVStreaming.cs&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New"&gt;using System;&lt;br&gt;
using System.IO;&lt;br&gt;
using System.Web;&lt;br&gt;
public class FLVStreaming : IHttpHandler&lt;br&gt;
{&lt;/font&gt; 
&lt;p&gt;
&lt;font face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // FLV header&lt;br&gt;
private static readonly byte[] _flvheader = HexToByte("464C5601010000000900000009");&lt;/font&gt; 
&lt;p&gt;
&lt;font face="Courier New"&gt;public FLVStreaming()&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
public void ProcessRequest(HttpContext context)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
try&lt;br&gt;
{&lt;br&gt;
int pos;&lt;br&gt;
int length;&lt;br&gt;
// Check start parameter if present&lt;br&gt;
string filename = Path.GetFileName(context.Request.FilePath);&lt;br&gt;
using (FileStream fs = new FileStream(context.Server.MapPath(filename), FileMode.Open,
FileAccess.Read, FileShare.Read))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
string qs = context.Request.Params["start"];&lt;br&gt;
if (string.IsNullOrEmpty(qs))&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
pos = 0;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
length = Convert.ToInt32(fs.Length);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;br&gt;
else&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
pos = Convert.ToInt32(qs);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
length = Convert.ToInt32(fs.Length - pos) + _flvheader.Length;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;br&gt;
// Add HTTP header stuff: cache, content type and length&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
context.Response.Cache.SetCacheability(HttpCacheability.Public);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
context.Response.Cache.SetLastModified(DateTime.Now);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
context.Response.AppendHeader("Content-Type", "video/x-flv");&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
context.Response.AppendHeader("Content-Length", length.ToString());&lt;br&gt;
// Append FLV header when sending partial file&lt;br&gt;
if (pos &amp;gt; 0)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
context.Response.OutputStream.Write(_flvheader, 0, _flvheader.Length);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
fs.Position = pos;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;br&gt;
// Read buffer and write stream to the response stream&lt;br&gt;
const int buffersize = 16384;&lt;br&gt;
byte[] buffer = new byte[buffersize];&lt;br&gt;
int count = fs.Read(buffer, 0, buffersize);&lt;br&gt;
while (count &amp;gt; 0)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{&lt;br&gt;
if (context.Response.IsClientConnected)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
context.Response.OutputStream.Write(buffer, 0, count);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
count = fs.Read(buffer, 0, buffersize);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;br&gt;
else&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
count = -1;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
catch (Exception ex)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.Debug.WriteLine(ex.ToString());&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
public bool IsReusable&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
get { return true; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
private static byte[] HexToByte(string hexString)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
byte[] returnBytes = new byte[hexString.Length / 2];&lt;br&gt;
for (int i = 0; i &amp;lt; returnBytes.Length; i++)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returnBytes[i]
= Convert.ToByte(hexString.Substring(i * 2, 2), 16);&lt;br&gt;
return returnBytes;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Courier New"&gt;}&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
All you need now to stream your favorite FLV movies is a custom-made player which
is fetching the contents passing to the request the&lt;strong&gt; ?start=&lt;/strong&gt; parameter
in order to seek the current position inside the video file. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.topfstedt.de/weblog/?page_id=208" target=_blank&gt;Fabian Topfstedt&lt;/a&gt; has
one available onto his site (&lt;a href="http://topfstedt.de/FLVScrubber3/FLVScrubber.swf" target=_blank&gt;get
the player&lt;/a&gt; and place it in your site document root).
&lt;/p&gt;
&lt;p&gt;
To use Fabian player you have to embed the following HTML code inside your page (and
of course you should change the path to you .flv video and player):
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;textarea style="WIDTH: 516px; HEIGHT: 256px" rows=1 cols=1&gt;&amp;lt;object id="FLVScrubber"
width="450" height="253" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"&amp;gt;&amp;lt;param
name="movie" value="http://topfstedt.de/FLVScrubber3/FLVScrubber.swf"/&amp;gt;&amp;lt;param
name="bgcolor" value="#000000"/&amp;gt;&amp;lt;param name="allowScriptAccess" value="sameDomain"/&amp;gt;&amp;lt;param
name="allowFullScreen" value="true"/&amp;gt;&amp;lt;param name="flashVars" value="file=http://www.nibbler.at/republicofideas.flv&amp;amp;previewImage=http://nibbler.at/republicofideas.jpg"/&amp;gt;&amp;lt;embed
src="http://www.topfstedt.de/FLVScrubber3/FLVScrubber.swf" bgcolor="#000000" width="450"
height="253" name="FLVScrubber" allowScriptAccess="sameDomain" allowFullScreen="true"
flashVars="file=http://www.nibbler.at/republicofideas.flv&amp;amp;previewImage=http://nibbler.at/republicofideas.jpg"
type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"&amp;gt;&amp;lt;/object&amp;gt;&lt;/textarea&gt;
&lt;/p&gt;
&lt;p&gt;
There are three attributes of interest: Width and height define the resolution of
FLV-Scrubber. If your videos’ native resolution is eg. 320×240 pixels, you might want
to set width to 320 and height to 240. No problem if does not match, the video just
will be scaled up or down. The third attribute is “flashvars”. That’s where you change
the bahaviour and pass over information to FLVScrubber. You need to set at least &lt;i&gt;file&lt;/i&gt; here,
to link to the video you want to play. Everything else is optional (key/value pairs
inside the flashvar attribute are separated using &lt;i&gt;&amp;amp;&lt;/i&gt;). Here is a complete
list: 
&lt;ul&gt;
&lt;li&gt;
&lt;i&gt;file=[URL]&lt;/i&gt; defines which video to show 
&lt;li&gt;
&lt;i&gt;&amp;amp;autoStart&lt;/i&gt; lets the video start immediately 
&lt;li&gt;
&lt;i&gt;&amp;amp;bufferTime=[number]&lt;/i&gt; changes the buffer time (default is 3 seconds) 
&lt;li&gt;
&lt;i&gt;&amp;amp;clickTag=[URL]&lt;/i&gt; defines a target to call after video ended 
&lt;li&gt;
&lt;i&gt;&amp;amp;credit=[(URL encoded) text]&lt;/i&gt; to show a credit like your company name in
the context menu 
&lt;li&gt;
&lt;i&gt;&amp;amp;link=[URL]&lt;/i&gt; defines a website to open when user clicks into the video 
&lt;li&gt;
&lt;i&gt;&amp;amp;linkTarget=[blank,parent,self,top]&lt;/i&gt; defines the target of the website above
(default: blank) 
&lt;li&gt;
&lt;i&gt;&amp;amp;loop=true&lt;/i&gt; lets your video replay itself instead of ending (default: false) 
&lt;li&gt;
&lt;i&gt;&amp;amp;previewImage=[URL]&lt;/i&gt; sets an backgroundimage as preview before playback
starts 
&lt;li&gt;
&lt;i&gt;&amp;amp;scrubbing=false&lt;/i&gt; use that, if you’re webserver has no enabled module for
fake streaming (default: true) 
&lt;li&gt;
&lt;i&gt;&amp;amp;seeking=false&lt;/i&gt; disallows the user to seek inside the video (default: true) 
&lt;li&gt;
&lt;i&gt;&amp;amp;secondsToHide=[number]&lt;/i&gt; defines amount of seconds that the controlbar waits
before hiding (0 means never, default is 5) 
&lt;li&gt;
&lt;i&gt;&amp;amp;startAt=[number]&lt;/i&gt; defines the the second where the playback will start
(default:0) 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;br&gt;
&lt;strong&gt;&lt;font color=#0000a0 size=4&gt;3. Converting your movie into FLV format&lt;/font&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Now you need to convert/encode a video file (e.g. .avi) into a .flv by using &lt;a href="http://ffmpeg.mplayerhq.hu/" name=""&gt;ffmpeg&lt;/a&gt; and &lt;a href="http://inlet-media.de/flvtool2" name=""&gt;flvtool2&lt;/a&gt; to
index your in order to add the correct metadata inside the FLV file. You can do this
by using the console (e.g): &lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Courier New"&gt;ffmpege.exe -i test.avi test.flv&lt;br&gt;
flvtool2.exe -U test.flv&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
or by using a GUI for ffmpeg like Avanti (&lt;a title=http://avanti.arrozcru.com href="http://avanti.arrozcru.com"&gt;http://avanti.arrozcru.com&lt;/a&gt;):
&lt;/p&gt;
&lt;p align=center&gt;
&lt;img src="http://avanti.arrozcru.com/avanti_gui.png"&gt; 
&lt;/p&gt;
&lt;p&gt;
(don't forget to copy the ffmpeg.exe in your ../avanti/ffmpeg folder and load the
"FLASH HQ" template from the Avanti menu). If you are a proud owner of Adobe Flash
Professional 8 you can use the &lt;a href="http://www.adobe.com/products/flash/flashpro/productinfo/encoder/" target=_blank&gt;Flash
8 Video Encoder&lt;/a&gt; and you don't need ffmpeg and flvtool2 to encode and index your
videos. 
&lt;/p&gt;
&lt;p&gt;
After encoding your video you can use a PLV Player (e.g. &lt;a title=http://flv-player.softonic.de/ href="http://flv-player.softonic.de"&gt;http://flv-player.softonic.de&lt;/a&gt;)
to check if .flv file match your needs (e.g. correct resolution, bitrate...).
&lt;/p&gt;
&lt;p&gt;
Now upload all file to your web server and your web site root should look like:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
yourdirectory/App_Code/FLVStreaming.cs&lt;br&gt;
yourdirectory/Web.Config&lt;br&gt;
yourdirectory/default.htm&lt;br&gt;
yourdirectory/FLVScrubber.swf&lt;br&gt;
yourdirectory/yourmovie.flv
&lt;/p&gt;
&lt;/blockquote&gt;&lt;img width="0" height="0" src="http://www.loosy-goosy-ness.com/aggbug.ashx?id=d659f8b5-dd8e-4c2f-a1c2-508aa7f8bf45" /&gt;</description>
      <category>coding</category>
      <category>EN</category>
      <category>internet</category>
      <category>movies</category>
    </item>
    <item>
      <trackback:ping>http://www.loosy-goosy-ness.com/Trackback.aspx?guid=b1485e88-09bc-48e6-b2b7-260cf1677c8a</trackback:ping>
      <pingback:server>http://www.loosy-goosy-ness.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.loosy-goosy-ness.com/PermaLink,guid,b1485e88-09bc-48e6-b2b7-260cf1677c8a.aspx</pingback:target>
      <dc:creator>Christian</dc:creator>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
[QUOTE] 
<br />
Okay, so I’m as big a Star Wars fan as the next guy, but this really threw me.
This YouTube video shows a “lost” beginning to the original Star Wars
movie, and it’s <i>terrible</i>. Apparently these scenes were cut due to “time
restrictions,” and boy am I glad. This is one of the best examples I’ve
seen of how editing makes a movie better. (Note: this apparently surfaced <a href="http://www.digg.com/movies/Lost_Scenes_From_Star_Wars_A_New_Hope">over
a year ago</a>, but the news has just reached headquarters, so to speak.)
</p>
        <p>
Watch the opening scenes, if you dare…
</p>
        <p align="center">
          <embed src="http://www.youtube.com/v/DCyPTM2FJgA&amp;rel=1&amp;border=1" width="425" height="373" type="application/x-shockwave-flash" wmode="transparent" />
        </p>
        <p align="left">
[/QUOTE]
</p>
        <p align="left">
Found on: <a title="http://www.mentalfloss.com/blogs/archives/10818" href="http://www.mentalfloss.com">http://www.mentalfloss.com</a></p>
        <img width="0" height="0" src="http://www.loosy-goosy-ness.com/aggbug.ashx?id=b1485e88-09bc-48e6-b2b7-260cf1677c8a" />
      </body>
      <title>The Lost &amp;ldquo;Star Wars&amp;rdquo; Opening Scenes</title>
      <guid isPermaLink="false">http://www.loosy-goosy-ness.com/PermaLink,guid,b1485e88-09bc-48e6-b2b7-260cf1677c8a.aspx</guid>
      <link>http://www.loosy-goosy-ness.com/2008/01/13/TheLostLdquoStarWarsrdquoOpeningScenes.aspx</link>
      <pubDate>Sun, 13 Jan 2008 13:35:28 GMT</pubDate>
      <description>&lt;p&gt;
[QUOTE] 
&lt;br /&gt;
Okay, so I&amp;#8217;m as big a Star Wars fan as the next guy, but this really threw me.
This YouTube video shows a &amp;#8220;lost&amp;#8221; beginning to the original Star Wars
movie, and it&amp;#8217;s &lt;i&gt;terrible&lt;/i&gt;. Apparently these scenes were cut due to &amp;#8220;time
restrictions,&amp;#8221; and boy am I glad. This is one of the best examples I&amp;#8217;ve
seen of how editing makes a movie better. (Note: this apparently surfaced &lt;a href="http://www.digg.com/movies/Lost_Scenes_From_Star_Wars_A_New_Hope"&gt;over
a year ago&lt;/a&gt;, but the news has just reached headquarters, so to speak.)
&lt;/p&gt;
&lt;p&gt;
Watch the opening scenes, if you dare&amp;#8230;
&lt;/p&gt;
&lt;p align="center"&gt;
&lt;embed src="http://www.youtube.com/v/DCyPTM2FJgA&amp;amp;rel=1&amp;amp;border=1" width="425" height="373" type="application/x-shockwave-flash" wmode="transparent" /&gt;
&lt;/p&gt;
&lt;p align="left"&gt;
[/QUOTE]
&lt;/p&gt;
&lt;p align="left"&gt;
Found on: &lt;a title="http://www.mentalfloss.com/blogs/archives/10818" href="http://www.mentalfloss.com"&gt;http://www.mentalfloss.com&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.loosy-goosy-ness.com/aggbug.ashx?id=b1485e88-09bc-48e6-b2b7-260cf1677c8a" /&gt;</description>
      <category>EN</category>
      <category>movies</category>
    </item>
  </channel>
</rss>