Java port of TivoDecode

Discussion in 'Developers Corner' started by fflewddur, Sep 6, 2015.

  1. moyekj

    moyekj Well-Known Member

    12,125
    795
    Jan 23, 2006
    Mission...
    I sent a PM to fflewddur with your MAK.
     
  2. ejonesss

    ejonesss New Member

    116
    0
    Aug 13, 2007
    i have kmttg and just got the latest tivolibre jar how do i install the jar so i can use it with kmttg?
     
  3. fflewddur

    fflewddur R&D

    169
    3
    Jul 20, 2015
    Seattle, WA
    TivoLibre is already included in the kmttg.jar, you don't need to download it separately.
     
  4. ejonesss

    ejonesss New Member

    116
    0
    Aug 13, 2007
  5. moyekj

    moyekj Well-Known Member

    12,125
    795
    Jan 23, 2006
    Mission...
  6. Jayboy3

    Jayboy3 Member

    101
    1
    Jan 2, 2010
    I just wanted to share that DSD works like a champ for me, gremlin free. Just curious, why isn't everybody using it? Does tivolibre or tivodecode fit some other circumspect better?

    Sent from my SM-N900V using Tapatalk
     
  7. HerronScott

    HerronScott Well-Known Member

    7,389
    1,060
    Jan 1, 2002
    Staunton, VA
    From the kmttg page on descrypting TS TiVo files:

    Windows users have option of using DirectShow Dump (DSD) program for decrypting .TiVo files instead of using tivodecode. The advantage of DSD is that it works with both PS and TS .TiVo files. The disadvantages are:

    •Only runs on Windows platform
    •Requires at least a partial install of TiVo Desktop, which is achieved by first fully installing TiVo Desktop and then uninstalling and choosing option to keep partial install.

    http://sourceforge.net/p/kmttg/wiki/Decrypting_TS_TiVo_files/

    This probably should be updated to include tivolibre as an option.

    Scott
     
  8. moyekj

    moyekj Well-Known Member

    12,125
    795
    Jan 23, 2006
    Mission...
    Done, thanks.
     
  9. ejonesss

    ejonesss New Member

    116
    0
    Aug 13, 2007

    then it is necessary to use the tivolibre jar and to add a way to use it in future version.
     
  10. moyekj

    moyekj Well-Known Member

    12,125
    795
    Jan 23, 2006
    Mission...
    kmttg has regular updates, so any necessary tivolibre updates will be incorporated quickly, so no need.
     
  11. ejonesss

    ejonesss New Member

    116
    0
    Aug 13, 2007
    ok is there source so i can make updates my self and what do i need to write and compile?
     
  12. moyekj

    moyekj Well-Known Member

    12,125
    795
    Jan 23, 2006
    Mission...
  13. fflewddur

    fflewddur R&D

    169
    3
    Jul 20, 2015
    Seattle, WA
    Just wanted to give a status update: I found the problem and think I've got it fixed, but I'm going to let it run through my entire test set before releasing. Hopefully I'll have the fix posted tomorrow night :)
     
  14. Feb 1, 2016 #134 of 154
    ejonesss

    ejonesss New Member

    116
    0
    Aug 13, 2007
  15. Feb 1, 2016 #135 of 154
    fflewddur

    fflewddur R&D

    169
    3
    Jul 20, 2015
    Seattle, WA
    Got it, thanks for sending the file! I found the problem and am working on a fix...
     
  16. Feb 1, 2016 #136 of 154
    HerronScott

    HerronScott Well-Known Member

    7,389
    1,060
    Jan 1, 2002
    Staunton, VA
    Wow that was fast (in both cases)!

    Scott
     
  17. Feb 1, 2016 #137 of 154
    moyekj

    moyekj Well-Known Member

    12,125
    795
    Jan 23, 2006
    Mission...
    Yes, great work in quickly finding fixes to remaining issues Todd! We appreciate your work.
     
  18. Feb 2, 2016 #138 of 154
    fflewddur

    fflewddur R&D

    169
    3
    Jul 20, 2015
    Seattle, WA
    Thanks, it's my pleasure! I'm going to let my test script run overnight, and if everything looks good, should have a release that fixes both of these issues out tomorrow after work.
     
  19. Feb 2, 2016 #139 of 154
    HerronScott

    HerronScott Well-Known Member

    7,389
    1,060
    Jan 1, 2002
    Staunton, VA
    I'm curious what you found in each case?

    Scott
     
  20. Feb 2, 2016 #140 of 154
    fflewddur

    fflewddur R&D

    169
    3
    Jul 20, 2015
    Seattle, WA
    Both issues were related to problems with how TivoLibre handles PES headers. Each TS packet begins with a series of PES headers which should not be decrypted, even if the TS packet itself says that it's encrypted. Sometimes these are split across multiple TS packets, so I had code that looked at the last PES header in each packet and calculated how far into the next packet it would extend, so decryption wouldn't start too soon (based on the structure of its output files, this seems to be the same thing TiVo Desktop does; tivodecode tries to concat all of the TS packets together, so it shouldn't have this issue, although it means tivodecode creates output files that aren't binary identical to TiVo Desktop. That makes it much harder to test whether tivodecode's output is correct, since a simple diff against the output of the same file run through TiVo Desktop will find differences in TS packet order).

    Anyway, turns out there were a pair of PES header edge cases that never occurred in my test collection (so thanks for the bug reports!): 1) the PES header's start code can end in one packet but with the rest of the header in the next packet, or 2) the PES header's prefix (23 bits of 0 followed by a 1 bit) can be split across two TS packets. TivoLibre was treating both of these cases as if the PES headers had ended in the first packet, so if the next packet was encrypted, it would start decrypting it at the start of the TS packet, instead of skipping over the PES headers and starting decryption once they ended. Because TiVo files use a stream cypher, beginning the decryption even one byte too soon means that every byte after that point will be incorrectly decoded. TiVo files only encrypt a small percentage of their total packets, hence the largely normal video with blocks of pixelation: those pixelation artifacts were the improperly decrypted packets.

    Tonight's release (0.7.3, available at https://github.com/fflewddur/tivolibre/releases) fixes both of these issues :)
     

Share This Page