Home Movies for Your Tivo

We recently upgraded from a Philips Tivo Series 1 to a new HD model with networking and the ability to record HDTV. Using iTivo on my Mac it was pretty straightforward to take some TV shows off the new Tivo and copy them to an iPhone for viewing on-the-go. Going in the other direction, however, it was going to be easier for me to setup my Linux server to host the videos as this has plenty of storage and is always available.

On my Ubuntu server, the /export/video directory is already available for remote access over AFP/SMB. Unfortunately, this isn’t how Tivo would be able to access video content. Here are the essential steps for getting your Linux server running Debian/Ubuntu sharing out in a way that your Tivo will be able to find it:

  1. Install ffmpeg for transcoding. The videos you have might be encoded in any of a number of formats, ffmpeg can convert these to the format that Tivo will be able to play (MPEG/AC3). On Debian/Ubuntu this can be installed easily:
    apt-get install ffmpeg
  2. Download and Extract pytivo. This is stored in a GIT repository but you can easily get a snapshot of the current release at your server command prompt:

    wget -O - http://repo.or.cz/w/pyTivo/TheBayer.git/snapshot | tar - zxf

    This downloads the current snapshot and extracts it into the directory TheBayer. There are a few flavors of pytivo, this particular derivative is able to decode DVD filesystems directly.

  3. Install Program. Move the application into place, on my server /usr/local is used to store these kinds of applications.

    sudo mv TheBayer /usr/local/pytivo

  4. Configure Application. Copy the default configuration and modify as necessary:
    sudo cp /usr/local/pytivo/pyTivo.conf.dist /usr/local/pytivo/pyTivo.conf
    sudo vi /usr/local/pytivo/pyTivo.conf
  5. Here is a set of minimum settings for pyTivo.conf:

    [Server]
    port=9032
    ffmpeg=/usr/bin/ffmpeg
    
    [MyMovies]
    type=video
    path=/export/video

    You need to specify the location of ffmpeg and the path to your videos. It is possible to create multiple video shares.

  6. Create Startup Script. You’ll want to be able to start this automatically, create a script in /etc/init.d/pytivo that looks like this:
    #!/bin/sh -e
    # chkconfig: 2345 99 05
    # description: pyTivo server
    
    ### INIT INFO
    # Provides: pytivo
    # Required-Start: $network
    # Required-Stop: $network
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-description: pyTivo server
    # Description: Start and stop the pyTivo server.
    ### END INIT INFO
    
    NAME=pyTivo
    TZ=
    unset TZ
    
    RETVAL=0
    
    # Define LSB log_* functions.
    # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
    . /lib/lsb/init-functions
    
    start() {
      log_daemon_msg "Starting pyTivo: "
      python /usr/local/pytivo/pyTivo.py > /dev/null 2>&1 &
      log_daemon_msg "done"
      return 1;
    }
    
    stop() {
      log_daemon_msg "Stopping pyTivo: "
      pkill -f pyTivo.py
      log_daemon_msg "done"
      return 1;
    }
    
    # See how we were called.
    case "$1" in
      start)
        start
    ;;
      stop)
        stop
    ;;
    restart|reload)
      stop
      sleep 1
      start
    RETVAL=$?
    ;;
    *)
    echo "Usage: $0 {start|stop|restart}"
    exit 1
    esac
    exit $RETVAL
  7. Start it up.
    sudo /etc/init.d/pytivo start

That should do it. From your Tivo, you should now be able to find MyMovies listed  under Now Showing, opening this provides a listing of the videos available from your remote filesystem. If anything goes wrong from the init script, you may want to launch pyTivo yourself from a command prompt:

python /usr/local/pytivo/pyTivo.py

You may create multiple shares and in fact there is support for pictures and music as well, depending on your needs these may prove useful. As the transcoding requires a fair amount of processing power, you will likely want at least a dual core CPU in your server with at least 1GB of RAM. The multi core chip means that your server won’t get bogged down and the memory will give ffmpeg plenty of headroom. There really isn’t a time limit to the amount of video that can be extracted to your Tivo, but you should anticipate there may be a delay while the video begins to transfer.

This configuration has proven itself reliable enough to host a number of video formats (AVI, MPEG, MP4 and VOB) with very little latency between the host and the Tivo. For more details on pyTivo be sure to check out the pyTivo wiki online at http://pytivo.sourceforge.net/wiki/index.php/PyTivo.