nav-left cat-right RSS
cat-right

How to Set Up a TiVo Media Server on Ubuntu Linux

TiVo
This guide will help you set up a media server to be able to play videos on your Series 3 TiVo, using pyTiVo. (Note: this post was moved from my old blog, but has been updated a bit)

First, install ffmpeg:

$ sudo apt-get install ffmpeg

Then, install git (needed to grab pyTivo):

$ sudo apt-get install git-core

Then, grab the latest version of the pyTivo script (Look at the Current Release page to verify that you have the right version):

$ cd /usr/share
$ sudo git clone git://repo.or.cz/pyTivo/wmcbrine.git
$ sudo mv wmcbrine pyTivo

Edit /usr/share/pyTivo/pyTivo.conf:

$ cd /usr/share/pyTivo
$ sudo cp pyTivo.conf.dist pyTivo.conf
$ sudo vi pyTivo.conf

The only thing that I changed is to comment out the default video share, and add my own:

[Movies]
type=video
path=/data/Video/Movies
[Television]
type=video
path=/data/Video/Television
[Music]
type=music
path=/data/Audio/Music

Run pyTivo:

$ sudo python /usr/share/pyTivo/pyTivo.py

Verify that things are working correctly — on the Tivo, go to “Now Playing List” and look for the shares.  If they appear and you can browse to them, you’re almost done!

One issue I had was with transferring the videos.  When I transferred them to the TiVo, it had a message of “unknown mpeg2 codec” or something to that effect.  Apparently the package for ffmpeg on Intrepid doesn’t have all of the codecs needed.  To install them, run the following:

$ sudo apt-get install libavcodec-unstripped-51

After I did this, videos were able to be transferred just fine.

The last thing to do is to make pyTiVo start automatically on bootup. To do this, simply copy the following script to /etc/init.d:

#!/bin/bash
# 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

RETVAL=0

start() {
echo -n "Starting pyTivo: "
pgrep -f pyTivo.py
RETVAL=$?
[ $RETVAL -eq 0 ] && echo "pyTivo already running: Exiting" && exit 1

# this call actually starts pyTivo.
python /usr/share/pyTivo/pyTivo.py > /dev/null 2>&1 &
RETVAL=$?
[ $RETVAL -eq 0 ] && echo -n "done"
echo
return $RETVAL
}

stop() {
echo -n "Stopping pyTivo: "
pkill -f pyTivo.py
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && echo -n "done"
echo
return $RETVAL
}

# 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

Note: I didn’t write this – I just grabbed it from somewhere when setting it up – let me know if you wrote it so that I can give you credit!

After creating the script, make it executable:

$ sudo chmod u+x /etc/init.d/pytivo

Then create links to /etc/rc3.d and /etc/rc1.d:

$ sudo ln -s /etc/init.d/pytivo /etc/rc3.d/S99pytivo
$ sudo ln -s /etc/init.d/pytivo /etc/rc1.d/K99pytivo

This should make it so that pytivo starts automatically upon bootup.

Hopefully you’ve found this guide useful. Next time, I’ll be talking about how to make the videos show up perfectly on the TiVo, with appropriate titles, etc.

Related posts:

  1. Converting TiVo MPEG2 Videos to H.264
  2. How to Convert DVDs and TiVo MPEG2 Videos to H.264
  3. How to Copy Videos from a Series 3 TiVo to Ubuntu Linux

