Copy Videos from TiVo to iPod (or iPhone), Mostly Automatically, Using Linux, Mac, or WindowsFiled on Mar 7, 2008 by AnthonyDiSante
If you have a Series 2 TiVo connected to your home network, then you can use its built-in web server to copy video files from the TiVo to a computer. From there, you can convert the files to an iPod/iPhone-friendly format, then import them into iTunes or whatever other app you use to manage your portable device, and finally sync the videos to your portable device.
(Unfortunately, this functionality has apparently been killed in the HD Series 3 TiVo, thanks to the trifecta of stupidity that is Hollywood, cable companies, and government.)
The first step is to find your TiVo’s MAK (media access key). This number is a security code, and it’s listed in your TiVo’s Settings menu under System Information. The MAK is used as a password to access the files on your TiVo over your network.
Now you need to get the video files from the TiVo to your computer. This is known as TiVoToGo, and there are a few dedicated apps that handle this, such as TiVo Desktop for Windows or Toast for Mac, or TiVoDecode Manager for Mac. And actually, all of those apps will also take care of converting the file to an iPod-compatible format and even auto-importing it into iTunes, so for many people they provide the complete solution.
Those apps don’t help Linux users, though. And although I have a Mac Mini that I use to manage my iPhone, it’s relatively slow (1.5 GHz G4 PPC) and small (80 GB). My main workstation runs Ubuntu Linux, and is much faster (2.4 GHz Core 2 Duo) with much more space (let’s just say it’s more than a TB), so it’s much better suited to video processing and archival. Based on these Geekbench scores, my Core 2 Duo system is probably about 4x more powerful than my Mini.
So to copy videos from the TiVo to a Linux system, we just need to access the TiVo’s built-in web server directly, by opening a web browser and going to https://tivo-ip-address/. Alternatively, you can use the nowPlaying.xhtml file (found here and mirrored here), which gives a nicer interface to your TiVo’s web server; just adjust the IP address and the MAK near the top of the file, then load it into your browser from your local filesystem. At some point, the server will prompt you for a login; the username is "tivo" and the password is your MAK.
The download links from the TiVo’s web server will give you files with a *.TiVo extension. I name the files "Show Name - Episode Name.TiVo" or "Show Name - date.TiVo"; you should too. Once the *.TiVo file is on your system, you just need to run my TiVo-to-iPod-backend script on it. To make this simple, I use a Gnome right-click action on the *.TiVo file: just right-click on it and choose Open With, then select TiVo-to-iPod, which is a small launcher script that opens an xterm and then in turn calls TiVo-to-iPod-backend. (Note: remove the .txt extensions from those scripts after downloading them; then put the scripts into your /usr/local/bin/ directory and chmod them a+x or 0755.)
Here’s what the TiVo-to-iPod-backend script does:
First, it calls tivodecode to convert the *.TiVo file into an MPEG2 (*.mpg) file. As the instructions on the tivodecode page state, you’ll need to have put your MAK into the ~/.tivodecode_mak file for this to work.
Second, it calls ffmpeg to convert the *.mpg file into a *.mp4 file, resizing the video in the process to 480x320 for my iPhone’s screen. You can adjust that number for your own iPod, and also adjust the bitrate parameter (which I have set to "-b 300k") in order to get higher quality or smaller file size. I also use "-croptop 6" in the command because the videos coming out of my TiVo have a few pixels’ worth of noise/static at the top; if yours don’t, then you can remove this parameter. For reference, this turns an hour-long 1.2 GB *.mpg file into a ~200 MB *.mp4 file in about 12 minutes on my Core2Duo system.
Third, it calls AtomicParsley in order to set the tags on the *.mp4 file.
Finally, it uses scp to copy the file to my Mac Mini; I had previously set up passwordless SSH keys so that on my local network this works without me having to type in the password. Of course if you’re not copying to a Mac system then you can delete this part of the script.
At this point, the *.mp4 file is ready to be imported into iTunes or any other app that can handle syncing your iPod. I wanted to automate this step too, so I created a small script called add_videos_to_iTunes.applescript on my Mac Mini. I modified my crontab so that the system calls this script every 10 minutes. The script simply scans a folder called /Users/me/video/todo -- the folder that my TiVo-to-iPod-backend script copies the files into -- then moves the files into /Users/me/video/iTunes, and finally tells iTunes to add the files to its library.
With all of this in place, all I need to do is visit my TiVo’s web server about once a day, download the videos that I want, then right-click on them and choose TiVo-to-iPod. The 2 scripts (one on each system) take care of converting the files and adding them to iTunes, so all I need to do is put my iPhone in its cradle as usual, and iTunes auto-syncs my TV shows just like it does my podcasts.
NB: I’ll probably make the TiVo-to-iPod script into a cronjob too, and I could even automate the process of scraping the TiVo web server page and downloading the *.TiVo files, but for now, this system is reasonably automated for my liking.