IPTV/VoD: How to set up your own home/office system
It's dead easy, mate
4. Streaming live broadcast video
The first thing to simulate on your IPTV system is live TV that can be tuned into, and this can be done in two ways. The first is easy, the second is either painful or expensive. Live broadcast IPTV needs to be multicasted 24-7 over the IP network, as unicast is too inefficient. We will be streaming live TV from our video server.
For each channel, we need to broadcast a five minute looping precaptured video clip to a multicast IP address. For this, we can use the free VLC player, or the industry standard WinSend, created by Pixstream. The clip itself ideally needs to be previously encoded in MPEG-4 H.264 AVC, and formatted into an MPEG-2 transport stream.
However, VLC being the Swiss army knife it is means we can convert open virtually any video file and encode it on the fly as we are broadcasting. Open your video file, and use the advanced options in VLC to stream the output onto the network as UDP, using a multicast address such as 22.214.171.124 to a random port (such as 10201).
You can test if the stream is being correctly outputted by opening the same network stream with another copy of VLC on another computer on the network. Do this for as many channels as you require. Once they are broadcasting, the set-top box will be able to tune into the multicast stream just as VLC does.
The more advanced way to provide live broadcast TV (such as Freeview) over an IP network is to convert MPEG-2 video received from a DVB receiver (a TV tuner card, for example those made by Hauppage) into multicast format, which is known as IP encapsulation.
The painful way is to code your own encapsulation program using the vendor's SDK, and the expensive way is to buy industrial hardware that does it for you (for example, Exterity, Anevia etc).
5. Preparing VoD content
Making DVD quality video across your network is split into two separate parts – getting the video files into the right format, and secondly, setting them up to stream from a video server.
The bad news is that there isn't a free or open source VoD server that you can use to exactly simulate what would happen in a commercial service. Your video material will need to be pre-encoded in the same way the live multicast video is.
Software encoders from vendors like Elecard, MainConcept Cyberlink and Nero will easily compress video from most formats (MPG, AVI, MOV etc) into MPEG 4 H.264 AVC, but they will additionally need to be encapsulated in an MPEG-2 transport stream for delivery over the network. The free open-source Media Coder program produces excellent results.
Video is very temperamental and requires state control, unlike typical web protocols such as HTTP. RTP (real-time protocol) and RTSP (real-time streaming protocol) were designed to provide VCR-like controls for IP networks, and most, if not all commercial VoD servers use these technologies for delivering quality-assured video.
A lot of set-top box manufacturers have adapted their hardware to be able to simulate VCR-like features using HTTP so video can be streamed directly from a web server like Apache. We will use a combination of both to stream files ending in .mpg.
The main choices for serving video on-demand over our IPTV network are the open-source Helix Server and Darwin Streaming Server, both of which come in Windows flavour, but can also run on Linux. We also have a trial of the Elecard RTSP server that can also be run on either OS. If your own network is set up to use Windows Media, you can happily and easily unicast and/or multicast video from a Windows Server PC running the free Windows Media Server.
Once the video files have been pre-encoded, they need to be placed in the directory on the video server that has been allocated as the storage folder, as well as mirrored in the Apache web directory allocated on the web server. Almost all the RTSP servers have a web-based configuration panel and will need to index/identify each file for streaming.
Once these are in place, test the RTSP capacity of the server by opening a network stream to them in VLC, and once any problems are corrected, your IP set-top box will play them using its inbuilt API.