[MPlayer-dev-eng] .TiVo file support

Jeremy Drake mplayer at jdrake.com
Sun Dec 10 02:21:04 CET 2006


Hello, I have authored a program to convert .TiVo files to plain MPEG
(http://tivodecode.sourceforge.net/) and want to restructure it into a
library-type thing which could be used to make an mplayer plugin to play
these files.

I mentioned this on IRC the other day and it was suggested that I try
here.

I would like to ask about how such a codec should be written.
Is there any good place to look to get started writing a plugin which
filters an MPEG stream?

I would like to point out, before anyone mentions it, that the tivo://
thing is for hacked earlier tivos or some such, this is for the supported
TiVoToGo download feature.

First, let me apologize for my lack of knowledge of correct terminology,
most of what I know about this I learned from reverse engineering, so I
pretty much made up names for things as I went along ;)

The tivo files contain a normal MPEG stream at a certain offset in the
file, and only some of the packets need handling (those with scramble bits
set to 3).  Basically the TiVo file contains a valid mpeg file, and only a
fraction of the packets need to be decoded before being handled in the
normal mpeg way.

The TiVo file has a header, then at some offset (specified in the header)
there is an mpeg stream.  In this stream, some of the packets have certain
bits set in the packet header, which mean that this packet needs to be
sent through a Turing stream cipher.  If those bits are not set, then the
mpeg packet can be handled by a normal mpeg parser as-is.  After the
encoded packets are handled, they are normal mpeg packets that can be
handled by a normal mpeg parser.

The decoding needs to know the contents of the header of the file, some
bits in the packet header, and the decoding is stream-based so it needs to
have decoded the previous packets with the same block number (this is what
I call some certain bits which are involved in generating the Turing
stream).  You could potentially seek during playback to certain points in
the file without breaking the decrypt, but not every place you could have
in a non-encrypted file.  And if you tried, you would get garbage for a
sec and then go back to valid decoding at the next change of the block
number.

If you are interested in the specifics, the format was documented on this
wiki while being figured out (http://www.alt.org/wiki/index.php/TiVoToGo).

You can already play the files in mplayer by piping the output of the
decoder into mplayer:
tivodecode -m XXXXXXXXXX Test.TiVo | mplayer -

the -m is the MAK, a key from the tivo that made the file which is needed
to decrypt the file

It was suggested on IRC that perhaps the thing I needed to write was this:
rxt_: probably the easies way it the same used to handle stuff like mpeg
in mov or ogg in avi, that's making a tivo demuxer that sends its output
to the mpeg demuxer

It was also suggested that I talk to nicodvb on this list.

Thanks for your help, and I hope this message is somewhat sane, it is
mostly copied and pasted from what was said in IRC.  Please let me know if
there is any code around that would be a good starting place for me to
hack something like this together.  I do not know much of anything about
the internals of video software, or how to go about getting something put
together.  I would like to make a plugin for mplayer, whether an external
project or integrated in some way...

-- 
I'm fed up to the ears with old men dreaming up wars for young men to
die in.
		-- George McGovern



More information about the MPlayer-dev-eng mailing list