A Video Server for $300 + Change?

Randy Winchester

April 25, 2001

This project would have cost a small fortune if I did it a few years ago.

The $300 video server runs on a TiVo Personal Video Recorder.The TiVo records digital video on a hard drive.The TiVo is also a PowerPC running Linux.A lot has been written about the TiVo, and you can get the lowdown at http://www.tivo.com, so I’m not going to go into a lot of detail about it.The key point is that a 20 Hour Tivo sells for around $299.95 at Best Buy, Sears and other department stores.

Although initially this project might look a little daunting, anybody familiar with a little Linux or Unix will be able to get the server up and running.

Why was the TiVo selected for this project?

*  High quality videorecording and playback- the video quality is better than that from my Panasonic AG7350 SVHS decks.

*  Hackable – The TiVo has an RS232 communication port and runs the Linux operating system.

*  Price.

What other hardware is required?

*  A computer and terminal software.I’m using a discarded Dell 486 with Windows 3.1 and Procomm Plus terminal software.

*  A null modem cable to connect the TiVo’s RS232 port to the PC.

What software is required?

*  A terminal program that includes scripting capabilities.This page includes a Procomm Aspect script that can be modified for use with other terminal programs.

*  Graphics software to produce Targa (*.TGA) files.I presently use Windows Paint to produce full screen graphics and titles slides, then export them to Targa format with ImageForge 2.96, a freeware program from CursorArts.

*  OSDManager to convert Targa files to the *.TIV format that is used on the TiVo.

*  PlayStream – a utility that plays video streams on the TiVo.

What are the capabilities of this video server?

*  Up to 20 hours of video can be recorded.TiVos with 40 hour capacity are also available, and those with hardware hacking skills can do their own hard drive upgrades to add even more storage.

*  The TiVo can display full screen graphics files.

*  Transparent graphic mode can be used for “logo bugs” or text over video.

*  Programs can be scheduled to play at specific times.

*  Programs of any length can be played in any order.

How to build the video server

  1. First, familiarize yourself with the TiVo and some of the procedures that you will be undertaking. The best reference is the “Hacking the TiVo FAQ” found at http://www.tivofaq.com/hack/faq.html. It would be a good idea to read the entire FAQ, as it explains in detail how to avoid some of the dangers and pitfalls that might occur and some of the ways of correcting problems if they come up.

 

  1. First, you will want to install the TiVo and the controlling computer. This is an RS232 connection between the TiVo DSS (Digital Satellite System) control port and a COM port on the controlling computer. This will enable you to communicate with the TiVo’s operating system, download graphics files to the TiVo’s hard drive and control the TiVo with a script. A good description of this step can be found in Sections 4.3 and 4.4 of the “Hacking the TiVo FAQ” found at http://www.tivofaq.com/hack/faq.html. If you are lucky, you will be able to get a TiVo diagnostic prompt with the terminal program on your computer. My own experience is that this step was remarkably simple. I got a prompt the very first time that I tried. It’s possible that this technique might not work with your TiVo and you will have to open the TiVo to remove the hard drive.

 

  1. Get copies of OSDMANAGER and PlayStream. Source code for OSDMANAGER can be found at http://tivo.samba.org/download/belboz/osdmngr-1.7.tar.gz. The Win32 compiled version of OSDMANAGER that I use is at http://web.mit.edu/randy/www/osdman.exe. PlayStream is at http://pvrhack.sonnik.com/tivo/dl_info.asp?DLID=14.

 

  1. Install PlayStream on the TiVo. (For this example, I have renamed PlayStream to playstrm so that the filename would work with Windows 3.1). Here’s how the commands are entered on the TiVo:

 

bash-2.02# tivosh

cd /var/bin

rz

 

     At this point you can transfer playstrm to the TiVo using ZMODEM protocol.When you have finished sending the file:

 

                   ls

          - 10060025120 Apr 02 12:40:54 playstrm

          chmod 555 playstrm

 

     This makes playstrm executable.

 

  1. Make a directory to put your full screen graphics files:

 

cd /var

mkdir graphics

 

  1. You can now cd to the graphics directory and use rz to transfer your graphics files.

 

% cd /var/graphics

% rz

 

  1. Now send your graphics files using ZMODEM protocol. Graphics files are full screen 720x480 pixel images with 256 colors. I create the files with Windows Paint, save them with a .bmp extension, then convert them to Targa format (.tga) with ImageForge 2.96. I then convert the Targa files to *.tiv files with osdman.exe.

 

  1. Locate the FSID numbers of your video streams. The PlayStream documentation gives information on obtaining the File System Ids (FSIDs). Here’s how I do it:

 

mls /Recording/Complete

Directory of /Recording/Complete:

NameTypeFsIdDateTimeSize

------------------------

11437:54300~14245tyDb1424504/25/01 15:52444

dumpobj 14245