6 Responses to “How to Set Up a TiVo Media Server on Ubuntu Linux”

  1. Len Winter says:

    Hi Ed,

    This is really awesome. I am not too fluent in Linux but have a new machine for the house. I started off trying out Fedora. I know I came very close (piecing this all together, but still got stuck.

    then I loaded Ubuntu. Wow what a difference! I did run into a problem. If you have a minute and can step me through it, I would be grateful. My tivo (Series 2) boxes can see my server, but there are no movies showing. I have 2 .avi files and an MPG. Any ideas?

    Also, I have never programmed a Perl Script before. Where should this script reside?

    thanks again!

    Len Winter
    lwiphone@winterfamily.us

  2. Ed says:

    Hey Len, Thanks for the visit. If you’re still having trouble with this, let me know via email (edsfamily@gmail.com) and I can try to help you out. Scripts can reside anywhere. I usually keep them in my home directory, but they can be moved to /usr/local/bin or wherever you want really.

  3. Beau says:

    Ed
    Thanks! These instructions were easy to follow (maybe even more so than on the project’s site).

    I got it up and running with no problems (Music only) on an Ubuntu 8.10 machine this morning.

    There are fewer and fewer reasons to use windows these days!

    Beau

  4. Chris Pugh says:

    All of these scripts you’ve been posting are making me think about installing ubuntu on my of boxes. Good stuff!
    Chris Pugh´s last blog ..Five Reasons Why You Should Be Using WordPress My ComLuv Profile

  5. [...] with the metadata about the program, which is in pyTivo format. For more info, see my guide on how to set up pyTivo as a media server for [...]

  6. Will says:

    Hello,

    This is what I get when I launch this command and goes no further.
    NOTE: see config below

    will@will-ubuntu910:~$ sudo python /usr/share/pyTivo/pyTivo.py
    [sudo] password for will:
    INFO:pyTivo.beacon:Announcing shares…
    INFO:pyTivo.beacon:Registering: Music
    INFO:pyTivo.beacon:Registering: MyMovies
    INFO:pyTivo.beacon:Scanning for TiVos…
    INFO:pyTivo:pyTivo is ready.
    INFO:pyTivo:192.168.1.106 [20/Feb/2010 14:12:30] “GET /TiVoConnect?Command=QueryContainer&Container=%2F HTTP/1.0″ 200 -
    INFO:pyTivo:192.168.1.104 [20/Feb/2010 14:12:30] “GET /TiVoConnect?Command=QueryContainer&Container=%2F HTTP/1.0″ 200 -

    .
    .
    .
    # This is an example config file, showing all the options. You probably
    # won’t need most of them. Your working config file will be named
    # “pyTivo.conf”. ‘#’ starts a comment. It is recommended that
    # that you use the Web Administration tool to modify pyTivo.conf after
    # you get pyTivo up and running. You can access the tool by pointing your
    # browser to http://localhost:9032/

    [Server]
    port=9032

    # Full path to ffmpeg including filename
    # For windows: ffmpeg=c:\Program Files\pyTivo\bin\ffmpeg.exe
    # For linux: ffmpeg=/usr/bin/ffmpeg
    #ffmpeg=c:\Program Files\pyTivo\bin\ffmpeg.exe
    ffmpeg=/usr/bin/ffmpeg

    # Setting this to True will log more ouput for debugging purposes.
    debug=True

    # Max video bitrate, default 30000k
    # sets ffmpeg -maxrate setting to minimize bitrate peak playback issues.
    # mpegs with video bitrate above this setting will also be transcoded.
    MAX_VIDEO_BR=17408k

    # Audio bit-rate, defaults to 192K for S2, 384K for S3/HD
    audio_br=320K

    # Video bit-rate, defaults to 4096K for S2, 8192K for S3/HD
    video_br=12Mi

    # Beacon broadcast address(es)
    # The default is 255.255.255.255, but on some multihomed machines you
    # may need to specify the subnet broadcast address(es) of your Tivo
    # boxes. You can also specify “listen” to listen for direct connection
    # attempts on port 2190, for use with the “Manually add a server…”
    # function. (And if you set beacon to listen _only_, it turns off
    # broadcasts.)
    beacon=192.168.1.255 listen

    # Output Pixel Width:
    # Width, defaults to 544 for S2, 1920 for S3/HD
    # Height, defaults to 480 for S2, 1080 for S3/HD
    # Valid widths: [S3/HD = 1920, 1440, 1280], [S2/S3/HD = 720, 704, 544, 480, 352]
    # Valid heights: [S3/HD = 1080, 720], [S2/S3/HD = 480]
    #width=1920
    #height=1080
    #ffmpeg_tmpl=%(video_codec)s %(video_fps)s %(video_br)s %(max_video_br)s %(buff_size)s %(aspect_ratio)s %(audio_br)s %(audio_fr)s %(audio_ch$

    # Togo settings:
    # Set this up if you wish to have TiVo ToGo support. This allows you to
    # copy videos from your TiVo via a web page.
    #
    #
    tivo_mak=9121978496
    togo_path=/home/will/tivomovies

    # Per tivo options
    # section named _tivo_TSN with the tsn in all caps
    #[_tivo_00000DEADBEEF]

    # If you want to use 16:9 or 4:3 on this tivo
    #aspect169=true

    #width=1440
    #height=720
    #audio_br=320K
    #video_br=12Mi
    #ffmpeg_tmpl=%(video_codec)s %(video_fps)s %(video_br)s %(max_video_br)s %(buff_size)s %(aspect_ratio)s %(audio_br)s %(audio_fr)s %(audio_ch$

    #[_tivo_HD]
    # section for default video options applicable to all HD TiVos
    # see pyTivo Web Configuration for all available settings

    #[_tivo_SD]
    # section for default video options applicable to all SD TiVos
    # see pyTivo Web Configuration for all available settings

    [MyMovies]
    # Type can be ‘video’, ‘music’, or ‘photo’
    type=video

    # Path is the full path to your files (No trailing slash needed)
    # For windows: path=c:\videos
    path=/home/will/tivomovies
    #path=/home/armooo/Videos

    # You can have more than one share
    #[MyTelevision]
    type=video
    path=/home/will/tivomovies

    [Music]
    type=music
    path=/home/will/tivomovies/music

    Thank you,
    William

Leave a Reply

CommentLuv Enabled