# Questions re those annyoing transport stream transfers



## alleybj (Dec 6, 2000)

So, now that Comcast has switched my beloved Turner Classic Movies to Mpeg4/H264, I am forced to archive movies using transport stream rather than program stream. My goal is to transfer the movies with as little alteration as possible, so that I can later transfer them back or stream them with no loss in quality. However, it seems that transferring the movie in transfer stream, in and of itself, introduces artifacts in the movie. Here are my questions:

1. Is there a program that does a better/the best job of transferring transfer stream files from Tivo to computer? Kmttg? Tivo Desktop? Archivo? something else? I would really like to duplicate my experience with program stream transfers, which was flawless with Tivo Desktop and Kmttg

2. Is it true that undecrypted transport stream files can't be transferred back to a Tivo? That has been my anecdotal experience with Tivo Desktop and pyTivo

3. What is the best program to decrypt transport files? Handbrake seemed to make the file unwatchable. I'm currently using VideoRedo

4. What is the best program to transfer decrypted transport stream files back to the Tivo? I can get pyTivo to do it, but it takes a 3G file and turns it into a 20G file on the Tivo, which I would prefer to avoid.

Thanks very much for any help!


----------



## moyekj (Jan 24, 2006)

1. kmttg can do it with config--Program Options--Transport Stream option turned on

2. pyTivo can handle these just fine. You are better off enabling "ts" option in pyTivo (ts=on in Server section) for series 4 and later TiVos.

3. Handbrake is for encoding, not decrypting TiVo files. tivolibre works fine to decrypt TS TiVo files and doesn't require Windows and partial TiVo Desktop installation. Otherwise DirectShowDump and VRD can be used on Windows with at least a partial TiVo Desktop installation. All options for decrypting TS TiVo files are available via kmttg.

4. That's probably because you don't have "ts" option enabled so it's transcoding to mpeg2 upon return. Enable "ts" option in pyTivo (ts=on in Server section) and the file will return without transcoding for series 4 and later TiVos.


----------



## alleybj (Dec 6, 2000)

moyekj said:


> 1. kmttg can do it with config--Program Options--Transport Stream option turned on
> 
> 2. pyTivo can handle these just fine. You are better off enabling "ts" option in pyTivo (ts=on in Server section) for series 4 and later TiVos.
> 
> ...


Thanks for the quick response. I will definitely try enabling the ts option. Am I correct that pyTivo won't transfer an encrypted transfer stream file back to the Tivo?


----------



## moyekj (Jan 24, 2006)

alleybj said:


> Am I correct that pyTivo won't transfer an encrypted transfer stream file back to the Tivo?


 Partially incorrect. It works fine for pulling, just not for pushing.

Even for pushes it *could* be made to work pretty easily by having a wrapper script for tivodecode that uses tivolibre instead. Pushes need to decrypt on the fly to transfer, but the standard tivodecode doesn't work well for TS TiVo files, hence need for tivolibre instead.


----------



## gweempose (Mar 23, 2003)

I've recently started using KMTTG to archive a bunch of stuff I had cluttering up my TiVos. I have not been using the transport stream option because I had read in the past that it caused problems. Is this still the case? What are the advantages and disadvantages of this option? I only have Series 4 and 5 TiVos.


----------



## moyekj (Jan 24, 2006)

Advantages:
* REQUIRED for recordings from H.264 channels which is becoming more prevalent now with cable companies (Cox, Comcast, FIOS).
* Downloads faster than PS transfers

Disadvantages:
* Apparently for some people results in incomplete transfers - haven't run into that myself.
* Can't use tivodecode to decrypt. tivolibre is a platform independent solution that can handle them that works for most cases, but there's still a few cases when it can't decrypt TS TiVo files correctly (still actively being developed as cases of those come up). DSD or VideoRedo for Windows with partial TiVo Desktop installation can be used to decrypt them fine as well.

Bottom line - stick with PS transfers if you can.


----------



## gweempose (Mar 23, 2003)

moyekj said:


> Advantages:
> * REQUIRED for recordings from H.264 channels which is becoming more prevalent now with cable companies (Cox, Comcast, FIOS).
> * Downloads faster than PS transfers
> 
> ...


Thanks for the info! I guess I'll stick with PS transfers as long as Comcast lets me.

This is slightly off-topic, but is there any reason to check the "metadata" box if I am not decrypting the files? I'm simply archiving them and then pulling them back to my Tivos with pyTivo.


----------



## moyekj (Jan 24, 2006)

gweempose said:


> This is slightly off-topic, but is there any reason to check the "metadata" box if I am not decrypting the files? I'm simply archiving them and then pulling them back to my Tivos with pyTivo.


 Nope. Note that if you care about captions, pulling back TiVo files in PS container kills them - a TiVo side bug present for years now...


----------



## alleybj (Dec 6, 2000)

So, every time I try to pull an encrypted transport stream file back to the Tivo with pyTivo, it works for a bit and then stops, with this message--An existing connection was forcibly closed by the remote host. This happens on every single file I try. Any thoughts on what's going on? thanks


----------



## moyekj (Jan 24, 2006)

alleybj said:


> So, every time I try to pull an encrypted transport stream file back to the Tivo with pyTivo, it works for a bit and then stops, with this message--An existing connection was forcibly closed by the remote host. This happens on every single file I try. Any thoughts on what's going on? thanks


 Do you have a recent wmcbrine pyTivo installation? If not that's what I would suspect 1st.


----------



## alleybj (Dec 6, 2000)

moyekj said:


> Do you have a recent wmcbrine pyTivo installation? If not that's what I would suspect 1st.


I'm not sure, but I think it's lucasnz. Should I reinstall with wmcbrine? Thanks


----------



## moyekj (Jan 24, 2006)

alleybj said:


> I'm not sure, but I think it's lucasnz. Should I reinstall with wmcbrine? Thanks


 Never used any other fork, but AFAIK wmcbrine fork is always the most recent/reliable.


----------



## alleybj (Dec 6, 2000)

moyekj said:


> Do you have a recent wmcbrine pyTivo installation? If not that's what I would suspect 1st.


Ok, I uninstalled pyTivo and reinstalled with a recent wmcbrine installation. Unfortunately, pyTivo will not transfer any unencrypted transport stream files back to the Tivo. They all start and then stop before the transfer completes. I've viewed the files, and I can't see any glitches that might be causing this, and it happens on every file I've tried. Any thoughts? Is there any other software out there that might transfer unencrypted transport stream files from computer to Tivo? Thanks very much!


----------



## moyekj (Jan 24, 2006)

alleybj said:


> Ok, I uninstalled pyTivo and reinstalled with a recent wmcbrine installation. Unfortunately, pyTivo will not transfer any unencrypted transport stream files back to the Tivo. They all start and then stop before the transfer completes. I've viewed the files, and I can't see any glitches that might be causing this, and it happens on every file I've tried. Any thoughts? Is there any other software out there that might transfer unencrypted transport stream files from computer to Tivo? Thanks very much!


 I know it works for sure, so it's likely a setup issue of some sort. Post your pyTivo.conf file settings here. Also, if you add debug=true in [server] section of pyTivo.conf and run pyTivo and attempt a transfer again it will give you a bunch of information in the console which would be useful to see. Without any log information my guess is the issue is related to ffmpeg not being properly configured/installed as part of pyTivo setup.


----------



## alleybj (Dec 6, 2000)

moyekj said:


> I know it works for sure, so it's likely a setup issue of some sort. Post your pyTivo.conf file settings here. Also, if you add debug=true in [server] section of pyTivo.conf and run pyTivo and attempt a transfer again it will give you a bunch of information in the console which would be useful to see. Without any log information my guess is the issue is related to ffmpeg not being properly configured/installed as part of pyTivo setup.


Thanks, Here's the pyTivo.conf file (with sensitive info redacted). ffmeg was installed prior to pyTivo as part of kttmg. Where do I find the console?

[Server]
tivo_password = redacted
debug = on
togo_path = m:\movies5
tivo_mak = **********
tivo_username = alleybj
ffmpeg = c:\users\alleybj\desktop\ffmpeg\ffmpeg.exe

[_tivo_SD]


----------



## moyekj (Jan 24, 2006)

You don't have ts=on in [server] section, which should be added and then pyTivo re-started.
ffmpeg setting looks reasonable, assuming there's actually an ffmpeg.exe there.
I don't see any video shares defined either (unless you just intentionally removed that section).

Console is the black background "cmd" window that appears when you run pyTivo.py. There should be a bunch of messages in that window telling you what pyTivo is doing.


----------



## gonzotek (Sep 24, 2004)

Just checking..isn't the tivo_username usually in the form of an email address?

e.g. it would be

```
tivo_username = [email protected]
```
..or something similar.


----------



## moyekj (Jan 24, 2006)

Yes, the tivo username is an email address normally. Perhaps it was modified/redacted by alleybj to not reveal the real one.


----------



## alleybj (Dec 6, 2000)

moyekj said:


> Yes, the tivo username is an email address normally. Perhaps it was modified/redacted by alleybj to not reveal the real one.


Do you mean what I used to login to my Tivo account? That's just alleybj

thanks


----------



## moyekj (Jan 24, 2006)

Anyway, the tivo_password and tivo_username are only important for pushes which is not relevant here at the moment.


----------



## alleybj (Dec 6, 2000)

moyekj said:


> You don't have ts=on in [server] section, which should be added and then pyTivo re-started.
> ffmpeg setting looks reasonable, assuming there's actually an ffmpeg.exe there.
> I don't see any video shares defined either (unless you just intentionally removed that section).
> 
> Console is the black background "cmd" window that appears when you run pyTivo.py. There should be a bunch of messages in that window telling you what pyTivo is doing.


For some reason the console isn't showing anything. I think it's because I have it running as a service now; if I click on the pyTivo run file, I get the console but it's for a second running version. How do I get the console for the one that runs on startup? I copied the log, which shows all of the errors, but Tivo Community says it has 144 images in it and won't let me send it. Any suggestions as to how to copy it or find the right console? thanks


----------



## moyekj (Jan 24, 2006)

Just make a zip file with the log and attach that to a post.


----------



## alleybj (Dec 6, 2000)

moyekj said:


> Just make a zip file with the log and attach that to a post.


Here it is in all its glory. Thanks!


----------



## moyekj (Jan 24, 2006)

I pulled out the most relevant lines that really matter. From what I can see pyTivo is behaving as expected but for some reason your Roamio Pro is rejecting the H.264 TS TiVo file (An existing connection was forcibly closed by the remote host):

YOURS

```
DEBUG:pyTivo.video.transcode:File=m:\movies5\The V.I.P.s.TiVo vCodec=h264 vWidth=1920 vHeight=1080 vFps=59.94 millisecs=8160920 TIVO_HEIGHT=1080 TIVO_WIDTH=1920
...
DEBUG:pyTivo.video.transcode:TRANSCODE=NO, all compatible, m:\movies5\The V.I.P.s.TiVo
INFO:pyTivo:10.0.1.39 [03/Feb/2016 19:09:11] "GET /Movies5/The%20V.I.P.s.TiVo?Format=video%2Fx-tivo-mpeg-ts HTTP/1.1" 200 -
INFO:pyTivo.video.video:[03/Feb/2016 19:09:11] Start sending "m:\movies5\The V.I.P.s.TiVo" to Roamio Pro
DEBUG:pyTivo.video.video:"m:\movies5\The V.I.P.s.TiVo" is tivo compatible
INFO:pyTivo.video.video:[Errno 10054] An existing connection was forcibly closed by the remote host
INFO:pyTivo.video.video:[Errno 10054] An existing connection was forcibly closed by the remote host
INFO:pyTivo.video.video:[03/Feb/2016 19:09:11] Done sending "m:\movies5\The V.I.P.s.TiVo" to Roamio Pro, 0 bytes, 0.00 Mb/s
```
As a comparison here's a pull of a sample H.264 TS TiVo file of mine using pyTivo. As you can see it's doing the exact same thing with a video of similar specs but the difference is my Roamio is accepting it fine:
MINE

```
DEBUG:pyTivo.video.transcode:File=c:\home\dvd\Overboard_h264_sample.TiVo vCodec=h264 vWidth=1920 vHeight=1080 vFps=59.94 millisecs=149280 TIVO_HEIGHT=1080 TIVO_WIDTH=1920
...
DEBUG:pyTivo.video.transcode:TRANSCODE=NO, all compatible, c:\home\dvd\Overboard_h264_sample.TiVo
INFO:pyTivo:192.168.1.91 [03/Feb/2016 18:36:14] "GET /videos/Overboard_h264_sample.TiVo?Format=video%2Fx-tivo-mpeg-ts HTTP/1.1" 200 -
INFO:pyTivo.video.video:[03/Feb/2016 18:36:14] Start sending "c:\home\dvd\Overboard_h264_sample.TiVo" to Roamio
DEBUG:pyTivo.video.video:"c:\home\dvd\Overboard_h264_sample.TiVo" is tivo compatible
INFO:pyTivo.video.video:[03/Feb/2016 18:36:48] Done sending "c:\home\dvd\Overboard_h264_sample.TiVo" to Roamio, 132156968 bytes, 29.28 Mb/s
```


----------



## alleybj (Dec 6, 2000)

moyekj said:


> I pulled out the most relevant lines that really matter. From what I can see pyTivo is behaving as expected but for some reason your Roamio Pro is rejecting the H.264 TS TiVo file (An existing connection was forcibly closed by the remote host):
> 
> YOURS
> 
> ...


thanks for looking at it; I wish I could figure it out, but as a result of your pointing out that I had the TS=on instruction in the wrong place, after fixing that, I'm getting much better transfer back of unencrypted transport stream files with pyTivo, so thanks again very much for that


----------



## moyekj (Jan 24, 2006)

2 things would be helpful for you to post:
1. Decrypt "The V.I.P.s.TiVo" and post the details of the video using mediainfo
2. Post pyTivo log showing push of the decrypted video above if decrypted push doesn't work.


----------



## andrew1883 (Apr 26, 2008)

> Nope. Note that if you care about captions, pulling back TiVo files in PS container kills them - a TiVo side bug present for years now...


Sorry if this is discussed elsewhere in detail, but I'm running into this problem. I'm using kmttg 2.1h to transfer from Premiere to my computer, then using the TiVo to pull the files from computer to Premiere when I'm ready to watch them. I'm using kmttg with whatever the default settings are (except file paths of course).

They're working fine (though the transfer to TiVo is way slower than I remember) but I'm losing the captions. Is there something I can do to get them? Would switching to TS in the kmttg config (for TiVo-computer) fix that? Or are the captions already gone one the files sitting on my computer? If they're not stripped until transfer back to the TiVo, is there something I can do to the files already transferred to PC?

Thanks!
=aw


----------



## moyekj (Jan 24, 2006)

andrew1883 said:


> They're working fine (though the transfer to TiVo is way slower than I remember) but I'm losing the captions. Is there something I can do to get them? Would switching to TS in the kmttg config (for TiVo-computer) fix that? Or are the captions already gone one the files sitting on my computer? If they're not stripped until transfer back to the TiVo, is there something I can do to the files already transferred to PC?


The captions are present in .TiVo file transferred from TiVo no matter which download method you use.
But due to a TiVo side bug you need to transfer back with pyTivo with ts=on setting in [server] section of pyTivo.conf. Basically the key is you have to transfer back in TS container to the TiVo for it to retain EIA captions.


----------



## andrew1883 (Apr 26, 2008)

Thank you, that's great. I think I used pyTivo a couple of years ago to push recordings from computer to TiVo, but ended up going back to pulling from the TiVo. It's just easier to use the TiVo to do it. I guess there's no chance TiVo will fix this, if it's such a long-term bug.

=aw

Sent from my XT1060 using Tapatalk


----------



## moyekj (Jan 24, 2006)

andrew1883 said:


> Thank you, that's great. I think I used pyTivo a couple of years ago to push recordings from computer to TiVo, but ended up going back to pulling from the TiVo. It's just easier to use the TiVo to do it. I guess there's no chance TiVo will fix this, if it's such a long-term bug.


 FYI, you can pull from the TiVo using pyTivo the exact same way you do with TiVo Desktop - it's using the exact same protocol except pyTivo supports way more video types and options.


----------



## andrew1883 (Apr 26, 2008)

I've been using kmttg to pull from TiVo, and the TiVo to pull from computer. I understand I can use pyTivo to push from computer (that's what I tried a couple of years ago) but I've never used pyTivo to pull from TiVo. Is that better than using kmttg?

It seems I'll have to install pyTivo anyway, in order to push captioned programs to the TiVo, so I could use it for pulling too (if it's better).

Thanks!
=aw


----------



## moyekj (Jan 24, 2006)

I think you misunderstood my post. By pyTivo "pull" I mean you can go to the bottom of "My Shows" on your TiVo and select a video share there showing files on your computer which you can then transfer (pull) to your TiVo (same as you can do with TiVo Desktop). One main advantage is pyTivo can transfer pretty much any video where TiVo Desktop is limited. With pyTivo you can of course "push" a video from your computer to a TiVo as well, push meaning you start the process on computer side instead of a pull which starts process on TiVo side.


----------



## andrew1883 (Apr 26, 2008)

Thanks, I think I've got the concept now. I downloaded pyTivo and added my MAK, path to ffmpeg.exe, ts=on (a setting that isn't in .conf.dist?).

And now I'm seeing my TiVo (and my share). But when I try to access the TiVo, I get the error below. I've turned off Windows Firewall in case it's that, but I still got the error. MAK is correct (copied from kmttg config).



> Unable to Connect to TiVo
> 
> pyTivo was unable to connect to the TiVo at 192.168.1.109.
> 
> This is most likely caused by an incorrect Media Access Key. Please return to the Settings page and double check your tivo_mak setting.


Is there something else I need to do? Once I get it working with WF turned off, I'll turn it back on and troubleshoot that if necessary.

[added: I worked through Troubleshooting and have this so far:


```
[ code ] block removed due to Tapatalk display issue.
```
Does any of this make sense?

Thanks!
=aw


----------



## wmcbrine (Aug 2, 2003)

Interesting. I never saw that before... could be a problem exposed by Python 2.7.11? Anyway, I've committed a tentative fix; please let me know if it helps.


----------



## andrew1883 (Apr 26, 2008)

Thank you, now I can get a list of recordings on the TiVo and it doesn't complain when I try to push something from the PC to the TiVo. Is there any sort of progress meter for that on the PC side?

I was also able to pull a show from the PC onto the TiVo.  I didn't get the captions though. I have "ts = on" under [Server], is that really all there is to it?

Also, all the instructions mention putting the path to ffmpeg into the .conf file but I notice the instructions say it will look first in c:\pytivo\bin\ for all the various files. Is ffmpeg special in that it needs to be explicit even in this case?

Finally, when I browse the share while on the TiVo, "groups" don't work so I'm scrolling through dozens of listings to get where I want. When I'm using TiVo Desktop to serve the files, the grouping does work. Is this normal?

Thanks again, and I'm looking forward to doing more with this!

=aw


----------



## wmcbrine (Aug 2, 2003)

andrew1883 said:


> Thank you, now I can get a list of recordings on the TiVo and it doesn't complain when I try to push something from the PC to the TiVo. Is there any sort of progress meter for that on the PC side?


Nope, sorry. It's on the ToDo list. 



> _I was also able to pull a show from the PC onto the TiVo.  I didn't get the captions though. I have "ts = on" under [Server], is that really all there is to it?_


Eh, I'd have to know more about the source file.



> _Also, all the instructions mention putting the path to ffmpeg into the .conf file but I notice the instructions say it will look first in c:\pytivo\bin\ for all the various files. Is ffmpeg special in that it needs to be explicit even in this case?_


Not at all.



> _Finally, when I browse the share while on the TiVo, "groups" don't work so I'm scrolling through dozens of listings to get where I want. When I'm using TiVo Desktop to serve the files, the grouping does work. Is this normal?_


I'm surprised you're seeing a difference with TD. However, you should be able to toggle grouping on and off by pressing "2". As to whether it's normal, see here.


----------



## andrew1883 (Apr 26, 2008)

moyekj said:


> The captions are present in .TiVo file transferred from TiVo no matter which download method you use.
> But due to a TiVo side bug you need to transfer back with pyTivo with ts=on setting in [server] section of pyTivo.conf. Basically the key is you have to transfer back in TS container to the TiVo for it to retain EIA captions.


I think I got pyTiVo working (though not the grouping) but I'm still not seeing captions on the recordings transferred to the TiVo with ts=on.

That said, when I use Windows Media Player to play a .tivo file when it's first transferred from TiVo to PC using kmttg, it doesn't show captions on the PC either! I've got WMP set for "Lyrics, Captions, and Subtitles" > "On when available". They're definitely on, these are TNT's repeats of Castle and the non-transferred recording has captions on the TiVo.

Is there some setting in kmttg for this? Something really stupid that no one would ever turn off? I read all the help wiki and couldn't find anything (the "captions" checkbox seems to be for something else. I don't actually have any of the top-row checkboxes checked.

Please tell me there's some setting I missed! 

[added: I'm also trying transferring a show with TiVo Desktop, it's only about 8min in but there are no captions on the PC either]

Thanks!
=aw


----------



## moyekj (Jan 24, 2006)

andrew1883, run mediainfo on the TiVo file and look for "Text" sections to confirm if there are captions present or not.


----------



## andrew1883 (Apr 26, 2008)

Thanks, I downloaded Mediainfo and ran it against one of the Castle videos (transferred with kmttg). I can't find any documentation on Mediainfo so I'm pasting the whole text report here. At first I just quoted the Text blocks but it's not that much and the window scrolls.  I googled and EIA-608 is related to subtitles/captions, which are present when I play the source file on my TiVo (Premiere) but not seen in WMP and not on the TiVo when I transfer back with pyTiVo.


```
[ code ] block removed due to Tapatalk display issue.
```
Thanks again!
=aw


----------



## moyekj (Jan 24, 2006)

Certainly looks like you DO have captions. You can play the decrypted TiVo file (enable "decrypt" task in kmttg to generate .mpg or .ts file) with VideoLAN VLC and turn on captions display there to see them. WMP is a lousy player and I wouldn't use it as basis for concluding there are no captions.


----------



## ClearToLand (Jul 10, 2001)

andrew1883 said:


> ...Finally, *when I browse the share while on the TiVo, "groups" don't work so I'm scrolling through dozens of listings to get where I want*. When I'm using TiVo Desktop to serve the files, the grouping does work. Is this normal?


See if the LINKs / info I posted here help:

*Creating Groups / Folders with kmttg / pyTivo*​


----------



## andrew1883 (Apr 26, 2008)

> with VideoLAN VLC and turn on captions display there to see them.


Thanks. I decrypted the .TiVo and found subtitles on my notebook with VLC. Interestingly, there were subtitles on "captions 1" but not on 2, 3, or 4 (VLC offers four choices). Yet the mediainfo seems to imply (to me anyway) captions on 1 and 3?

So now I have to figure out why there are no captions when the file is transferred back to the TiVo. I have ts=on in my pyTivo settings, is that all it takes?

*ClearToLand*, thanks for the suggestion. I do play to chase that down but first want to get captions working.

=aw


----------



## moyekj (Jan 24, 2006)

andrew1883 said:


> Thanks. I decrypted the .TiVo and found subtitles on my notebook with VLC. Interestingly, there were subtitles on "captions 1" but not on 2, 3, or 4 (VLC offers four choices). Yet the mediainfo seems to imply (to me anyway) captions on 1 and 3?
> 
> So now I have to figure out why there are no captions when the file is transferred back to the TiVo. I have ts=on in my pyTivo settings, is that all it takes?
> 
> ...


 Yes pyTivo transfer with ts=on should work when transferring back.
Enable debug info in pyTivo.conf by adding the following in the server section (same section where you should have ts = on):
debug = on
Then run pyTivo and post the log info generated.


----------



## andrew1883 (Apr 26, 2008)

Okay thanks. I did that (pushed the .mpg from the PC) and now I have three things to report. First, I couldn't find a log file. Looking around the pyTiVo wiki/discussions, it seemed there should be a file debug.log which has to be set up but Windows installer does automatically? I couldn't find one, so I've copy/pasted the cmdtool output that I saw.

Second, there's no metadata (just the filename, no episode info, recording info, etc.). I recall this happening when I first tried pyTiVo a couple of years ago, I thought it made sense to decrypt the TiVo recordings so I could watch them on different devices not just my TiVo. Is it possible to keep it?

Third, no captions. I assume this happened when I tried to do this before, but back then my TV was a 24" CRT and didn't have the ability to display captions.

C:\pytivo\pyTivo.conf:


```
[ code ] block removed due to Tapatalk display issue.
```
Here's the content of the cmd window, if this isn't it I can try again.


```
[ code ] block removed due to Tapatalk display issue.
```
Thanks again!


----------



## moyekj (Jan 24, 2006)

There's no evidence it tried to use TS container anywhere in that log file. I think your issue is perhaps you are not using the "wmcbrine" fork of pyTivo which is the one you have to use for the ts=on setting to work.
https://github.com/wmcbrine/pytivo/archive/master.zip

For metadata you have to generate an accompaying metadata file to go with the .mpg file - various tools can do that including kmttg.

If you want to log console messages to a file you have to redirect stderr to a file. From console to dreict messages to out.txt file:
pyTivo.py 2> out.txt


----------



## andrew1883 (Apr 26, 2008)

Thanks, I think I get the metadata thing now (will test it again).

But I'm sure I took the wmcbrine fork, is there an easy way to tell? My zip file is "pytivo-master_wmcbrine-2016-02-27.zip" but I probably renamed something else. Though it behaved differently after wmcbrine posted a patch on Feb 27 (see upthread I think).

Last line of the README says,


```
---Notes
pyTivo was created by Jason Michalski ("armooo"). Contributors include 
Kevin R. Keegan, William McBrine, and Terry Mound ("wgw").
```
The only other thing I can think of is that I'm running from the wrong place, but I went as much "follow the instructions" as I could (installed in C:\pytivo etc.).

Before I re-download and start over, is there anything else I should/could be checking?

Thanks!
=aw


----------



## moyekj (Jan 24, 2006)

Don't do a push. Initiate a transfer from the TiVo (pull). As an example here's what I get when I pull a small .mpg file with ts=on. You will notice the x-tivo-mpeg-ts option being used for the GET, and also note the "-f mpegts" option at end of ffmpeg command indicating it's remuxing to TS container during the transfer:
(Also notice the message: TRANSCODE=YES, container mpeg not compatible)

```
INFO:pyTivo:192.168.1.91 [16/Mar/2016 21:28:14] "GET /TiVoConnect?Command=QueryFormats&SourceFormat=video%2Fx-tivo-mpeg-ts HTTP/1.1" 200 -
DEBUG:pyTivo.video.transcode:CACHE HIT! c:\home\dvd\iron_man_short.mpg
DEBUG:pyTivo.video.transcode:TRANSCODE=YES, container mpeg not compatible, c:\home\dvd\iron_man_short.mpg
INFO:pyTivo:192.168.1.91 [16/Mar/2016 21:28:33] "GET /videos/iron_man_short.mpg?Format=video%2Fx-tivo-mpeg-ts HTTP/1.1" 206 -
INFO:pyTivo.video.video:[16/Mar/2016 21:28:33] Start sending "c:\home\dvd\iron_man_short.mpg" to Roamio
DEBUG:pyTivo.video.video:"c:\home\dvd\iron_man_short.mpg" is not tivo compatible
DEBUG:pyTivo.video.transcode:CACHE HIT! c:\home\dvd\iron_man_short.mpg
DEBUG:pyTivo.video.transcode:tsn: 840000xxxxxxxx
DEBUG:pyTivo.video.transcode:aspect169: True
DEBUG:pyTivo.video.transcode:optres: False
DEBUG:pyTivo.video.transcode:File=c:\home\dvd\iron_man_short.mpg vCodec=mpeg2video vWidth=720 vHeight=480 vFps=59.94 millisecs=60180 TIVO_HEIGHT=1080 TIVO_WIDTH=1920
DEBUG:pyTivo.video.transcode:CACHE HIT! c:\home\dvd\iron_man_short.mpg
DEBUG:pyTivo.video.transcode:audio_lang: None
DEBUG:pyTivo.video.transcode:set first detected audio stream by default: 0:1
DEBUG:pyTivo.video.transcode:selected audio stream: 0:1
DEBUG:pyTivo.video.transcode:transcoding to tivo model 840 using ffmpeg command:
DEBUG:pyTivo.video.transcode:c:\home\kmttg java testing\ffmpeg\ffmpeg.exe -i c:\home\dvd\iron_man_short.mpg -vcodec copy -b 4307k -maxrate 30000k -bufsize 4096k -ab 448k -ar 48000 -acodec copy -map 0:0 -map 0:1 -f mpegts -
ffmpeg version N-79000-g66edd86 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 28.100 / 57. 28.100
  libavformat    57. 28.100 / 57. 28.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 39.102 /  6. 39.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mpeg, from 'c:\home\dvd\iron_man_short.mpg':
  Duration: 00:01:00.18, start: 0.233367, bitrate: 4755 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m), 720x480 [SAR 32:27 DAR 16:9], Closed Captions, max. 9800 kb/s, 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
Please use -b:a or -b:v, -b is ambiguous
Output #0, mpegts, to 'pipe:':
  Metadata:
    encoder         : Lavf57.28.100
    Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 32:27 DAR 16:9], q=2-31, max. 9800 kb/s, 29.97 fps, 59.94 tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), 448 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  137 fps=0.0 q=-1.0 size=    3579kB time=00:00:05.62 bitrate=5215.3kbits/s speed=10.2x    
frame=  302 fps=277 q=-1.0 size=    7712kB time=00:00:12.51 bitrate=5048.9kbits/s speed=11.5x    
frame=  428 fps=259 q=-1.0 size=   10772kB time=00:00:17.76 bitrate=4966.4kbits/s speed=10.8x    
frame=  551 fps=256 q=-1.0 size=   13856kB time=00:00:22.88 bitrate=4958.8kbits/s speed=10.6x    
frame=  654 fps=246 q=-1.0 size=   16536kB time=00:00:27.19 bitrate=4981.5kbits/s speed=10.2x    
frame=  770 fps=238 q=-1.0 size=   19517kB time=00:00:32.03 bitrate=4991.3kbits/s speed=9.92x    
frame=  893 fps=236 q=-1.0 size=   22534kB time=00:00:37.15 bitrate=4968.6kbits/s speed=9.83x    
frame= 1009 fps=232 q=-1.0 size=   25643kB time=00:00:42.03 bitrate=4997.6kbits/s speed=9.66x    
[mpegts @ 058f22c0] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
frame= 1115 fps=228 q=-1.0 size=   28727kB time=00:00:46.44 bitrate=5066.4kbits/s speed= 9.5x    
frame= 1229 fps=217 q=-1.0 size=   31770kB time=00:00:51.16 bitrate=5086.3kbits/s speed=9.04x    
frame= 1309 fps=212 q=-1.0 size=   33871kB time=00:00:54.54 bitrate=5087.1kbits/s speed=8.83x    
frame= 1426 fps=212 q=-1.0 size=   36882kB time=00:00:59.39 bitrate=5087.1kbits/s speed=8.84x    
frame= 1443 fps=215 q=-1.0 Lsize=   37342kB time=00:01:00.17 bitrate=5083.4kbits/s speed=8.95x    
video:31087kB audio:3290kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.624413%
INFO:pyTivo.video.video:[16/Mar/2016 21:28:40] Done sending "c:\home\dvd\iron_man_short.mpg" to Roamio, 38238448 bytes, 42.29 Mb/s
```


----------



## andrew1883 (Apr 26, 2008)

I'm sorry this is a mess. I haven't figured out how to set up pyTivo to write a log file, and what I could find says Windows install should have done it automatically. I did create a new share "testing" under the regular folder because it seemed like scrolling down to Castle was generating entries in the python window. Here's the updated c:\pytivo\pytivo.conf


```
[ code ] block removed due to Tapatalk display issue.
```
Log is below. I don't see the "x-tivo-mpeg-ts option being used for the GET" you pointed out in your log, though I do see x-tivo-mpeg which is presumably the cause of the problem. Is there any chance it's an issue with a newer version of some software? I think upthread (actually post #34) a patch was needed due to Python 2.7.11 ?

Maybe I'm doing something wrong (almost certainly). I launch this by going to C:\pytivo and double-clicking on pytivo.py then I can do whatever I want. Am I missing something there?

This is a transfer initiated at the TiVo, of an 11min Castle episode in .TiVo format. It should be an hour but for some reason the kmttg transfer to PC stopped at 11min. That happens from time and time, I don't know why and I have added it to my list of mysteries to solve after the CCs.  If that would be causing trouble, I can transfer a full hour's program.


```
[ code ] block removed due to Tapatalk display issue.
```


----------



## moyekj (Jan 24, 2006)

You should probably post in pyTivo thread to ask why ts=on setting is not affecting anything for you.


----------



## andrew1883 (Apr 26, 2008)

Okay thanks. And thanks for your help narrowing this down.

=aw


----------



## wmcbrine (Aug 2, 2003)

moyekj said:


> You should probably post in pyTivo thread to ask why ts=on setting is not affecting anything for you.


Because it's a .TiVo file. They're passed through in whatever form they already have. If he wants to avoid that, he needs to decrypt it beforehand. (And in the previous case, where he was pushing it -- transport streams can't be pushed. So ts=on only applies to pulls.)


----------



## andrew1883 (Apr 26, 2008)

Okay thanks. I'll try it with a decrypted file. And take the opportunity to troubleshoot the metadata function while I'm at it.

Sent from my XT1060 using Tapatalk


----------



## andrew1883 (Apr 26, 2008)

It worked! 

I took the 11min truncated episode on my notebook, ran it through kmttg with Metadata and Decrypt selected, moved it to the test pyTivo folder, and pulled it PC-TiVo. Result has both metadata and captions! ISTM I may well want to convert _every_ .TiVo to .mpg and .mpg.txt (metadata), not just because it gives more flexibility on playback, but also because it's necessary to keep the captions. Is that right? Any reason to retain them as .TiVo files?

I also went back to my posts in this thread and deleted all the [ code ] blocks. They don't actually contribute to the discussion at this point, and I discovered Tapatalk doesn't display them as scrolling windows, just as a very long block of useless text.

Now I just have to figure out how to get the shows grouped while I browse (thanks for the links, I read them but didn't try to troubleshoot) and why shows sometimes get cut off early in the TiVo-PC transfer. Is there a thread on the latter already going?

Thank you again everyone (and especially moyekj and wmcbrine) for all your help with this (and patience with me).

=aw


----------



## wmcbrine (Aug 2, 2003)

andrew1883 said:


> Any reason to retain them as .TiVo files?


Well, the metadata is included, instead of in a separate file... I can't think of any other reasons. The decrypted files transfer faster, too.



> _Now I just have to figure out how to get the shows grouped while I browse_


Press "2".


----------