Recording 14245/10 {

Version= 48

Showing= 14245/11

SelectionType= 5

RecordQuality= 75

Score= 0

BitRate= 0

Part= 14245/13

State= 4

StartDate= 11437

StartTime= 54410

StopDate= 11437

StopTime= 57053

ExpirationDate = 24855

ExpirationTime = 0

IndexUsed= 14245/11 14244/10

IndexPath= /Recording/Complete/11437:54300~14245 /Recording/ProgramId/14

244~14245:11

IndexAttr= 14245/60

}

% dumpobj 14245/13

RecordingPart 14245/13 {

File= 14247

Begin= 110000

End= 2753000

}

 

          This TiVo has one program on it.  The FsId reported is 14245.  The command that I use to play the video stream is 

playstrm 14247.

 

  1. I maintain a text file with a list of programs on the TiVo, the FsId reported by mls and the FsId to use with PlayStream. I also mark the files with a D when I delete them. This file is just for me to keep things straight.

 

Program       Date   FsId1   FsId2   STATUS

------- ----     -----    -----    ------

RLE              2/28   14034  14036  D

VLSI    3/13   14089  14095  D

VLSI    4/24   14235  14237

RLE              4/25   14245  14247

 

You can keep this file anyway you like, but in any case, it’s a good idea to keep one.  If you don’t, it’s easy to get things mixed up.

 

  1.  Here’s my Procomm Aspect script for playing two programs with two introductory graphics files in a continual loop. It is run from the bash prompt. If you are at the tivosh % prompt, the exit command will return you to the bash prompt.

 

; Script for TiVo Playback

; Production Version 1.2

; Randy Winchester

; 4/19/2001

#define TRUE 1

proc main

     call make_dialog

     when dialog call go_on

while TRUE

     transmit "osdwriter /var/graphics/mitcab.tiv^M"

     waitfor "bash-2.02#"

     pause 20

     transmit "osdwriter /var/graphics/4-23ford.tiv^M"

     waitfor "bash-2.02#"

     pause 20

     transmit "osdwriter /var/graphics;/var/bin/playstrm 14229^M"

     waitfor "bash-2.02#" forever

     transmit "osdwriter /var/graphics/mitcab.tiv^M"

     waitfor "bash-2.02#"

     pause 20

     transmit "osdwriter /var/graphics/4-24vlsi.tiv^M"

     waitfor "bash-2.02#"

     pause 20

     transmit "osdwriter /var/graphics/mitbug.tiv;/var/bin/playstrm 14237^M"

     waitfor "bash-2.02#" forever

endwhile

endproc

proc make_dialog

dialogbox 91 75 196 83 7 "TiVoPlay V1.2"

text15 15 114 8 left "TiVo Playback in Progress!"

text15 30 100 8 left "Select Quit to Exit"

pushbutton 133 57 40 14 "Quit" normal

text14 49 81 8 left "Randy Winchester"

text15 57 78 8 left "MIT Cable Television"

text15 65 75 8 left "April 19, 2001"

enddialog

endproc

proc go_on

     alarm

     destroydlg

     exit

endproc

 

The script puts a dialog box on the screen indicating that the script is running and that the TiVo is playing back programs.  Most of the work is done by the following eight lines of code that I will explain further:

 

     transmit "osdwriter /var/graphics/mitcab.tiv^M"

     This uses the TiVo’s osdwriter program to display a graphic file

 

     waitfor "bash-2.02#"

     then wait for the bash prompt

 

     pause 20

     and show the graphic for 20 seconds

 

     transmit "osdwriter /var/graphics/4-24vlsi.tiv^M"

     then use osdwriter to display a title slide for the program

 

     waitfor "bash-2.02#"

     then wait for the bash prompt

 

     pause 20

     and show the title slide for 20 seconds

 

     transmit "osdwriter /var/graphics/mitbug.tiv;/var/bin/playstrm 14237^M"

then use osdwriter to display a bug (a small logo in the lower right of the screen on a transparent background) and play the video stream.

 

     waitfor "bash-2.02#" forever

and wait for the bash prompt to return after the video stream is finished.  Normally, the waitfor command times out after one minute and the script continues.  The forever parameter keeps the waitfor command from timing out during the time your program is playing.  You can then repeat a similar block of code to repeat the process for another program.  When all programs in the sequence have played, the entire sequence will repeat.

 

  1.  To use the Procomm script, you must first shut down the TiVo Myworld (TiVo’s user menus) program as detailed in the PlayStream documentation. I usually shut down Myworld, and then select Compile/Run Script from the Procomm Script menu. Make sure that you have a bash prompt before running the script.

Other details that you’ll want to know

CG Mode

There’s no need to play video files in your script.  You can simply play back graphics files one after another in a loop as a slide show or character generator.  If this seems like a waste, keep in mind that dedicated character generator hardware with similar capabilities costs more than $300.

Producing a graphic file with a transparent background

I first produce a 720x480 Targa file with a black background.  After converting the Targa file to a *.tiv file using OSDMAN, add 3 to the tenth byte (I use MSDOS DEBUG with the following steps):

 

                             C:\>debug logo.tiv

              -d

              0AAC:0100DA 7C 00 0A 00 00 3C 00-12 20 1E 20 2E 20 3A 20.|....<..#. . :

