Proof of concept

Discussion in 'TiVo Home Media Features & TiVoToGo' started by greg_burns, Jan 30, 2006.

  1. Jan 30, 2006 #1 of 230
    greg_burns

    greg_burns Now in HD

    6,392
    2
    May 21, 2004
    Slower...

    Advertisements

    I've been thinking of doing this for quite awhile and finally gave it a shot.

    I just "removed" the .tivo header portion of a Family Guy episode I transferred using a hex editor and saved it as a file named FG.dat

    I then edited the original .tivo file in VideoRedo to remove commercials, saved that away as FG.mpg

    Opened up a DOS prompt and typed copy /b FG.dat+FG.mpg FG_edit.tivo

    Just transferred FG_edit.tivo back to my TiVo and ... voila ... I have a Family Guy episode with no commercials but all its information intact (and in a folder!). :up:

    Now to automate this... and figure out how to alter the xml data inside the .tivo portion of the file. :cool:

    Edit: We'll I've taken a stab at automating the removal of the header...

    [​IMG]

    TiVo Attach
     
  2. Jan 31, 2006 #2 of 230
    davezatz

    davezatz Funkadelic

    4,692
    212
    Apr 18, 2002
    Fairfax, VA
    Sweet!
     
  3. Jan 31, 2006 #3 of 230
    dmets

    dmets New Member

    105
    0
    Feb 3, 2003
    Columbus, OH
    So could this process also be used to add Tivo metadata to video files that did not originate from a tivo. Like Family Videos - So that they could have titles and be placed in folders when transfered to a Tivo via GoBack...
     
  4. Jan 31, 2006 #4 of 230
    greg_burns

    greg_burns Now in HD

    6,392
    2
    May 21, 2004
    Slower...
    First I gotta figure out how the information is stored in the header. It is not in clear text, but it may simple be Base64 or something. I see a hash and salt combination. I assume that is just hashing the MAK and not all the metadata, but I am not sure.

    That would be [peter]sweet![/peter] though. :)
     
  5. Jan 31, 2006 #5 of 230
    HDTiVo

    HDTiVo Not so Senior Member

    5,556
    0
    Nov 27, 2002

    Advertisements

    Congratulations, you are on the way to providing an enormous benefit to the TiVo World.
     
  6. Jan 31, 2006 #6 of 230
    gonzotek

    gonzotek tivo_xml developer

    2,538
    59
    Sep 24, 2004
    Outside...
    Good work, and good luck on the next steps!!!
     
  7. Jan 31, 2006 #7 of 230
    davezatz

    davezatz Funkadelic

    4,692
    212
    Apr 18, 2002
    Fairfax, VA
    It would be nice if TiVo could point us (YOU) in the right direction for creating custom headers until they create some sort of TiVo Desktop add-on widget to do it. I do remember early on there was a Wiki entry somewhere trying to decode that stuff, but I don't think they got very far. (Their goal was different anyhow.)

    It'd be nice to add Dave's Home Video or something and end up with a folder of all my home videos. Not that I have any home videos, but maybe I'd think about getting a camera. :)
     
  8. Jan 31, 2006 #8 of 230
    samkuhn

    samkuhn New Member

    112
    0
    Mar 29, 2002
    So if you copy the header back on without changing the file extension to .tivo does the Tivo still recognize the metadata? Is the editing file that has been re-merged playable on a personal computer that doesn't know the MAK?

    I sent this thread to the author of VideoRedo asking if he would add the ability to retain the metadata after editing as described in this thread.
     
  9. Jan 31, 2006 #9 of 230
    videoredo

    videoredo New Member

    13
    0
    Sep 12, 2004
    This is Dan from VideoReDo. Since the text isn't in clear-text if someone can describe what it looks like and where its located we can look at automating this. I can be reached at the videoredo support email (The board would not let me post our email address).
     
  10. Jan 31, 2006 #10 of 230
    greg_burns

    greg_burns Now in HD

    6,392
    2
    May 21, 2004
    Slower...
    No. You can try this yourself by just renaming an original .tivo file to .mpg. Your Tivo will no longer show the metadata for that file, just its filename. The Tivo box must decide whether to even look for metadata based on file extension. If you do rename .tivo file to .mpg it won't even transfer.

    Haven't tried that. Can't image that it would since the part of the file that makes it a .tivo file has been reattached.
     
  11. Jan 31, 2006 #11 of 230
    greg_burns

    greg_burns Now in HD

    6,392
    2
    May 21, 2004
    Slower...
    Well, all I am doing is opening any Tivo file up using a Hex editor. (I am using the one built-into VirtualDub, its on the Tools menu).

    You quickly see a disclaimer at the start of the file in clear text\xml format.

    From 0x480 to around 0x4000 is data. I assume this must be where the metadata is stored. The regular mpeg file seems to be after this point.
     
  12. Feb 1, 2006 #12 of 230
    jmemmott

    jmemmott New Member

    393
    0
    Jul 12, 2003
    Santa Cruz, CA
    I spent some time with the file format when I was learning to extract the Closed Captioning information. Adding what has been posted here to what I already know, I would expect that reusing the existing header is workable but creating something custom will be much more difficult. The file is really two parts. The first part is a header created by Tivo with a few notable objects:

    Byte 0 : Fingerprint – “TiVo”
    Byte 9, length 4 or Byte 11, length 2 : offset of the MPEG2 Program Stream.
    Byte 28 : Start of the xml wrapper containing the metadata.
    a. Copy Right Notice is in clear text.
    b. The metadata follows and is encrypted with a cipher I believe is similar to Blowfish.

    The offset value points to a standard (ISO/IEC 13818) MPEG2 Program Stream. Some parts of the program stream are allowed to be encrypted in 13818 and TiVo uses this. In particular, all P and B pictures as well as the audio blocks are encrypted. Everything before the MPEG2 Program Stream should be copied as metadata.
     
  13. Feb 1, 2006 #13 of 230
    AV_Novice

    AV_Novice New Member

    49
    0
    Jan 18, 2006
    Northern...
    A quick Google of Blowfish cipher took me to a web site that claims to have a list of 150 products that use Blowfish. Tivo, Inc. is listed.
     
  14. Feb 1, 2006 #14 of 230
    jmemmott

    jmemmott New Member

    393
    0
    Jul 12, 2003
    Santa Cruz, CA
    Blowfish is conjecture on my part but it does have characteristics that fit such as processor/memory requirements, speed, security, license requirements, etc. However, there is also evidence that they have looked at other related algorithms such as Turing. In any case, it is a modern block or stream cipher, so even if Tivo explicitly told us which one they are using, we would still not be likely to break it. The security is in the key and key expansion algorithms not the cipher and no one except Tivo knows what those are...
     
  15. Feb 1, 2006 #15 of 230
    greg_burns

    greg_burns Now in HD

    6,392
    2
    May 21, 2004
    Slower...
    I noticed there is a thread on the other site (which shall remain nameless and unlinked :rolleyes: ) that is trying to determine the makeup of .tivo file as well.

    "tivo file format (split from: Decrypting TiVo ToGo)"

    I'm afraid I am in WAY over my head. :(
     
  16. Feb 1, 2006 #16 of 230
    HDTiVo

    HDTiVo Not so Senior Member

    5,556
    0
    Nov 27, 2002
    What you have done so far is very valuable. It would be nice if, for example, VideoRedo just added the option to preserve the data and output to a .tivo extension.
     
  17. Feb 1, 2006 #17 of 230
    greg_burns

    greg_burns Now in HD

    6,392
    2
    May 21, 2004
    Slower...
    Dan's (from VideoRedo) response to my email to him...

    Let's hope he's right. :)
     
  18. Feb 1, 2006 #18 of 230
    endicot

    endicot New Member

    8
    0
    Feb 1, 2006
    This is awesome!

    Is is possible to do the reverse? That is, make up a .tivo from a homemade .mpg - adding the tivo meta data (episode information) to the mix. Is there a utility to do this easy (assuming you have your media access key)?
     
  19. Feb 1, 2006 #19 of 230
    greg_burns

    greg_burns Now in HD

    6,392
    2
    May 21, 2004
    Slower...
    There is currently no such utility. Unless Tivo makes the software themselves to do this, the chance of one of us figuring it out looks slim. There appears to be somesort of encryption (Blowfish?) on that portion of the file.
     
  20. Feb 1, 2006 #20 of 230
    megazone

    megazone Hardcore TiVo Geek

    3,302
    0
    Mar 3, 2002
    .worcester.m...
    TiVo has used the El Gamal and Turing algorithms, but I don't know exactly which algorithm is used on TTG.
     

Share This Page

spam firewall

Advertisements