====== Project WebTV ====== **Update: I recently upgraded to a digital DVB-C card, KNC ONE (Philips SAA7146). I'll post the different setup soon. Picture quality rocks! The initial page is [[projects:webtv-dvb|here]].** WebTv is a streaming TV server system with a web frontend. It can be used to stream live TV to multiple clients across various platforms, including Windows and Linux. It uses open source software such as Linux, Apache, PHP and Videolan in a suitable fashion. When I had the need for a similar setup, I could not find anything that fitted the bill, hence this page. My own contribution besides this is a shell script and a simple web frontend. You could follow these instructions to stream live TV (e.g. football?) to your fellow co workers so everyone can keep an eye on the proceedings ;-) If not specified differently, all shell commands are to be issued as root. {{:projects:webtv.png|:projects:webtv.png}} ===== Hardware ===== You need an old PC and a tv card for this to work. The hardware in use for this setup is ^ Hardware details for streaming live TV ^^ |CPU | Pentium III (Katmai) 450 MHZ (!)| |Memory | 256 MB | |HD | 8 GB | |TV Card | Haupauge WinTV PCI Radio with cable TV tuner | |Sound | Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] | |GFX | NVidia / SGS Thomson (Joint Venture) Riva128 | ===== Required Software ===== The required applications for this project are * Apache2 with PHP5 * Videolan client (VLC) * sudo ===== Optional Software ===== Other prerequisites for this setup to work are mostly optional. We made use of the following surrounding applications: * a NTP server for proper time settings * an available DHCP server * a dynamic DNS account for taking out the "D" in DHCP :) ===== Installation of the OS ===== The distribution used is [[http://www.debian.org/|Debian Sarge]], installed using a standard net installation The partitions have been slightly adjusted from a server install: Disk /dev/hda: 8455 MB, 8455200768 bytes 255 heads, 63 sectors/track, 1027 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 34 273073+ 83 Linux /dev/hda2 35 1027 7976272+ 5 Extended /dev/hda5 35 397 2915766 83 Linux /dev/hda6 398 575 1429753+ 83 Linux /dev/hda7 576 630 441756 82 Linux swap / Solaris /dev/hda8 631 661 248976 83 Linux /dev/hda9 662 1027 2939863+ 83 Linux ===== Adding a streaming user ===== Add a user with the proper permissions for the video device: useradd stream -m -G users,audio,video ===== Installing applications ===== ==== Core packages ==== After installing the operating system, a couple of additional packages are required: * Videolan client (complete with server capabilities) * Apache with PHP5 support * sudo Installation of these is actually very easy using the Debian package system and using some backports. Add these lines to your /etc/apt/sources.list to get videolan and backports for Sarge: # Videolan deb http://download.videolan.org/pub/videolan/debian sarge main deb-src http://download.videolan.org/pub/videolan/debian sarge main # PHP5 deb http://packages.dotdeb.org stable all Then install the required packages with this command: apt-get install vlc scantv xawtv ffmpeg apache2 php5 libapache2-mod-php5 php5-curl php5-gd php5-cli sudo ==== Other packages ==== Other packages are nice to have, not necessities. Nevertheless: apt-get install vim ntpdate ddclient screen ==== Installing WebTv ==== Download the latest WebTv distribution for the web frontend and the shell script. The current version is {{:projects:webtv-0.1.tgz|webtv-0.1.tgz}} Untar the file and copy the files to proper locations. Contents of htdocs go to the vhost in use, dist files are copied over to the designated users' home folder. Make sure permissions are set correctly. tar -xzvf webtv-0.1.tgz cd webtv-0.1.tgz mkdir /var/www/webtv cp -r htdocs /var/www/webtv cp dist/stream.sh /home/stream/ cp dist/xawtv_dist /home/stream/.xawtv (if you want to use my .xawtv config file, otherwise use scantv -n pal -a -o .xawtv) chown stream:users /home/stream/stream.sh chown stream:users /home/stream/.xawtv chmod 0744 /home/stream/stream.sh chmod 0644 /home/stream/.xawtv ==== Configuring the web frontend ==== Configure Apache to serve the htdocs folder. Best practice would be a new virtual server with the IP/server hostname setup (not shown here). To allow the process owner of Apache to execute the shell script, we configure sudo # visudo Add a line to allow users in group www-data (ie.g. the web server user) to execute the shell script %www-data ALL=(ALL) NOPASSWD: /home/stream/stream.sh ==== Testing the installation ==== As the streaming user, try to execute the shell script and see it everything works as expected. su - stream ./stream.sh channel ARD ./stream.sh start ./stream.sh stop You can verify a running streaming server by looking for a couple of vlc entries in the process list. Watch out for error messages regarding video or audio devices - my installation suddenly stopped working with /dev/dsp2 and is now on /dev/dsp. ===== Client Operation ===== The System is operational after starting the server. You just have to open the URL in a web browser an start the streaming server or switch the channel. When the server's running, open the streaming client (VLC) and enjoy. ===== Screenshot ===== A screenshot of the simple-but-functional web frontend: \\ {{:projects:webtv_screenshot.png|:projects:webtv_screenshot.png}} ===== Thanks ===== Thanks go to Flo ([[http://dotbox.org|dotbox.org]]) for his help in setting up the system and his invaluable input. ===== Links ===== * http://hauppauge.com/ * http://debian.org/ * http://apache.org/ * http://php.net/ * http://videolan.org/ * http://dotbox.org/