Programming

How to stream your ripped DVDs to TiVo with metadata and commentaries

pyTivo is a tool that allows you to stream video files from your computer to your TiVo. It has served me well for watching home movies, but when I decided to rip my DVD collection and watch movies via TiVo instead of using the physical discs, I found two problems:

  1. No metadata. All I see on TiVo is the title (which is just the filename of the video). I’d like to see the year the movie came out, the MPAA rating, the description, etc. just like I do for movies I recorded off of TV.
  2. No commentary tracks. The best part of owning a physical DVD is access to the commentary track(s); unfortunately, pyTivo isn’t able to stream the video in such a way that alternate audio can be selected via TiVo’s built-in audio selection, so the default leaves you with just the first audio track.

I’ve written two scripts to fix these problems, and they’re available at GitHub.

pytivo_metadata.py

pyTivo uses metadata files to supply information to the TiVo about each video file, like the description or the year the movie came out. pytivo_metadata.py generates metadata files for all videos in a given directory (and subdirectories) so you don’t have to write them yourself.

Here’s an example of a filename from a ripped DVD:

/path/to/movies/The Family Man.m4v

This is the movie “The Family Man,” starring Nicolas Cage. Without any metadata, this is what the movie looks like on TiVo:

IMG_6717

Running pytivo_metadata.py /path/to/movies/ will query The Open Movie Database API for information on all videos in that directory that don’t have metadata files; here’s the metadata that pytivo_metadata.py will save to The Family Man.m4v.txt:

title : The Family Man
vProgramGenre : Comedy
vProgramGenre : Drama
vProgramGenre : Romance
isEpisode : false
year : 2000
movieYear : 2000
description : A fast-lane investment broker, offered the opportunity to see how the other half lives, wakes up to find that his sports car and girlfriend have become a mini-van and wife.
mpaaRating : P3
vActor : Nicolas Cage
vActor : Téa Leoni
vActor : Don Cheadle
vActor : Jeremy Piven
vDirector : Brett Ratner
vWriter : David Diamond
vWriter : David Weissman

pyTivo will automatically use this file to supply the metadata for The Family Man.m4v to TiVo.

IMG_6718

(See the pyTivo wiki for more info on the metadata file format.)

No guarantees are made regarding the correct movie being returned from the API, so maybe do a cursory check of that after running the script. Or don’t. Whatever.

pytivo_commentary.py

If you rip a DVD and include multiple audio tracks in the file, you can stream each of those tracks via pyTivo by using pytivo_commentary.py.

If you’re using Handbrake, go to the Audio tab and add each commentary track as an additional entry:

Screen Shot 2013-01-21 at 8.29.54 PM

Then, add a note to the filename to let pytivo_commentary.py know that there’s a commentary track available:

The Family Man (Commentary).m4v

If the movie has more than one commentary, name it like this:

The Family Man (Commentary x 3).m4v

(Yes, The Family Man, starring Nicolas Cage, does have three commentary tracks; one of them is completely dedicated to the music score. What a country!)

pytivo_commentary.py will then generate multiple copies of the video and metadata file (one for each commentary) and add “Commentary #1” (or #2 or #3) to each title. The additional video files are only hardlinks to the original, so no additional disk space is needed.

Screen Shot 2013-01-21 at 8.58.59 PM

Then, add this line to the [Server] section of your pyTivo.conf (and restart the pyTivo service):

audio_lang=commentary

This causes pyTivo to choose the first audio track it can find that includes the label commentary. In the metadata file for each commentary track, you’ll see a line like this:

Override_mapAudio 0.2 : commentary

This tells pyTivo to explicitly use the label commentary for the second audio track instead of whatever the label was which means that when you stream this video, pyTivo will send the commentary audio track instead of the original audio. Because the metadata file for the non-commentary version doesn’t have this override, pyTivo will send the first audio track.

Conclusion

There you have it; now you can rip your DVDs to a hard drive, stream them to your TiVo, listen to the commentaries, and never have to worry about scratches, extra remotes, or mandatory previews before your movie.

These scripts were tested with the wmcbrine version of pyTivo (specifically, the version pulled as of this commit).

The scripts and their required module (pytivo_utilities.py) are available on GitHub in the pyTivo Utilities repository.

Standard

4 comments on “How to stream your ripped DVDs to TiVo with metadata and commentaries

  1. Thomas says:

    Hi there,

    Loved your program … sorry, but I am a newbie … can you supply instructions on how to run it on Windows?

Leave a Reply

Your email address will not be published. Required fields are marked *