Thursday, January 20, 2011

Telnet-TV



This is a prototype application I wrote in C++. I came across the idea a few years ago, when I accidentally Telnet'd into a game server. I wrote the server to use winsock and didnt consider to check what application connected to its sockets, the server sent a mass of garbled text to the Telnet client. It sort of looked animated, and so I tried to write an app to stream scrolling images to Telnet. I forgot about it completely.
Recently I wanted to write some kind of obscure BBS type software and I remembered the old Telnet-TV attempt. The new one was written in 24 hours using some C++ snippets from the internet. It took about 12 Hours to encode the entire first episode of Peep Show, the episode is 60Mb in black and white, and 11Mb compressed. I ripped the audio as a low bitrate mp3 so I could get a dirty feel from it. Currently the server can broadcast coloured ASCII, but I find it lags a lot and is unwatchable. Colour doubles the filesize too. The video on its own can be streamed to another PC.
There are 2 programs involved in this process, the encoder and the streamer. The encoder scans frames of a video and saves them to a file. The encoder needs to know if it should take colour into consideration. The encoder writes 2 files, one is the raw data, the other is a file that keeps track of how much data is in each frame. I used this method to try and improve the colour frame rate in Telnet, there is a vast improvement, but its still unwatchable. The second program reads the files and listens for socket connections. It then streams content to the Telnet client thats connected, making sure to keep the appropriate frame rate.