woops forgot to copy it in when I upgraded to 173. I've fixed that and it's no longer got those errors. I added those two lines of code to the transcode.py file within that one function and it never prints anything to the terminal. I don't think it's calling ffmpeg properly at all as a previous poster suggested... most likely just a mac thing. ffmpeg never runs as I could see it in the activity viewer and no videos are in the folder (but on a positive note the server shows up on the NPL with no videos). These files are valid video files most I ripped with handbrake as mp4 files and I know ffmpeg can handle them ok since they work with Tivo.Net.

updated to python 2.5 since it updated the way subprocess worked and it does now call ffmpeg upon starting the script... no videos still though.

moved that print output around and I can tell that ffmpeg works and it does go through the files but they do not show in the container file...

A simple experiment to see if it might be a problem with Build 8047 of ffmpeg:

Replace ffmpeg_mp2.exe with the version used in TiVo.Net (build 7215). The link you need to download this is given in this prior post (if you don't already have it via Tivo.Net). The download will be a zip and the only file you need from it is ffmpeg.exe. Either rename it to ffmpeg_mp2.exe (rename the existing ffmpeg_mp2.exe first to save it) or change your pyTivo.conf ffmpeg path.

Okay tried build 7215 from that link - same problem with the video being offset on the TiVo. Anything else I can try?

woops forgot to copy it in when I upgraded to 173. I've fixed that and it's no longer got those errors. I added those two lines of code to the transcode.py file within that one function and it never prints anything to the terminal. I don't think it's calling ffmpeg properly at all as a previous poster suggested... most likely just a mac thing. ffmpeg never runs as I could see it in the activity viewer and no videos are in the folder (but on a positive note the server shows up on the NPL with no videos). These files are valid video files most I ripped with handbrake as mp4 files and I know ffmpeg can handle them ok since they work with Tivo.Net.

updated to python 2.5 since it updated the way subprocess worked and it does now call ffmpeg upon starting the script... no videos still though.

moved that print output around and I can tell that ffmpeg works and it does go through the files but they do not show in the container file...

what could be going on?

Your ffmpeg output is different that what I have seen from other versions. The current code is expecting the fps to come after "Video:" so it can't find the fps and says it is not a supported type.

__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

A python real time video transcoding server for TiVo.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

That will transcode 60 seconds into a file named test.mpg. Try and play this file on a pc and tell me what happens. Additionally you should be able to play this file, test.mpg, from the TiVo too. But first I want to see what it looks like on the pc.

Thanks
Kevin

__________________To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

A much better place to receive pyTivo help and updates.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

more recent builds do put the FPS after Video: sort of...
That build is from 2006 .....
will that work? or does it have to directly follow Video:?

It doesn't have to directly follow "Video", just come later in the line.

I suspect the problem is worse than that though if you didn't get anything from the print statement in video_info as follows:

Code:

output = ffmpeg.stderr.read()
print output

This should print whatever ffmpeg prints regardless of how formatted. If you got nothing it must mean one of these things:
1. ffmpeg was never called.
2. ffmpeg was called but its printout wasn't piped into stderr
3. ffmpeg was called and timed out (4 secs per call)

__________________
"It must be swell to be so perfect and odor-free" -- Del Griffith

VideoReDo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

pyTivo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. and To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

I downloaded and installed pytivo yesterday (latest version, Windows installer). I think it's fabulous(!), but I did have one issue.

My TV is 4:3, and my preferences on the Tivo are set to 4:3. I transferred an AVI file with the following specs:
Bit rate: 1151kbps
Format: mpeg4
Size: 512x288
Frame rate: 25.00fps

When viewing the file on the Tivo, the image is distorted. Switching the Tivo to 16:9 mode in preferences fixes the image, except that it's a little horizontally squished because the whole 16:9 image is displayed in the 4:3 space.

This is not a huge deal, but is there any way to tell pytivo to letterbox anything in 16:9? I'm using the version of ffmpeg distributed with the installer.

I downloaded and installed pytivo yesterday (latest version, Windows installer). I think it's fabulous(!), but I did have one issue.

My TV is 4:3, and my preferences on the Tivo are set to 4:3. I transferred an AVI file with the following specs:
Bit rate: 1151kbps
Format: mpeg4
Size: 512x288
Frame rate: 25.00fps

When viewing the file on the Tivo, the image is distorted. ......!

As I understand it (those are weasel words so you can't blame me if I'm wrong) some mpeg4 formats (e.g., Xvid, frequently found in an AVI container) have an aspect ratio specifier in the file and this may need to be changed to 4:3.

Try mpeg4modifier, a little (30kB) free program that can do things like change the aspect ratio. It will be quick -- you are not re-encoding the file.

I've experienced this encoding to AVI/XVID using AutoMKV but I didn't use mpeg4modifier to fix it. I just re-encoded using the feature in AutoMKV that allows you to specify the Xvid AR you want. Another handy small free program is mediaInfo. With it installed you can right click on a video and it will tell you the properties, including the AR in an Xvid video.

__________________
"It must be swell to be so perfect and odor-free" -- Del Griffith

VideoReDo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

pyTivo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. and To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

That will transcode 60 seconds into a file named test.mpg. Try and play this file on a pc and tell me what happens. Additionally you should be able to play this file, test.mpg, from the TiVo too. But first I want to see what it looks like on the pc.

Okay, both versions of ffmpeg convert that into a 16:9 aspect ratio file that plays fine on the PC.

Sabu,Are you playing to a 4:3 or 16:9 TV?
The reason I ask is that I too have come across an XVID that does exactly what yours is doing on a 4:3 TV , but works fine going to my 16:9 TV.

hmm it should still play fine on a 4:3 tv.

I made a new update. There is a minor fix to an error in the code i doubt it was causing your problem.

More importantly I added a debug feature. This will write a file in the base directory called debug.txt. I would not leave this on as it slows down pyTivo a lot and will make a huge file in on your drive.

To Activate debuging in version 174 and up:
Add the following line under the [Server] Block
debug=True

To deactivate debugging:
Delete that ENTIRE LINE

Sorry there is a mistake in my programming and if the option debug exists it will debug, so to stop it you must remove the line completely. Future versions will fix this.

Please review my prior post about handling 59.94 fps reported by ffmpeg for tivo compatible mpegs. The patch that is still in transcode.py in ver. 174 has two problems:

1. It doesn't work for the currently used build of ffmpeg (8047).
2. I don't believe it will work even for the build it was targeted at (7215) because the regular expression will not match 29.97. Am I wrong here?

Anyway, I would suggest at least removing or fixing the current patch, and why not use the patch I gave in the post, which covers both builds? I've been using it and it works fine. There are four VideoReDo-edited files in my archive that are allowed to transfer without re-encoding with this patch.

__________________
"It must be swell to be so perfect and odor-free" -- Del Griffith

VideoReDo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

pyTivo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. and To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Please review my prior post about handling 59.94 fps reported by ffmpeg for tivo compatible mpegs. The patch that is still in transcode.py in ver. 174 has two problems:

1. It doesn't work for the currently used build of ffmpeg (8047).
2. I don't believe it will work even for the build it was targeted at (7215) because the regular expression will not match 29.97. Am I wrong here?

Anyway, I would suggest at least removing or fixing the current patch, and why not use the patch I gave in the post, which covers both builds? I've been using it and it works fine. There are four VideoReDo-edited files in my archive that are allowed to transfer without re-encoding with this patch.

Whoa, easy there. Sorry I thought this problem had already been solved, no need to get upset.

Couple of small suggested edits to your first post to make life easier for newcomers:

1. Make it clear there is a Wiki (I know the link is there but there is nothing to indicate it is a Wiki link.)

2. Correct the typo in: "type = vidwo"

Thanks

__________________
"It must be swell to be so perfect and odor-free" -- Del Griffith

VideoReDo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

pyTivo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. and To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

I just added an item to the "Known Issues" section of the Wiki describing a NPL problem and a work-around. If this is happening to other TiVo models, the wording could be made more general. Or maybe other/better work-arounds could be added/substituted.

Anyway, take a look and have at it!

__________________
"It must be swell to be so perfect and odor-free" -- Del Griffith

VideoReDo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

pyTivo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. and To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Ahhh, there are times I love microsoft. Ok I am attempting to figure out the video display problems some people are still seeing. I found a bunch of test files of different aspect ratios from Microsoft.

I have the display problem where the screen gets whacked like every other scanline is shifted and the picture ends up in 3 interlaced sections. Very strange looking.

I solved the problem on my Series-2 540 by changing from 720x480 to 544x480.

I also tried the newest ffmpeg I could find, r8310, but it still was screwing up. Only switching to 544 fixed it for me. I've had this problem in the past using Videora and VLC, so maybe it is a bug or hardware problem in some of the Series 2s.

Thanks for all the work on pyTivo, I like how clever yet simple it is! The code is a great intro to Python for me. I've been making some minor source code tweaks and I'd like to donate them to the cause.

...I solved the problem on my Series-2 540 by changing from 720x480 to 544x480.I also tried the newest ffmpeg I could find, r8310, but it still was screwing up. Only switching to 544 fixed it for me. I've had this problem in the past using Videora and VLC, so maybe it is a bug or hardware problem in some of the Series 2s.

Yeah I am starting to think there may be some minor differences out there with TiVo's.

Sabu I think this is where your problem is. I relooked over the code for 16:9 videos and how it functions. pyTivo is sending a 16:9 video to your TiVo even though your TiVo can only support 4:3. For the rest of us the TiVo just fixes this. A good way to test this out is change your TiVo settings to 16:9, all 16:9 videos that have been transfered will now be stretched vertically. But 4:3 videos will still look fine.

Sabu, I think the problem is possibly that your version of TiVo doesn't handle 16:9 gracefully like most of us. Don't worry though. I think pipakin solved this by allowing users to preselect their aspect ratios. I am working on recoding transcode.py to send files only in their preselected format. I am hoping this will solve your problems.

Quote:

Originally Posted by inthewoods

Where do I post patches?-Tony

You can post them here. And thanks for your help.

Kevin

__________________To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

A much better place to receive pyTivo help and updates.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Upon setting the Tivo to 16:9 but leaving the TV in 4:3 I do see the expected results of tall and skinny, but all is there.

Cool, i think that means I am on the right track. I almost have a dramtically changed transcode.py file ready for anyone having aspect issues to try.

Quote:

Originally Posted by CheezWiz

The question I have is, can pyTivo determine which of my two Tivos is requesting the file and select aspect ratio appropriately? Or does the requester never ID itself to pyTivo?

F, hmm, I had not thought of this issue. Umm no in its first iteration the setting will be the same as TivodotNet, which is a global setting of 16:9 or 4:3. The TiVo does identify itself when it requests files, but this will require two additional mods, 1. Add code to pull the TSN from the request, 2. Add code to the conf file to allow you to choose which TiVo gets what.

Quote:

Originally Posted by CheezWiz

Also, is all this protocol documented somewhere or have you guys just figured it out through trial and error? ps, thanks to everyone involved with this!

Umm like much of the TiVo development a lot of it comes from looking at TiVo's software and reverse engineering it. Armooo did 99% of the hard work and started this thing. I think he just watched packets from TiVo Desktop. I can say that when I had to solve the transfer error problem I had to purchase TiVo Desktop 2.4 and do some packet sniffing while it was running to solve the issue.

So the answer is no, not to my knowledge. TiVo has not released an SDK since the HMO/HME days and has not expanded either of those since then. I know a few developers, namely the developer for galleon, have been quite upset about this.

__________________To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

A much better place to receive pyTivo help and updates.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

- I made some major changes to how select_aspect() works. Unless you specify in the conf file that you want to allow 16:9 aspect ratio all files will be sent to TiVo in the 4:3 format. Additionally the code for padding of videos has been updated to be more accurate. A circle should indeed be a circle on the TV now. And Sabu I hope this fixes your issue.

Hmm, my brain is dead and I can't figure this out right now. When I pad the left and right, do I need to pad with distorted pixels?? Can someone play a video which is skinnier than 4:3 and tell me if it looks distorted at all on TV. We might only need to pad with true pixels on left and right.

- A new conf file has been provided, but to allow 16:9 files set the following option in the conf file:
aspect169=true

Even if you allow 16:9 videos files which are 4:3 or lower aspect(very skinny) will still be sent in 4:3 format and your TV can handle them however you normally handle 4:3 broadcast images.

- The debug code had been simplified. To create a debug.txt file in the base directory of what transcode.py is doing set the following option in the conf file:
debug=true

Leave it set to off(debug=false, or delete the line) unless you want to slow pyTivo down and create a wasted file in your base directory.

- I also added dlfl's code for the fps issue he was having.

Later Updates:Cheezwiz Sorry buddy the aspect setting is global, I will work on a per TiVo setting later.

__________________To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

A much better place to receive pyTivo help and updates.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

............Hmm, my brain is dead and I can't figure this out right now. When I pad the left and right, do I need to pad with distorted pixels?? Can someone play a video which is skinnier than 4:3 and tell me if it looks distorted at all on TV. We might only need to pad with true pixels on left and right.

Results of an experiment (not sure what you will make of it):

I used a tivo-compatible mpeg2 file (a tivo file edited by VideoReDo and saved as mpeg2). It has 480x480 (encoding) resolution.

I changed tivo_compatable() so if would return False for this file, i.e., forcing a re-encode, and looked at the ffmpeg command line for that transcode.

I'm 4:3 all the way (tivo settings, TV and aspect169 = false).

The encoding -s option was 540x480 and left and right pads were both 90, bringing it to 720x480. The -aspect option was 4:3. (The 540 obviously is the 9/8 ratio times 480.)

The TV picture was squeezed horizontally and had black bands left and right.

Obviously some pixel distortion (PAR not 1:1) is needed. However, if tivo is sent the original (not-transcoded) 480x480 mpeg it will do the scale up to 4:3 aspect for display.

My guess is (at least for this case) the -s should be 720x480 and left and right pads should be 0. I think this is what you call padding "with distorted pixels" (?)

As I see it, the basic problem is ffmpeg doesn't give enough information. It gives you the encoded dimensions but not the frame (or display) dimensions intended for the video. (Or equivalently, it doesn't give you the PAR.) Even worse, this information is probably not even available in some video file formats (?). You have to assume target display dimensions based on 4:3 or 16:9. For 4:3, it seems unlikely (but not impossible) that the intended display AR would be less that 4:3 --- which seems to imply you should pad with distorted pixels for those cases -- but then ..... yep, it's annoying!.

Quote:

Originally Posted by KRKeegan

- I also added dlfl's code for the fps issue he was having.

Thanks. I'm assuming (hoping?) this will help OP too.

__________________
"It must be swell to be so perfect and odor-free" -- Del Griffith

VideoReDo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

pyTivo users: Try To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. and To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Obviously some pixel distortion (PAR not 1:1) is needed. However, if tivo is sent the original (not-transcoded) 480x480 mpeg it will do the scale up to 4:3 aspect for display.

My guess is (at least for this case) the -s should be 720x480 and left and right pads should be 0. I think this is what you call padding "with distorted pixels" (?)

Exactly, I am hoping that Armooo, list of possible PAR ratios will catch files that have non 1:1 PAR.

But yes ffmpeg does not return enough information for me to know what the PAR is. I think for most computer files a PAR of 1:1 will work, AVIs i think are pretty much always in 1:1. The problem is going to come in with MPGs, some of them as dlfl demonstrated have nonsquare pixels.

__________________To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

A much better place to receive pyTivo help and updates.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Yes, the 16:9 ratio file now transfers and plays with the content centered!

One alternative option for how to specify the 16:9 setting would be on a share by share basis instead of a TiVo by TiVo basis. That way it would be easy to try the variations of the flag going forward as new versions of the TiVo software are released. Just a thought.