Wednesday, May 19, 2010

Archive HDTV Recordings to Your Mac, Then Stream Them Back to Your TiVo!

It's not hard to turn your Mac or a PC into an archive for your TiVo recordings. Then you can delete the recordings from the TiVo itself, and play them from your Mac to your TiVo any time you want.

I like to record classic movies from channels like TCM HD. Then I move them via my home wireless network to an external hard drive on my iMac. After that, I decode them into a non-copy-protected form that can be streamed back to a TiVo anytime I want to watch the movie again. Meanwhile, the original recording can be deleted from the TiVo's hard drive.

In Viva pyTivo! I detailed how I use the freeware pyTivoX app to send Mac media content to my TiVo units. Stream, Baby, Stream gave more information on the freeware StreamBaby app, which is what pyTivoX actually uses to stream media content to a TiVo. pyTivoX incorporates StreamBaby, so you don't have to install or configure StreamBaby on your Mac manually.

With pyTivoX-cum-StreamBaby you can, using the TiVo itself, pull archived TiVo recordings from your Mac back to your TiVo and watch them as they stream. Streaming Mac videos to a TiVo avoids having to make copies of them on the TiVo's hard drive, so if space is limited there, streaming is the way to go.

But how do you get the original recordings from your TiVo to your Mac in the first place?

