Call for a Better Solution
Posted: 03 Oct 2010 19:39
The short story: I have been trying for several months to build a DIY "Slingbox" that would transmit live TV over the internet. Some parts of this have been difficult, but ultimately it has been relatively easy to assemble the necessary components: old stripped-down computer, cheap capture card/hardware encoder, universal remote control accepting web commands, scheduling scripts to print out nice clickable TV schedules, etc. HOWEVER, the almost impossible task has been to actually STREAM the data over the internet.
For those who like it short and sweet, here's what I'm driving at: we absolutely need to come up with a simple guide for home users to reliably stream video, using VLC, to other computers. From what I've seen, this forum is littered with requests for how to do this, and frankly, I imagine the moderators are getting tired of answering the same questions about why RTSP won't work behind a NAT router, or how HTTP progressive download is different from real streaming, or how one sets the buffer to time x for y transport protocol, or simply how one goes about streaming in the first place.
THERE HAS GOT TO BE A WAY TO DO THIS! In principle, it's a little tricky, but it's not impossible. The software on official Slingboxes cannot be THAT complicated, and VLC is already frustratingly close to having a good solution. There are a whole host of websites offering custom made programs to reliably transmit video. If we work together, we must be able to find some kind of generalizable solution for home users wanting to stream.
The content of this solution is going to have to work under the following conditions: the server will be behind a NAT router, the computer will be cheap and only moderately powered, the encoding will be done by a cheap hardware encoder, the stream will be decent enough to read the current score in a football game, and the stream will reliably traverse firewalls.
The long story: Here's all that I've tried (or considered), and all that has failed.
- RTSP behind a NAT router. I'll admit I don't totally understand the full complexities of TCP, UDP, etc. However, it seems evident that your router needs to have a certain level of understanding about what's being transmitted, in order to send RTSP. NO REASONABLY-PRICED ROUTER seems capable of doing this, and YOU CANNOT AVOID THIS PROBLEM USING DMZ. If you try to do this, the best you are going to receive is a few RTSP headers. I understand that if the RTSP could be "interleaved" it would get around this problem. From what I gather, interleaving means that you put all the components of the RTSP stream into a single path, with their various bits of information interleaved so that they can get through the router's narrow restrictions. However, the development team is busy, and I don't gather that they will be introducing interleaved RTSP-over-HTTP any time soon.
- MSSH. This is the only "streaming" method that actually will get out from behind my home router, and into my computer through other routers. However, I use the scare quotes around the word "streaming" intentionally. This method is CRAPPY (it's from Microsoft -- shocker). Unless the video is completely unrecognizably degraded, it won't hold onto a connection. PLUS, even on my LAN, it starts to build latency into the stream, which basically makes it no better than simple HTTP progressive downloading.
- RTMP. There's no way to do this with VLC. Plus, there is no inexpensive FLV hardware encoder. That means that the cheap computer you want to run your media server is going to have to grab video from your capture card, software encode the video, and then act as the server for transmitting the video. THIS WILL EASILY OVERWHELM MOST CHEAP COMPUTERS. Furthermore, even if your computer is up to it, it's not a straightforward task to set this up. The only open source program to serve RTMP is Red5 and it's not user friendly in its documentation. I don't think Red5 will grab video from the capture card either, which means you need some botched processing chain that looks like: Hardware Encoder -> VLC Software Encoder -> Red5 -> Internet.
- Apple's HTTP Streaming. This almost looks enticing, especially since, theoretically, it means getting your stream onto an iPhone or iPad. However, this method requires a hardware encoder that will encode into H.264 (doable). Plus, from what I see, you need a mac to get the media segmenter. PLUS, this is going to introduce LATENCY. Upwards of 30s after a short while (from what I've heard on the web). That means using this method to stream TV is just not feasible. If you have a DVR, imagine the frustration of virtually "clicking" your remote control, and then waiting 10s for the resulting action to show up on your computer screen. Forget fast-forwarding through commercials.
- HTTP Progressive Download. The old standard works, kind of. I've adapted the example code offered by VLC for their web interface. I updated flowplayer to the latest version, and added the aforementioned clickable schedules. This method will, on a decent connection, get video from one computer to another. However, its obvious downside is the inevitable latency it builds every time there's a hiccup in the connection. Within 7 minutes, the lag between reality and what's displayed might be 10s. This is perfectly OK for VOD; but for live streaming this is just not feasible.
- Miscellaneous. I've also looked into Unreal Server, VX30, the Java IBM MP4 Toolkit, Darwin SS, and probably many more I can't even remember at this point in time.
If we work together, there must be a solution that will not only work for me, but which will serve as a guide for the many people hoping to do something similar.
For those who like it short and sweet, here's what I'm driving at: we absolutely need to come up with a simple guide for home users to reliably stream video, using VLC, to other computers. From what I've seen, this forum is littered with requests for how to do this, and frankly, I imagine the moderators are getting tired of answering the same questions about why RTSP won't work behind a NAT router, or how HTTP progressive download is different from real streaming, or how one sets the buffer to time x for y transport protocol, or simply how one goes about streaming in the first place.
THERE HAS GOT TO BE A WAY TO DO THIS! In principle, it's a little tricky, but it's not impossible. The software on official Slingboxes cannot be THAT complicated, and VLC is already frustratingly close to having a good solution. There are a whole host of websites offering custom made programs to reliably transmit video. If we work together, we must be able to find some kind of generalizable solution for home users wanting to stream.
The content of this solution is going to have to work under the following conditions: the server will be behind a NAT router, the computer will be cheap and only moderately powered, the encoding will be done by a cheap hardware encoder, the stream will be decent enough to read the current score in a football game, and the stream will reliably traverse firewalls.
The long story: Here's all that I've tried (or considered), and all that has failed.
- RTSP behind a NAT router. I'll admit I don't totally understand the full complexities of TCP, UDP, etc. However, it seems evident that your router needs to have a certain level of understanding about what's being transmitted, in order to send RTSP. NO REASONABLY-PRICED ROUTER seems capable of doing this, and YOU CANNOT AVOID THIS PROBLEM USING DMZ. If you try to do this, the best you are going to receive is a few RTSP headers. I understand that if the RTSP could be "interleaved" it would get around this problem. From what I gather, interleaving means that you put all the components of the RTSP stream into a single path, with their various bits of information interleaved so that they can get through the router's narrow restrictions. However, the development team is busy, and I don't gather that they will be introducing interleaved RTSP-over-HTTP any time soon.
- MSSH. This is the only "streaming" method that actually will get out from behind my home router, and into my computer through other routers. However, I use the scare quotes around the word "streaming" intentionally. This method is CRAPPY (it's from Microsoft -- shocker). Unless the video is completely unrecognizably degraded, it won't hold onto a connection. PLUS, even on my LAN, it starts to build latency into the stream, which basically makes it no better than simple HTTP progressive downloading.
- RTMP. There's no way to do this with VLC. Plus, there is no inexpensive FLV hardware encoder. That means that the cheap computer you want to run your media server is going to have to grab video from your capture card, software encode the video, and then act as the server for transmitting the video. THIS WILL EASILY OVERWHELM MOST CHEAP COMPUTERS. Furthermore, even if your computer is up to it, it's not a straightforward task to set this up. The only open source program to serve RTMP is Red5 and it's not user friendly in its documentation. I don't think Red5 will grab video from the capture card either, which means you need some botched processing chain that looks like: Hardware Encoder -> VLC Software Encoder -> Red5 -> Internet.
- Apple's HTTP Streaming. This almost looks enticing, especially since, theoretically, it means getting your stream onto an iPhone or iPad. However, this method requires a hardware encoder that will encode into H.264 (doable). Plus, from what I see, you need a mac to get the media segmenter. PLUS, this is going to introduce LATENCY. Upwards of 30s after a short while (from what I've heard on the web). That means using this method to stream TV is just not feasible. If you have a DVR, imagine the frustration of virtually "clicking" your remote control, and then waiting 10s for the resulting action to show up on your computer screen. Forget fast-forwarding through commercials.
- HTTP Progressive Download. The old standard works, kind of. I've adapted the example code offered by VLC for their web interface. I updated flowplayer to the latest version, and added the aforementioned clickable schedules. This method will, on a decent connection, get video from one computer to another. However, its obvious downside is the inevitable latency it builds every time there's a hiccup in the connection. Within 7 minutes, the lag between reality and what's displayed might be 10s. This is perfectly OK for VOD; but for live streaming this is just not feasible.
- Miscellaneous. I've also looked into Unreal Server, VX30, the Java IBM MP4 Toolkit, Darwin SS, and probably many more I can't even remember at this point in time.
If we work together, there must be a solution that will not only work for me, but which will serve as a guide for the many people hoping to do something similar.