Get front row seat and watch the development of micro-isv. We make cool product that solves all your problems...

logo

Friends
         
Video Streaming: Be your own YouTube
2009-04-29

Here are my notes for being your own Youtube/Vimeo and hosting and streaming video yourself. This is a good thing because you want to capture the value that your video creates, and not give it to someone else.

Encoding the Data

mencoder -o screencast-40.flv -of lavf -ovc lavc -oac mp3lame \
  -lameopts cbr:aq=0:br=32:mode=3 \
  -lavcopts vcodec=flv:vbitrate=8:trell:keyint=20 -fps 10 \
  -ofps 2.5 -vf scale=640:480 mf://output/*.png -audiofile\
   output/*.wav -lavfopts format=flv -af channels=1 #-frames 25

flvtool2 -UP screencast-40.flv

mencoder -o screencast-240.flv -of lavf -ovc lavc -oac mp3lame \
  -lameopts cbr:aq=0:br=64:mode=3 \
  -lavcopts vcodec=flv:vbitrate=176:trell:keyint=20 -fps 10 \
  -vf scale=640:480 mf://output/*.png -audiofile output/*.wav \
  -lavfopts format=flv -af channels=1 # -frames 100

flvtool2 -UP screencast-240.flv

mencoder -o screencast-500.flv -of lavf -ovc lavc -oac mp3lame \
  -lameopts cbr:aq=0:br=64:mode=3 \
  -lavcopts vcodec=flv:vbitrate=436:trell:keyint=20 -fps 10 \
  -vf scale=640:480 mf://output/*.png -audiofile output/*.wav \
  -lavfopts format=flv -af channels=1 # -frames 100

flvtool2 -UP screencast-500.flv

Hosting the streaming video

I just discovered SimpleCDN. Not only are they a cheap CDN, but they also provide flv and h264 pseudo-streaming, which is what you want to stream video. Right now they give you $15 of free hosting. Sweet. You want their 'StormFront' offering.

Flash Video Player

For this we will use Flowplayer and two plugins. The first is to support pseudostreaming and the second to do bandwidth detection.

FLV/h264 switching

if (flashembed.isSupported([9, 115]) ) {
// do h264
} else {
//do flv
}

Bandwidth detection

Use this plugin. Annoyingly I couldn't get the bandwidth test file to stream from the CDN, so it had to come from my webserver. This sucks, but shouldn't matter too much since the point of congestion will be at the user's end not mine.