"Streaming" FLV through MogileFS

dormando dormando at rydia.net
Sun Apr 15 10:16:21 UTC 2007


> Or is this not byte positioning and time positioning instead?
> 
> Educate me.  :)

(Should we move this convo to the perlbal list? I'm pretty offtopic now).

Okay! In line with everything else I've ever done, I was wrong!

Spent a little time googling since I can't sleep, and Flash's shitty API 
strikes again:

http://livedocs.adobe.com/flex/2/langref/flash/net/NetStream.html
^ This is all they have to work with. You can give it a file:// or an 
http:// url. Adobe _really_ wants you to buy a license for flash media 
server and use the RTMP protocol (http://osflash.org/documentation/rtmp, 
also see Red5 on the same site)

 From the sources of flowplayer.sourceforge.net, you see shit like this:

var seekPosition:Number = percentage * videoDurationSecs / 100;
var i:Number = findFrame(0, keyFrames.times.length,seekPosition)
[...]
ns.play(clip.getURL() + "?start=" + keyFrames.filepositions[i]);

Which is a starting point in _bytes_. I had it backwards before, 
http://rubyforge.org/projects/flvtool2/ is used to encode the IFrame 
metadata in the start of the flv files. The flash player loads the 
metadata when it first grabs the file, then it knows where all the 
frames are from there.

When a user clicks to seek, the flash player just restarts the player 
object with the new url (but doesn't load new metadata?)

When playing back the data, the 'server' just needs to inject the 
13-byte FLV header then seek to that exact position. So broken :(

uhh, so. Once I get some sleep I'll start reading on how to make perlbal 
support this more generically... Ideally it should be able to inject 
this crap if it's acting as either a webserver or as a proxy. Should 
perlbal even be the one to inject the crap?

Should also be able to support a start/stop range. Some players do 
'slicing' based on chapters, and for viewing gigantic files this is 
probably a better idea. So the flv file gets 'cue points' injected via 
flvtool2, which for an hour long movie, could be every 15 minutes. In a 
naiive setup, a flash player could grab from one cuepoint to the next to 
avoid attempting to load a 500+ megabyte file into ram, or present a 
list of starting points to the user. View just one chapter, view all 
chapters, etc.

More tomorrow. Sorry for the dump, but I wanted to fully understand why 
flv playback is the way it is, and the folks at work didn't know, and I 
assume this info is handy for Brad too.
-Dormando


More information about the mogilefs mailing list