1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

tivodecode with TS support

Discussion in 'TiVo Home Media Features & TiVoToGo' started by moyekj, Feb 17, 2010.

  1. moyekj

    moyekj Well-Known Member

    11,141
    31
    Jan 23, 2006
    Mission...
    I have tivodecode sourceforge project on my sourceforge watch list and yesterday got an email about a patch to tivodecode. The original source code of patch can be found at:
    http://sourceforge.net/tracker/?group_id=183716&atid=906362

    This apparently adds mpeg2 Transport Stream (TS) support to tivodecode. Previously tivodecode only supported decrypt of TiVo files in mpeg2 Program Stream format.

    This should be useful for the folks in Australia & New Zealand that have option to download TiVo files in Transport Stream format. If USA series 3 or beyond TiVo units ever get that option with a software update (I hope we do since TS downloads are much faster than PS downloads) then hopefully it will work here as well.

    I had to make a couple of changes to tivodecode.c to make it work properly with metadata dumper from TiVo files used by kmttg but other than that seems to work fine for metadata dumping & decrypting for PS TiVo files. Supposedly should work for TS TiVo files as well but I can't test that.

    For lack of better place to put it as part of kmttg project I've made this patched version of tivodecode available:
    Source
    Win32 binary
     
  2. wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    Sweet. I was worried that the tivodecode project was dead. I made a half-hearted attempt to understand it myself, and gave up... but I'd been thinking of getting serious about it and trying again, because we need the TS support.

    Could you please outline your changes? I'm not finding them in the ChangeLog. But I did find that your version wouldn't build on Ubuntu -- 'unrecognized command line option "-mno-cygwin"'.

    On a US TiVo, you can add "&System=ts" to the download URL for a recording, and get something that the old tivodecode can't handle -- though I can't be sure it's a transport stream, since it doesn't decode. Unfortunately it still doesn't work with "0.3pre1", either (segfaults).
     
  3. moyekj

    moyekj Well-Known Member

    11,141
    31
    Jan 23, 2006
    Mission...
    For making your own build you should 1st run ./configure before make. That should setup proper Makefile to build on your system.
    There is no Changelog. I grabbed the source code that was posted by some gracious anonymous user and just made a couple of changes to tivodecode.c to get the "-D" option working properly. Since the code was just a patch posted by anonymous user there is no source code changelog available or description of all changes that were made. Running diff on several files reveals quite a lot of changes though.

    The "&System=ts" does not generate a usable TS TiVo file. This version of tivodecode I believe will work for Aus/NZ systems with the "&Format=video/x-tivo-mpeg-ts" url option. For current 11.x software for USA systems adding that option does not produce TS TiVo files, but hopefully in a future Series 3 update and/or upcoming new hardware/software from TiVo it will.
     
  4. moyekj

    moyekj Well-Known Member

    11,141
    31
    Jan 23, 2006
    Mission...
    FYI, was able to build from source on a Red Hat Enterprise 4 Linux system, so should compile on other Linux systems very easily as well. The stupid zip file maker I used messed up permissions, so you have to make configure executable, but very simply to make on Linux (or Mac OS for that matter):
    chmod +x configure
    ./configure
    make
     
  5. wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    Ah, it does have a configure script, doesn't it. :eek: I guess I just expect a "make distclean" before archiving, so it throws me off when there's already a Makefile.

    Re: the ChangeLog, it's not much, but there is this, in the "0.3pre1" version:

    Code:
    0.3pre1:
            * add support for TS files.
    
            * known bug :
            Packet N of PID XX starts a new series of PES headers, which spill over into
            packet N+1 of PID XX, which has an encrypted payload.  The problem is how to
            cleanly make that "continuation" from packet N to N+1, such that the offset
            into Packet N+1 can be determined where the decrypt needs to start.
    But I was looking for a description of the differences between "0.3pre1" and your "0.3pre2". I ended up doing a diff -- basically you're reversing a few unexplained changes in 0.3pre1 that didn't seem to make sense. :up:
     
  6. moyekj

    moyekj Well-Known Member

    11,141
    31
    Jan 23, 2006
    Mission...
    I noticed the windows stdin/stdout piping patches were not part of this distribution so I applied those to make 0.3pre3. I updated the links in 1st post of this thread accordingly. The source now preserves proper permissions and was tarred up after make distclean for a clean start.

    I suppose at some point I should post my changes as a patch back at sourceforge along with some comments of changes I made for continuity sake.
    EDIT: Just added my source code changes as patch to sourceforge site.
     
  7. Mar 3, 2010 #7 of 33
    scop

    scop New Member

    10
    0
    Jan 21, 2010
    Hi, I am an Australian Tivo HD user and have just started using TTG. This caught my attention as I just noticed that tivodecode was choking on the TS file that is the default download here. Unfortunately, I tried testing this patched version but it is still not working. :( Thanks for the heads up anyway, if I can do any more testing to help fix it I am happy to do so.
     
  8. Mar 3, 2010 #8 of 33
    scop

    scop New Member

    10
    0
    Jan 21, 2010
    Sorry, I had placed the patched files in the wrong place! It is working. :D
     
  9. Mar 3, 2010 #9 of 33
    scop

    scop New Member

    10
    0
    Jan 21, 2010
    More news, the resulting mpg file is frozen at the first frame and refuses to play! :( This is using VLC Player.
     
  10. moyekj

    moyekj Well-Known Member

    11,141
    31
    Jan 23, 2006
    Mission...
    What does mediainfo report for both the TiVo file & the decrypted TS file? Have you tried a player besides VLC?
     
  11. scop

    scop New Member

    10
    0
    Jan 21, 2010
    Mediainfo reports the following:

    Tivo File:

    General
    ID : 1
    Complete name : D:\Tim\My Documents\My Videos\TiVo Recordings\Paul Merton in China (Recorded Jan 10, 2010, ABC HD).TiVo
    Format : MPEG-TS
    File size : 4.21 GiB

    Video
    ID : 2314 (0x90A)
    Menu ID : 1 (0x1)
    Format : MPEG Video
    Encryption : Encrypted

    Audio
    ID : 2315 (0x90B)
    Menu ID : 1 (0x1)
    Format : AC-3
    Format/Info : Audio Coding 3
    Encryption : Encrypted


    Decrypted mpeg file:


    General
    ID : 1
    Complete name : D:\Tim\My Documents\My Videos\kmttg\Paul Merton in China (Recorded Jan 10, 2010, ABC HD).mpg
    Format : MPEG-TS
    File size : 4.21 GiB
    Duration : 1h 0mn
    Overall bit rate : 10.0 Mbps

    Video
    ID : 2314 (0x90A)
    Menu ID : 1 (0x1)
    Format : MPEG Video
    Format version : Version 2
    Format profile : Main@High
    Format settings, BVOP : Yes
    Format settings, Matrix : Default
    Duration : 1h 0mn
    Bit rate mode : Variable
    Bit rate : 8 889 Kbps
    Nominal bit rate : 90.0 Mbps
    Width : 1 280 pixels
    Height : 720 pixels
    Display aspect ratio : 16:9
    Frame rate : 50.000 fps
    Standard : Component
    Resolution : 8 bits
    Colorimetry : 4:2:0
    Bits/(Pixel*Frame) : 0.193
    Stream size : 3.73 GiB (89%)

    Audio
    ID : 2315 (0x90B)
    Menu ID : 1 (0x1)
    Format : AC-3
    Format/Info : Audio Coding 3
    Duration : 1h 0mn
    Bit rate mode : Constant
    Bit rate : 448 Kbps
    Channel(s) : 2 channels
    Channel positions : L R
    Sampling rate : 48.0 KHz
    Video delay : -806ms
    Stream size : 192 MiB (4%)

    I have now tested this on 3 media players:

    VLC Player - frozen at the first frame
    WIndows Media Player 11 - nothing, just a black box and an error message
    Media Player Classic Home Cinema - interesting, it works, but it is riddled with an annoying wave of blocky pixellation every couple of seconds or so.

    HTH, Tim.
     
  12. wmcbrine

    wmcbrine Ziphead

    10,364
    22
    Aug 2, 2003
    I've seen this myself on regular old program streams. If I manually skip past the beginning, they work, IIRC. But mostly I just feed them through ffmpeg and/or back to a TiVo, and there hasn't been a problem there, so I haven't worried much about the freezing.
     
  13. scop

    scop New Member

    10
    0
    Jan 21, 2010
    In my case it is not possible (using VLC) to skip past it, it just stays stuck on the first frame.

    I just tried an ffmpeg based media player (SMPlayer) and it has the same effect as MPC, it plays with good audio but the video is ruined with regular pixellation (if that's the right word).

    I'll send it back to the TiVo to see what happens there.
     
  14. moyekj

    moyekj Well-Known Member

    11,141
    31
    Jan 23, 2006
    Mission...
    You may be running into the issue described by the anonymous poster about 1 remaining problem:
    i.e. It may not be properly decrypting all the packets as a result. Probably someone familiar with TS and coding could figure out a solution for that issue. The description probably doesn't make much sense until one digs into the code.

    Any others reading this thread from NZ or Australia had any luck with this? It sounds like the TiVo Premiere units at least could benefit from this, so will be interesting to see if it works for them when released.
     
  15. moyekj

    moyekj Well-Known Member

    11,141
    31
    Jan 23, 2006
    Mission...
    The previous version of source code still had version set to "0.2pre4" so it was confusing when running "tivodecode --version" to get that version printed out. I updated the code to correspond to version "0.3pre4" and updated the source code and win32 links in the first post of this thread.

    NOTE: The TiVo Premiere units have option to download in TS format which gives good speedup over PS format, so this version of tivodecode is useful for more than just Australia/NZ units now. The next release of kmttg will package in this version for windows & mac binaries to go along with the already built in support for TS format downloads.
     
  16. orangeboy

    orangeboy yes, I AM orangeboy!

    4,083
    0
    Apr 19, 2004
    East Moline, IL
    Hurry! My Premiere could be shipping soon! :D
     
  17. philhu

    philhu User Since Day ONE!

    831
    0
    Apr 11, 2001
    Funcity, MA
    This is what I am seeing on TS files downloaded from a Premiere Tivo with TS download turned on.
     
  18. philhu

    philhu User Since Day ONE!

    831
    0
    Apr 11, 2001
    Funcity, MA
    Kevin, did you ever package in this new version of TivoDecode to kmttg?

    I tried some downloads using TS format. The download speed is 50%+ percent faster! But the output, almost works. I get blocky pixelization every 4-5 seconds or so, converted to MP4

    Is there a windows version of the newer TivoDecode?

    Does anyone know if VideoRedo 4 H.264 program can handle TS Streams?
     
  19. moyekj

    moyekj Well-Known Member

    11,141
    31
    Jan 23, 2006
    Mission...
    I did package in A version of tivodecode with TS support, but there are still some bugs in the program when dealing with certain TS streams where it will not fully decrypt all packets properly, so the pixelization you see are improperly decrypted blocks.
    The person who did all the work on adding TS support prefers to remain anonymous and is aware of the remaining issues but hasn't had the time to work on them further last I heard.
    So there is no version that I am aware of that works with all TS streams. i.e. For now you are better off either sticking with PS streams or use Windows TiVoDirectShow.dll (which VRD uses for example) instead for decrypting TS streams.
     
  20. muerte33

    muerte33 New Member

    87
    0
    Jul 4, 2008

Share This Page