0AAC:01104A 20 5A 20 66 20 76 20-86 20 92 20 A2 20 B2 20J Z f v . . . .

0AAC:0120BE 20 CE 20 DE 20 EA 20-12 20 16 5C 1E DC 23 5C. . . . . .\..#\

0AAC:01302B 98 25 DC 2A 18 32 98-37 18 3F 94 39 98 42 14+.%.*.2.7.?.9.B.

0AAC:014046 54 4E D4 53 50 51 54-55 D0 5E 50 62 90 6B 0CFTN.SPQTU.^Pb.k.

0AAC:015065 10 69 8C 72 0C 7A 8C-7E C8 79 0C 81 48 85 C8e.i.r.z.~.y..H..

0AAC:01608E 48 92 C4 90 C8 95 44-9D 84 A2 04 AA 84 1D E4.H.....D........

0AAC:017022 64 2A E0 2F 20 37 A0-31 A0 3A 20 3E 9C 47 1C"d*./ 7.1.: >.G.

 

The tenth byte has the value 20.You want to add 3 to it.

 

                             -e –109 23

 

You can check your work:

 

              -d 0100

              0AAC:0100DA 7C 00 0A 00 00 3C 00-12 23 1E 20 2E 20 3A 20.|....<..#. . :

0AAC:01104A 20 5A 20 66 20 76 20-86 20 92 20 A2 20 B2 20J Z f v . . . .

0AAC:0120BE 20 CE 20 DE 20 EA 20-12 20 16 5C 1E DC 23 5C. . . . . .\..#\

0AAC:01302B 98 25 DC 2A 18 32 98-37 18 3F 94 39 98 42 14+.%.*.2.7.?.9.B.

0AAC:014046 54 4E D4 53 50 51 54-55 D0 5E 50 62 90 6B 0CFTN.SPQTU.^Pb.k.

0AAC:015065 10 69 8C 72 0C 7A 8C-7E C8 79 0C 81 48 85 C8e.i.r.z.~.y..H..

0AAC:01608E 48 92 C4 90 C8 95 44-9D 84 A2 04 AA 84 1D E4.H.....D........

0AAC:017022 64 2A E0 2F 20 37 A0-31 A0 3A 20 3E 9C 47 1C"d*./ 7.1.: >.G.

 

You can see that the tenth byte has been changed to 23.  Now save your work:

 

              -w

              Writing 54808 bytes

              -q

              C:\>

 

You can now use this file on the TiVo.  A transparent background has replaced the black background.  Video shown under this graphic will “show through” the transparent areas.

Other scripting additions – scheduled playback

The Aspect script command:

 

                             suspend until “10:00:00”

 

Will wait until 10am before continuing.  The suspend until command accepts a time in 24 hour format.  It can also accept a date.  Here’s an example:

 

          transmit "osdwriter /var/graphics/mitcab.tiv^M"

              waitfor "bash-2.02#"

                             suspend until “20:30:00”

     transmit "osdwriter /var/graphics/4-24vlsi.tiv^M"

     waitfor "bash-2.02#"

     pause 20

     transmit "osdwriter /var/graphics/mitbug.tiv;/var/bin/playstrm 14237^M"

              waitfor "bash-2.02#" forever

 

This script will display a logo when run.  It will then wait until 8:30pm before showing the title slide and running the program.

My TiVo Wish List

The following capabilities would be nice to have.  I hope that they can be added at some point.

*  Program recording.  Presently, all programs are recorded by setting up a recording with the “Manually Record Time/Channel” menu selection.  The problem I have with this is that the programs that I record don’t always start on time.  I would like to be able to just press the record button on the remote control to start a recording of any arbitrary length.

*  Improvements to PlayStream:

*       It isn’t possible to interrupt PlayStream with a ^C or any other command that I’ve tried.  Once you’ve started PlayStream to play a program, you have to wait until it finishes, or power down the TiVo and reboot.

*       It would be great to be able to start and end playback at any points in a program.  This would make up for the problem where the recording starts long before the program actually begins.

*       I’ve noticed that PlayStream plays past the end of the program and shows remnants of other programs.

Future Directions

This server could be controlled over the web.  It could easily be adapted to serve programs on request over the web.  See “MITV Jukebox” at http://mitv.mit.edu for a demonstration of “The Button” a web application that lets cable viewers schedule programs.

References

TiVo web site                   http://www.tivo.com

TiVo Forum FAQ                http://www.tivofaq.com

AVS TiVo Forum                http://www.avsforum.com/tivointro

Hacking The TiVo FAQ       http://www.tivofaq.com/hack/faq.html

PVRHack                          http://pvrhack.sonnik.com/tivo/

MIT Cable Television         http://web.mit.edu/mitcable/www


Please send comments to randy@mit.edu.



mit Copyright © 2001 Massachusetts Institute of Technology
Page design by Randy Winchester.
Last update .
Comments and questions to mitcable@mit.edu