Camtweet is TwitPic meets live video (from Justin.tv)
camtweet.com
camtweet.com
Yes you can; we've already done it. A coworker of mine hacked together an app to do it in a day or so. There's also some companies offering services to do it for you (Ripcode, etc).
and it only works for h264, so it's fairly pointless.
It's fairly trivial to do realtime transcoding (x264+ffmpeg+segmenter).
For video streaming from the iPhone, I'm not so sure, but I'd think you could use their existing functionality (but don't quote me on that).
A 320x240 video encodes at about 195 FPS on my Core 2 Duo Conroe 2Ghz with one encoding thread, using x264 and preset "veryfast".
Now, if we go up to a Quad at 3Ghz and use all four cores, we're up to 1170fps.
A Penryn is about 10% faster per-clock than a Conroe on x264. We're up to 1287fps.
A Core i7 is about 40% faster per-clock than a Conroe on x264, including the effects of Hyperthreading. We're up to 1802 FPS, or 60 streams, and we haven't even left our single processor. For all 2000 streams, we'll need 33 CPUs, or maybe a few more if we allow for a bit of overhead, just in case.
Not that hard now, is it? Bonus points: you save bandwidth, since H.264 compresses a lot better than Sorenson H.263 (FLV1).
(Also, preset "ultrafast" is another factor of two faster than that, though the quality is low enough that nobody should be using it...)
Assuming 'perfect scaling' and discounting such things as networking overhead are going to upset that picture by a considerable amount.
You'll be lucky to get to 500 Mbit out per physical machine using 16 cores and streaming to about 2000 users with 75 incoming streams. So that's roughly 5 streams per core.
To just multiplex 2000 streams to 40 K viewers with adaptive frame rate you'll need roughly 30 sixteen core machines, note that that does NOT include transcoding yet.
Why do you have the same computers handling encoding as distribution? That's stupid.
To just multiplex 2000 streams to 40 K viewers with adaptive frame rate you'll need roughly 30 sixteen core machines, note that that does NOT include transcoding yet.
Then your multiplexer is unimaginably inefficient. Last summer I worked for a company that multiplexes live streams for millions of viewers; it is not as hard as you think, especially since you only have to do the work once per channel, not once per user, since all users watching a given channel receive the same stream.
Do you mean that each user receives a different framerate based on the download bandwidth that he has? You really only need a couple framerates to cover all users--and I suspect you mean "bitrate", not "framerate", in this case (though changing the framerate is one effective way to improve the quality of an adaptive bitrate scheme).
This means that every user has an individual stream because the connection quality can change very rapidly over short periods of time, they might switch a secondary stream on (or off) for a moment and whatever else can change the quality of the connection. You can't use very large windows because that would mean that if there was a hickup in the line it would take a long time to recover, which would degrade perceived quality.
Video is relatively forgiving by the way, the audio is the real kicker, a single packet delivered a little bit too late will instantly cause annoyance whereas with the video you can be a little early or late and it doesn't seem to matter too much.
Initial encoding happens on different machines (obviously) but a stream multiplexer that maximizes the end user experience is a lot more complicated than just encoding to a preset selection of rates, after all every keyframe and subsequent updates have their encoding scheme determined by the throughput measured during the transmission of the keyframe(s)+updates just preceding it.
For non-live consumption the situation is a lot easier, you can pre-buffer and that takes care of most problems but in live transmissions that is not possible unless you want horrible lag (which does not work when the connection is two way, it screws up the interaction between people).
It's really not that difficult; if you have one encode going per-user, you can just reinitialize the encoder's ratecontrol, and if you don't have one per user, you can simply use a short GOP and swap the bitrate at each keyframe, in the same way that H.264 extended profile proposed using Switching Pictures (but in a way that real software actually supports). Of course this latter method requires multiple simultaneous encodes per channel, or an SVC-like system (which almost nobody supports, and for which there aren't any good software implementations anyways).
Is it really that important for Justin.TV to have less than one second latency? The vast majority of the site is completely non-latency-critical (from my cursory browsing of it). Heck, the broadcast company I worked for last summer had over 10 second latency and nobody ever complained about that--and that was live television, including sports games and so forth.
Plus, if Justin.TV is already doing a scheme like this, surely upgrading to a better, faster encoder is going to decrease, not increase, their CPU load.
Video is relatively forgiving by the way, the audio is the real kicker, a single packet delivered a little bit too late will instantly cause annoyance whereas with the video you can be a little early or late and it doesn't seem to matter too much.
It sounds as if your buffer size for audio is too small. There is no reason why video or audio should act differently in that regard; in fact, audio should be easier, as losing a video packet will result in a loss of video until the next keyframe, while in audio, every single frame is a keyframe.
16 core machines make life a bit easier though, and the hosting provider has been good to their word of providing free machines as long as we use this much bandwidth :)
Output on a typical box is about 300-400 Mbit/sec.
I know that you can stream live video to the phone. There was an entire session dedicated to it at WWDC. Check out MLB at Bat for an example. http://mlb.com/mobile/iphone/ CNN also has a streaming app.
Why do you guys think it's not a good idea right now.