An excellent way to download TiVo files and store them on a computer is to use kmttg. kmttg, which is Java-based freeware, implements its own version of what is generally called "TiVo To Go," or TTG. kmttg downloads files from the TiVo and decodes them into non-copy-protected form. (It also allows you to do other neat things with the files it downloads and decodes, but I won't cover those here.) kmttg runs on several platforms, including the Mac which I use, an iMac running Mac OS X 10.5.8.

If you want to use kmttg on your Mac, check out the official installation instructions here. Also, you may want to make sure you have the latest version of Java on your Mac. You can do that by invoking the Software Update feature available on the Apple menu.

The same kmttg download package works on all supported platforms, and the current package as of this writing is (The screen shots below were captured using an earlier version of kmttg.) On a Mac, download and unzip it to a folder named kmttg_v0p7l, then open the folder and launch kmttg.jar.

You may be warned that "kmttg.jar" is a Java application which was downloaded from the Internet.  Are you sure you want to open it? You'll just click "Open."

Then you'll see (click to enlarge):

What this means is that kmttg wants to download several free software tools, such as tivodecode, MEncoder, HandBrake, and FFmpeg, and to put them in appropriately named folders within the kmttg_v0p7l folder. Click "Yes." You'll then wait for several minutes while the downloads take place, and then you'll see (click to enlarge):

The media access key, or MAK, of your TiVo is a ten-digit number you can discover by navigating to TiVo Central -> Messages & Settings -> Account & System Information -> Media Access Key on your TiVo. You enter it into the dialog box and click "OK." (If you have more than one TiVo, they all have the same MAK, so you just need to find one of them.)

Now kmttg will give your Mac access the Now Playing list (NPL) for each of your TiVos. You just click on the name of any TiVo — such as, for me, "Bedroom TiVo" — and click the "Refresh" button. When the NPL appears after several seconds, you can scroll through it to find a movie or other recorded program to copy to your Mac. In the screen shot below (click to enlarge), I've selected "Shane," recorded from TCM HD:

Now comes a tricky part. You have to configure kmttg in advance to download your .TiVo files to whatever intended folder you have set up to receive them. In Finder, I created a TiVo Transfers folder on an external drive. Within it I created a Just Transferred folder.

Then I selected File: Configure ... at the upper left of the kmttg window. It brought up a dialog (click to enlarge):

in which I configured where kmttg is to put the files it downloads or creates. In the box next to where it says TiVo Output Dir (for "directory") I double-clicked to bring up a folder selection dialog. In it I had to navigate to find the Just Transferred folder within the TiVo Transfers folder that I set up on my external hard drive (click to enlarge):

I clicked Choose Directory once that folder was named in the File: box in the dialog. I also did the same thing for the other directories that kmttg configures via this dialog, including, crucially, the .mpg Output Dir.

In addition, I clicked check boxes to tell kmttg to Remove .TiVo after file decrypt — that meant that the downloaded TiVo file, after being decrypted into a more usable .mpg file that lacks copy protection, wouldn't permanently take up space on my Mac's external hard drive — and to Overwrite existing files in situations where I reinitiate jobs that have failed to run to completion previously.

When all that was done, I saw (click to enlarge):

At this point I clicked "OK," and kmttg was configured the way I wanted it.

Once you have everything configured, you need to select which kmttg services you want to use for the next job you initiate (click to enlarge):

Here I am using (in addition to the kmttg "download" functionality, which is assumed as a default) "metadata" and "decrypt," so I have clicked on each of those at the top of the kmttg window to turn on the check mark next to them. All of the other services have no check marks next to them.

I have in the screen shot above also initiated the transfer of "The Gallant Hours" from my Living Room TiVo. I did this by
  • selecting the Living Room TiVo tab and clicking the Refresh button
  • selecting "The Gallant Hours" from the Now Playing list that appeared after several seconds
  • clicking the START JOBS button
At the point at which the screen shot above was taken, the "metadata" job had already been executed, giving me a file in my receiving folder called The Gallant Hours (04_30_2010).mpg.txt. It contained:

title : The Gallant Hours
seriesTitle : The Gallant Hours
description : Adm. William F. "Bull" Halsey Jr. outwits Japanese Adm. Yamamoto in the 1942 Pacific. 
time : 2010-04-30T06:15:00Z
mpaaRating : N8
movieYear : 1960
isEpisode : false
isEpisodic : false
showingBits : 1024
starRating : x6
displayMajorNumber : 890
callsign : TCMHD
vActor : Cagney|James
vActor : Weaver|Dennis
vActor : Costello|Ward
vActor : Jaeckel|Richard
vActor : Tremayne|Les
vActor : Burton|Robert
vActor : Bailey|Raymond
vActor : Reid|Carl Benton
vActor : Sande|Walter
vActor : Swenson|Karl
vActor : Landers|Harry
vActor : Carlyle|Richard
vActor : Lontoc|Leon
vActor : Yagi|James
vActor : Zaremba|John
vDirector : Montgomery|Robert
vProducer : Montgomery|Robert
vProgramGenre : Biography
vSeriesGenre : Biography
vSeriesGenre : Documentary
vSeriesGenre : Movies

A subset of this metadata will wind up being displayed by StreamBaby on my TV screen when I stream my recording of "The Gallant Hours" back to my TiVo.

You can see in the screen snap above that the "download" job is still in progress, and has been executing for 2 hours, 3 minutes, 19 seconds. The "decrypt" job is queued pending the completion of the "download" job.

Now, in the following screen shot (click to enlarge), the "decrypt" job has finally begun executing:

The "decrypt" job invokes an app, tivodecode, that decrypts the The Gallant Hours (04_30_2010).TiVo file that was just downloaded, making a file named The Gallant Hours (04_30_2010).mpg in the same directory. This .mpg file contains the entire original recording at the original bitrate, file size, and quality. The only difference is that it is unencrypted. StreamBaby can accordingly stream it back to a TiVo.

kmttg offers a wide range of functionality beyond what I've just described, but this should be enough to get you started. You now know how to get kmttg, install it on your Mac, and begin using to to download, decrypt, and save metadata from recordings on your TiVo. These can be high-definition or standard-definition recordings — your choice. I generally download HD ... but be warned: HD takes a lot more time to download and a lot more space on your Mac's hard drives.

And HD is just about impossible to stream back, without a lot of undesirable pauses, to any TiVo model other than the new TiVo Premiere. Only the Premiere can do network input/output fast enough to keep up with pause-free HD streaming. Older TiVo models simply cannot do this — I know, I have three of them. To get a Premiere to stream HD video in "real time," you'll also need to equip it with a wireless-N adapter, or hook it up to wired Ethernet, since anything slower is too slow for real-time HD streaming.

It is possible, though, to use the PyTivo part of PyTivoX to transfer archived HD (or SD) recordings back to a non-Premiere TiVo's Now Playing List (i.e., to the TiVo's own hard drive). You'll just have to initiate the transfer some time in advance of when you want to watch the recording. If you allow sufficient lead time, you'll be able to watch the program, pause-free, even while the transfer is still ongoing.

But for pause-free spur-of-the-moment streaming of HD material that you have archived to your Mac, consider getting a TiVo Premiere with a wireless-N adapter. I personally love my own Premiere/wireless-N setup for just that reason.

No comments: