Streaming media -> youtube style

Wouldn’t it be nice to create your own youtube movies and host them on your own private server? Why you ask, well maybe it’s content you don’t want others to view. Prolly this can be done using youtube, but hey I have my own servers and I want it where I have full access! (as do many companies actually).

So how do you do this using opensource tools? Actually very, very simple

I started from this blog entry. But as I’m using ubuntu dapper, I have the nice debian apt tool 🙂

So in short here is what you do:


apt-get install mencoder
apt-get install ruby
apt-get install flvtool2

And I had my tools install (maybe you need some extra depencies here) don’t know actually.
Then the commands like in the previous posts


mencoder \
orig_file.ext \
-ofps 25 \
-o dest_file.flv \
-of lavf \
-oac mp3lame \
-lameopts abr:br=64 \
-srate 22050 \
-ovc lavc \
-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames \
-lavcopts vcodec=flv:keyint=50:vbitrate=300:mbd=2:mv0:trell:\
v4mv:cbp:last_pred=3 -vop scale=320:240

and


flvtool2 -UP dest_file.flv

And you have your indexed flash movie. And may I note the importance of the indexed in the sentence once more. In the past I tried this with a long avi and believe me its no fun if you can’t forward or rewind!!

So then you put the flv file on your server. Now all you need is a flash movie player for playing your content. And I like the flowplayer. You download it, setup a small page like this


<object type="application/x-shockwave-flash" data="FlowPlayer.swf"
width="320" height="263" id="FlowPlayer">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="FlowPlayer.swf" />
<param name="quality" value="high" />
<param name="scale" value="noScale" />
<param name="wmode" value="transparent" />
<param name="flashvars" value="videoFile=dest_file.flv"/>
</object>

Et voila, you have your own streaming video. Now put it into a web application and you have your own streaming media center!!

OSS == SWEET

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.