TiVo Community
TiVo Community
TiVo Community
Go Back   TiVo Community > Main TiVo Forums > TiVo Home Media Features & TiVoToGo
TiVo Community
Reply
Forum Jump
 
Thread Tools
Old 03-02-2007, 10:50 PM   #61
KRKeegan
Im lost and confused
 
KRKeegan's Avatar
 
Join Date: Jul 2004
Location: Los Angeles, CA
Posts: 215
Quote:
Originally Posted by windracer
took a long time for the NPL to populate.
Yeah pyTivo checks for ffmpeg compatibility the first time it opens a folder, it is then cached so it should be fast. TiVo.Net checks for compatibility when it loads. I can't decide what is preferable.
__________________

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.

A python real time video transcoding server for TiVo.
KRKeegan is offline   Reply With Quote
Old 03-03-2007, 12:43 AM   #62
armooo
pyTivo Developer
 
Join Date: Feb 2003
Posts: 79
Quote:
Originally Posted by ocntscha
So do I really need python 2.4 for this?
You are going to need python 2.4. I am using the subprocess module which was introduced in 2.4.
armooo is offline   Reply With Quote
Old 03-03-2007, 01:25 AM   #63
armooo
pyTivo Developer
 
Join Date: Feb 2003
Posts: 79
I prefer the scanning the first time a folder is opened for a few a few reasons.

1) Ever time you start your computer do you want to to scan all your files?

2) Do you want to keep the status of every file in memory? Right now it will only keep the 100 most recently seen.

3) Finding an item in the tivo menu gets painful when there are more the 40 items. I just opened a folder with 60 videos and it took about 5 sec. And I sort my videos in to folders and sub folder so I never have more than 22 in a folder.
armooo is offline   Reply With Quote
Old 03-03-2007, 09:06 AM   #64
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,844
Hmmm..... Doesn't seem to work

Using Windows XP SP2. Tivo.Net and Desktop and goback all work fine on this machine. Downloaded and installed Python 2.5 and pyTivo Ver. 165. No pyTivo ("video" ??) shows up on the NPL.

Here is my .conf file:

[Server]
port=9032
ffmpeg=C:\Program Files\pyTivo\plugins\video\ffmpeg_mp2.exe

[<Name of Share>]
type=video
path=C:\Video\pyTivoVideos

I don't use Windows firewall. I have a hub but it isn't keeping tivo.net from running. I get the "Cheetah" warning at startup but that's not supposed to be a problem per prior posts.

Is the desktop TiVo server supposed to be running or not?

Any ideas, please ?

EDIT:
Realized I needed to put a name in instead of <Name of Share> and that got it working to the point of showing up on the NPL.

However the first two files I tried to transfer failed with ffmpeg errors. Here is an example of pyTivo response for one of them:

192.168.0.153 - - [03/Mar/2007 10:17:54] "GET /pyTivoShare/CleeseMartinOutTowner
s.mp4 HTTP/1.1" 200 -
ffmpeg version 0.4.9-pre1, build 4747, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --enable-memalign-hack --enable-mingw32 --enable-mp3lame --ena
ble-gpl --enable-a52
built on Mar 21 2005 16:41:12, gcc: 3.4.2 (mingw-special)
Input #0, mov,mp4,m4a,3gp,3g2, from 'C:\Video\pyTivoVideos/CleeseMartinOutTowner
s.mp4':
Duration: 00:03:52.8, start: 0.000000, bitrate: 596 kb/s
Stream #0.0 Id: 1: Video: h264, 320x240, 29.97 fps
Stream #0.1 Id: 2: Audio: 0x6134706d, 48000 Hz, stereo
Output #0, vob, to 'pipe:':
Stream #0.0 Id: 0: Video: mpeg2video, 720x480, 29.97 fps, q=2-31, 4096 kb/s

Stream #0.1 Id: 1: Audio: mp2, 48000 Hz, stereo, 192 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Unsupported codec (id=86018) for input stream #0.1

Can't imagine it would actually fail on mp2 audio

The other file was a .wmv file and it complained about top crop or something like that. Both files transfer OK with Tivo.Net.

Seems like a pretty old build of ffmpeg (??). The one that comes with Tivo.Net is about twice the file size (??)

Hah !! Substituted the ffmpeg_mp2.exe that comes with Tivo.Net and it worked, although the video was blocky compared to transfering with Tivo.Net. Looks like the encoding bitrate is too low -- any way to adjust that?
__________________

"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.

Last edited by dlfl : 03-03-2007 at 09:37 AM.
dlfl is offline   Reply With Quote
Old 03-03-2007, 10:06 AM   #65
ocntscha
Registered User
 
Join Date: Oct 2003
Posts: 148
Quote:
Originally Posted by armooo
You are going to need python 2.4.
Doh! Ok, I'll check into making that happen. I did try it with Python 2.3.4 though, it seemed to at least start up but never showed in my NPL. I fired up tcpdump and it appears pyTivo is broadcasting out my public ip address and not the LAN one. I had the exact same problem with Tivo.Net until Pipakin addeded the option of picking which ip address to bind to.
ocntscha is offline   Reply With Quote
Old 03-03-2007, 12:59 PM   #66
windracer
joined the 10k club
 
windracer's Avatar
 
Join Date: Jan 2003
Location: St. Pete, FL
Posts: 11,222
I originally had Python 2.3 on my Mandrake box and pyTiVo wouldn't run either, so I upgraded to 2.5.
__________________
840~Roamio Pro (TA, MoCA) + two A92~Minis, 758~Premiere XL4 (TA, MoCA)
S/old: 746~S4, 658~HDXL, 648~OLED S3, 565~TX20, 230~S2, 140~S2

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
windracer is offline   Reply With Quote
Old 03-03-2007, 01:41 PM   #67
KRKeegan
Im lost and confused
 
KRKeegan's Avatar
 
Join Date: Jul 2004
Location: Los Angeles, CA
Posts: 215
Bugs

Quote:
Originally Posted by dlfl
Hah !! Substituted the ffmpeg_mp2.exe that comes with Tivo.Net and it worked, although the video was blocky compared to transfering with Tivo.Net. Looks like the encoding bitrate is too low -- any way to adjust that?
Hmm okay let me check out Pipakin's windows ffmpeg binary. If it is an updated version we can replace ours.

Choppy video?? Hmm i don't have a setting to change the bit rate, but I would be surprised if that was the issue. Currently the bit rates are hard coded at 4096kbits/second video and 192kbits/second audio.

I will look into adding this as an option the config file.

Quote:
Originally Posted by ocntscha
I fired up tcpdump and it appears pyTivo is broadcasting out my public ip address and not the LAN one.
Hmm okay, let me see if I can add an ip as an option in the config file

Feature Request
Ok so it would be nice to add metadata. But I don't know what is the best way to handle this:
1. I would love to use embedded data in the video file itself such as RIFF data. This would be ideal, any changes to the file would not destroy the metadata. However I dont think there is a good python module for doing this without requiring a major install.

2. Central DB. This is still very clean, but changing the name or moving an video files would delete the metadata. Additionally the loss or damage to the main DB would mean the loss of ALL data.

3. Individual files. Messy ugly and prone to create excess files. Not really an option.

Let me know what you think
__________________

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.

A python real time video transcoding server for TiVo.

Last edited by KRKeegan : 03-03-2007 at 01:54 PM. Reason: Adding Comments
KRKeegan is offline   Reply With Quote
Old 03-03-2007, 02:07 PM   #68
Ron667
Registered User
 
Join Date: Feb 2007
Posts: 10
I believe that the newer version of ffmpeg that is packaged with Tivo.net changed the way the bitrate was defined. In the old version, you specified in kbytes, in the new version you specify in bytes. I seem to remember when Pipakin switched over and had this same problem of the resolution suddenly going through the floor.

Sorry I don't have a link to that post in the other thread.
Ron667 is offline   Reply With Quote
Old 03-03-2007, 06:27 PM   #69
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,844
Quote:
Originally Posted by Ron667
I believe that the newer version of ffmpeg that is packaged with Tivo.net changed the way the bitrate was defined. In the old version, you specified in kbytes, in the new version you specify in bytes. I seem to remember when Pipakin switched over and had this same problem of the resolution suddenly going through the floor.

Sorry I don't have a link to that post in the other thread.
Yep, in the newer version you have to use "4000k" instead of "4000" (for example). I'm going to look at transcode .py to see if there is an obvious place to insert the 'k'.

Edit:
Found it, line 23 of transcode.py:
cmd = [FFMPEG, '-i', inFile, '-vcodec', 'mpeg2video', '-r', '29.97', '-b', '4096K'] + select_aspect(inFile) + ['-comment', 'pyTivo.py', '-ac', '2', '-ab', '192', '-f', 'vob', '-' ]

Note the 'k' added to 4096.

This worked fine for my .mp4 (H264 video, mp2 audio) file.

Thus just copy a better version of ffmpeg_mp2.exe (e.g., the one that comes with Tivo.Net) in to replace the original, and make this simple edit to transcode.py and you are in business. (Warning: have not tried it as a service yet.)
__________________

"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.

Last edited by dlfl : 03-03-2007 at 07:18 PM. Reason: Additional info
dlfl is offline   Reply With Quote
Old 03-03-2007, 07:20 PM   #70
KRKeegan
Im lost and confused
 
KRKeegan's Avatar
 
Join Date: Jul 2004
Location: Los Angeles, CA
Posts: 215
Quote:
Originally Posted by dlfl
Thus just copy a better version of ffmpeg_mp2.exe (e.g., the one that comes with Tivo.Net) in to replace the original, and make this simple edit to transcode.py and you are in business.
Yup that will do it, and it won't have any bad effects when running as a service.

Edit Ok adding K to the older version of ffmpeg has no negative effects. So I will change this in the release tonight. Other things in the list for tonights release: One final tweak to the transfer error.
__________________

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.

A python real time video transcoding server for TiVo.

Last edited by KRKeegan : 03-03-2007 at 08:30 PM.
KRKeegan is offline   Reply With Quote
Old 03-03-2007, 09:20 PM   #71
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,844
@KRKeegan

I'm having trouble with several files I transfer that are 1 to 5 minutes long. They transfer and view fine and ask if you want to save them. However when you try to play them from the NPL they cannot be played and it says TiVo was unable to record them perhaps because the signal was lost. (I sse this sometimes with TiVo.Net too)

Here is an excerpt from the pyTivo command window:

frame= 8997 q=1.6 Lsize= 118824kB time=300.2 bitrate=3242.9kbits/s
video:110261kB audio:7038kB global headers:0kB muxing overhead 1.300029%
192.168.0.153 - - [03/Mar/2007 21:59:56] "GET /pyTivoShare/CivWarPhotogNorth5min
Fix.wmv HTTP/1.1" 206 -
192.168.0.153 - - [03/Mar/2007 22:01:16] "GET /TiVoConnect?Command=QueryContaine
r&Container=pyTivoShare&Recurse=Yes&SortOrder=!CaptureDate&I temCount=8&Filter=x-
tivo-container%2Ftivo-videos,x-tivo-container%2Ffolder,video%2Fx-tivo-mpeg,video
%2F* HTTP/1.1" 200 -

This excerpt starts with the final 2 output lines from ffmpeg when it finished encoding. The time it gives is exactly correct for the clip. Notice the "GET ....... 206" that comes next. Is that a clue as to the problem?

Also, you posted on the Tivo.Net thread that the solution to end of transfer involved sending TiVo a 206 with certain headers. I don't see those headers in the GET....206 command, but I don't know if they should be visible there.

You may notice the bitrate is well below 4096k. That's partly because I had changed it to 3072k in transcode.py as an experiment to see how it affected this problem. The behavior was the same when it was at 4096k. The WMV file I'm transfering is highly compressed to around 600 kbps, and I don't think ffmpeg can meet the high bitrate targets. (Perhaps that is part of the problem?)
__________________

"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.
dlfl is offline   Reply With Quote
Old 03-03-2007, 10:05 PM   #72
dsandor
Registered User
 
Join Date: Jan 2007
Posts: 2
Error when listing container...

When I post this url from a browser on the pyTivo machine I get this error:

h.t.t.p:./. / 127.0.0.1:9032 /TiVoConnect?Command=QueryContainer&Container=Video

generates:

C:\Program Files (x86)\pyTivo\Cheetah\Compiler.py:1508: UserWarning:
You don't have the C version of NameMapper installed! I'm disabling Cheetah's useStackFrames option
as it is painfully slow with the Python version of NameMapper. You should get a copy of Cheetah with
the compiled C version of NameMapper.
"\nYou don't have the C version of NameMapper installed! "
stewie - - [03/Mar/2007 22:56:33] "GET / H.T.T.P/1.1" 200 -
stewie - - [03/Mar/2007 22:56:33] "GET /favicon.ico H.T.T.P./1.1" 200 -
192.168.210.234 - - [03/Mar/2007 22:56:40] "GET /TiVoConnect?Command=QueryContainer&Container=%2F H.T.T.P/1.0" 200 -
----------------------------------------
Exception happened during processing of request from ('192.168.210.234', 2381)
Traceback (most recent call last):
File "C:\Program Files (x86)\Python\lib\SocketServer.py", line 463, in process_request_thread
self.finish_request(request, client_address)
File "C:\Program Files (x86)\Python\lib\SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Program Files (x86)\Python\lib\SocketServer.py", line 521, in __init__
self.handle()
File "C:\Program Files (x86)\Python\lib\BaseH.T.TPServer.py", line 316, in handle
self.handle_one_request()
File "C:\Program Files (x86)\Python\lib\BaseH.T.TPServer.py", line 310, in handle_one_request
method()
File "C:\Program Files (x86)\pyTivo\h.t.tpserver.py", line 49, in do_GET
self.RootContiner()
File "C:\Program Files (x86)\pyTivo\h.t.tpserver.py", line 73, in RootContiner
self.wfile.write(t)
File "C:\Program Files (x86)\Python\lib\socket.py", line 261, in write
self.flush()
File "C:\Program Files (x86)\Python\lib\socket.py", line 248, in flush
self._sock.sendall(buffer)
error: (10053, 'Software caused connection abort')
----------------------------------------
192.168.210.234 - - [03/Mar/2007 22:57:39] "GET /TiVoConnect?Command=QueryContainer&Container=%2F H.T.T.P/1.0" 200 -
192.168.210.234 - - [03/Mar/2007 22:58:39] "GET /TiVoConnect?Command=QueryContainer&Container=%2F H.T.T.P/1.0" 200 -
192.168.210.234 - - [03/Mar/2007 22:59:39] "GET /TiVoConnect?Command=QueryContainer&Container=%2F H.T.T.P/1.0" 200 -
dsandor is offline   Reply With Quote
Old 03-03-2007, 11:15 PM   #73
KRKeegan
Im lost and confused
 
KRKeegan's Avatar
 
Join Date: Jul 2004
Location: Los Angeles, CA
Posts: 215
Quote:
Originally Posted by dlfl
I'm having trouble with several files I transfer that are 1 to 5 minutes long. They transfer and view fine and ask if you want to save them. However when you try to play them from the NPL they cannot be played and it says TiVo was unable to record them perhaps because the signal was lost.
Hmm I not sure what is causing this. But I noticed that Desktop sent 3 hexcodes at the end of a transfer. Adding this seems to help, I think maybe they mean end of file??

Anyways try the new version, I hope that it will solve your problem.
Quote:
Originally Posted by dlfl
Notice the "GET ....... 206" that comes next. Is that a clue as to the problem?
Nope that is exactly how it should work. The "GET" command comes from TiVo requesting more of the file that isnt there. The 206 is our response back to TiVo the headers are sent but not printed in the output.

Quote:
Originally Posted by dlfl
I don't think ffmpeg can meet the high bitrate targets. (Perhaps that is part of the problem?)
Hmm, i am not sure what you mean here. ffmpeg handles fine for me at 4096K. I am able to transcode about 30% faster than realtime. But this is on linux and using a 2.8GHz processor. Lower bitrates should run better on slower machines.

NEW VERSION
Just minor changes:
- Added some final code to end transfers properly
- Changed code to allow for use of newer version of ffmpeg

I didn't switch to pipakin's ffmpeg because it is pretty large. In fact I think we should pull ffmpeg out of the distro so people dont have to download it for every new version. Armooo what do you think?
__________________

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.

A python real time video transcoding server for TiVo.

Last edited by KRKeegan : 03-04-2007 at 12:05 AM.
KRKeegan is offline   Reply With Quote
Old 03-03-2007, 11:51 PM   #74
KRKeegan
Im lost and confused
 
KRKeegan's Avatar
 
Join Date: Jul 2004
Location: Los Angeles, CA
Posts: 215
dsander, could you describe to me more of your problem.

First is pyTivo working at all?? What XML comes up when you use this URL

:9032/TiVoConnect?Command=QueryContainer&Container=

And we will work from there
__________________

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.

A python real time video transcoding server for TiVo.
KRKeegan is offline   Reply With Quote
Old 03-04-2007, 09:08 AM   #75
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,844
166 much better!

Three WMV files (1, 2.5 and 5 mins long) that would transfer but not play later from the NPL using 165 now both transfer and play later OK with 166.

Thanks KRKeegan and Armooo

The only slight glitch was at the end of transfering the 1 min clip. It stopped and gave the wait-and-hit-play message. I had to do that several times, taking perhaps 20 seconds before it finished up in a normal way. This is not a result of slow video serving from my PC -- it was well ahead of real-time at all times during the transfer. It must be a file-length issue, I would think.

@KRKeegan:
I'll try to clarify what I was trying to say before. Normally with a 4096k bitrate specified, ffmpeg will encode at that rate plus a few 100 kbps for the audio. However for very low bitrate input files (such as my WMV's) it can't see its way clear to do this and ends up encoding with a smaller bitrate. I assume you are basing the file length estimates you send to TiVo on the specified bitrate, but the lower actual rate results in a smaller actual file size. It would be plausible to me for this to make end-of-transfer problems more likely. (???)

I am still using the ffmpeg from TiVo.Net just FYI.

I notice a delayed response to clicks when doing things in the pyTivo section of the NPL and it looks like messages are occuring about every ten seconds in the pyTivo command window. Is this timing set by pyTivo or by the TiVo itself?

Looking good so far -- thanks again
__________________

"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.
dlfl is offline   Reply With Quote
Old 03-04-2007, 11:22 AM   #76
Zothar
Registered User
 
Join Date: Mar 2007
Posts: 2
ffmpeg and aspect ratio changes

Great program guys. I had to do a few tweaks to get things to work for me and I hope they're useful for others as well.

For one video, which as 720x304 IIRC, the select_aspect_ratio() function was coming up with negative padding values, which my ffmpeg complains about. The changes are in svn diff format in the attached aspect_ratio_change patch file.

My ffmpeg's output is formatted slightly differently, so I made a change so both the old and new formats should work. The changes are in svn diff format in the attached ffmpeg_change patch file.

I've noticed that ffmpeg seems to be called several times to get various bits of info about the video file before transcoding. I'm thinking about making a generalized file info mechanism using the LRU caching mechanism, but haven't coded it up yet as it'll be a refactor compared to the above mentioned changes.

BTW, setting the svn:eol-style property to "native" on the various files in Subversion would make things easier for me and perhaps others since I'm on a Debian Linux box and it appears others may be using Windows.
Attached Files
File Type: txt pyTivo-r166-aspect_ratio_change.patch.txt (732 Bytes, 15 views)
File Type: txt pyTivo-r166-ffmpeg_change.patch.txt (1.1 KB, 15 views)
Zothar is offline   Reply With Quote
Old 03-04-2007, 11:46 AM   #77
Jabo4
Registered User
 
Join Date: Feb 2007
Posts: 21
Cool great updates. Couple questions/issues.
1. I know you said you weren't sure which method you liked on scanning the files, I much prefer populating that list as fast as possible on the tv as opposed to the current way. Is there a way to put both methods in code and give us a setting for that?

2. Windows service still doesn't work, I am unfamiliar with Python so I have no clue how to "run" that without just clicking on it. The screen pops by too fast to read the error. It is in my services, but it just doesn't start properly. How can I get this error logged so I can get a better look at what might be causing it?

But thanks! the transfers are working flawlessly for me since the updates as well.
Jabo4 is offline   Reply With Quote
Old 03-04-2007, 12:28 PM   #78
KRKeegan
Im lost and confused
 
KRKeegan's Avatar
 
Join Date: Jul 2004
Location: Los Angeles, CA
Posts: 215
Quote:
Originally Posted by dlfl
The only slight glitch was at the end of transfering the 1 min clip. It stopped and gave the wait-and-hit-play message. I had to do that several times, taking perhaps 20 seconds before it finished up in a normal way.
Yeah this is a function of how TiVo requests the file. The process works like this.
1. TiVo asks for the information about a video
2. pyTivo sends back a file size that is as large as the file could possibly be (Example 1Gig)
3. TiVo sends a get request for the Video
4. pyTivo streams the video as it transcodes
5. Stream abrubtly ends at the end of the video (Example 800MB)
NOTE: At this point TiVo is still expecting another 200MB
6. TiVo waits thinking that network traffic has slowed down the packets, TiVo seems to wait 30 seconds or so.
7. TiVo then requests the file again asking for the last 200MB
8. pyTivo responds with a 206 which tells TiVo that the file has ended and sends a short bit of code which I believe equals and End of File line.

The problem occurs in steps 6-8. Until TiVo receives the 206 response it leaves the file open expecting more to come. I don't think I can force TiVo to respond any faster. And I dont think i can just send the 206 until TiVo requests it. As for bad estimations in the file size. They dont really matter, too large just clears more space than necessary but it doesnt affect the delay at all in steps 6-8. Too small clearly would cause the video to end prematurely, so I would rather err on the much to large side than be super accurate.

I think for very short files we may always have small problems trying to play them live. I will look into this but since playing files 1 minute in length is rare I won't consider it critical.

Quote:
Originally Posted by dlfl
I notice a delayed response to clicks when doing things in the pyTivo section of the NPL and it looks like messages are occuring about every ten seconds in the pyTivo command window. Is this timing set by pyTivo or by the TiVo itself?
Hmm, the TiVo UI is a little slow, but 10 seconds sounds excessive. 10 seconds may occur the first time you load a folder after starting pyTivo. But if you exit the NPL and come back that folder should load in seconds because the info is in the cache the second time.

Quote:
Originally Posted by Zothar
For one video, which as 720x304 IIRC, the select_aspect_ratio() function was coming up with negative padding values, which my ffmpeg complains about. The changes are in svn diff format in the attached aspect_ratio_change patch file.
Oops I thought I fixed all of these issues. Thanks for the help

Quote:
Originally Posted by Zothar
My ffmpeg's output is formatted slightly differently, so I made a change so both the old and new formats should work. The changes are in svn diff format in the attached ffmpeg_change patch file.
Again thanks for the help.

Quote:
Originally Posted by Zothar
I've noticed that ffmpeg seems to be called several times to get various bits of info about the video file before transcoding. I'm thinking about making a generalized file info mechanism using the LRU caching mechanism, but haven't coded it up yet as it'll be a refactor compared to the above mentioned changes.
Hmm, I think(??) that ffmpeg is only called at most twice per file. Once to get the video info(Size, Duration, Type) which is then cached in LRU. And a second time to transcode the file. If there are places where it is calling ffmpeg unnecessarily please let me know, but I think we caught them all.

Quote:
Originally Posted by Zothar
BTW, setting the svn:eol-style property to "native" on the various files in Subversion would make things easier for me and perhaps others since I'm on a Debian Linux box and it appears others may be using Windows.
I not in charge of SVN, and I dont even know what that is so maybe armooo can fix that for you.

As for your updates, since they are not critical I will toss them into a cumulative update tonight.
__________________

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.

A python real time video transcoding server for TiVo.
KRKeegan is offline   Reply With Quote
Old 03-04-2007, 12:51 PM   #79
KRKeegan
Im lost and confused
 
KRKeegan's Avatar
 
Join Date: Jul 2004
Location: Los Angeles, CA
Posts: 215
teehee, you snuck in there while I was writing my previous message.
Quote:
Originally Posted by Jabo4
Cool great updates. Couple questions/issues.
1. I know you said you weren't sure which method you liked on scanning the files, I much prefer populating that list as fast as possible on the tv as opposed to the current way. Is there a way to put both methods in code and give us a setting for that?
Yeah I was thinking about that too. I think this is doable.

Quote:
Originally Posted by Jabo4
2. Windows service still doesn't work, I am unfamiliar with Python so I have no clue how to "run" that without just clicking on it. The screen pops by too fast to read the error. It is in my services, but it just doesn't start properly. How can I get this error logged so I can get a better look at what might be causing it?
Hmm, the windows service has been armooo's teritory.

But to run it so you can see the errors:
1. Start->Run
2. Type "cmd"
3. browse to the folder where pyTivo is located. For example "cd c:\program files\pytivo"
4. Type "pyTivoService.py"

That will run the service in the command window, all errors will be displayed there. If you need to end a python program it can be accomplished by presseing CTRL-BREAK
__________________

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.

A python real time video transcoding server for TiVo.
KRKeegan is offline   Reply With Quote
Old 03-04-2007, 02:11 PM   #80
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,844
@KRKeegan

I just transfered a 5 minute .mpg clip that was edited from a TiVo recording using VideoReDo. I thought it should have transfered without re-encoding, as stated in the first post of this thread:
Quote:
It will not transcode an mpeg that is in a format supported by tivos
However, not only did it start re-encoding, but the aspect ratio on the TV was wrong (corresponding to the 480x480 format of the file).

This same clip will go back using TiVo go back and plays with the correct AR. The VideoReDo info says the display resolution is 720x480 (but encoding resolution is 480x480), as it does for all TiVo recordings or edited versions thereof.
__________________

"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.
dlfl is offline   Reply With Quote
Old 03-04-2007, 02:48 PM   #81
Zothar
Registered User
 
Join Date: Mar 2007
Posts: 2
video_info() LRU

Quote:
Originally Posted by KRKeegan
Hmm, I think(??) that ffmpeg is only called at most twice per file. Once to get the video info(Size, Duration, Type) which is then cached in LRU. And a second time to transcode the file. If there are places where it is calling ffmpeg unnecessarily please let me know, but I think we caught them all.
Here are the lines where I see it:
Code:
46:    type, width, height, fps, millisecs =  video_info(inFile)
110:    type, width, height, fps, millisecs =  video_info(inFile)
144:    if video_info(inFile)[0]:
145:        return video_info(inFile)[4]
For video, the only use of LRU that I see currently is in video.py to keep the playable or not boolean. video_info() itself should probably do an LRU internally, which would keep the other code simple.
Zothar is offline   Reply With Quote
Old 03-04-2007, 05:52 PM   #82
Jabo4
Registered User
 
Join Date: Feb 2007
Posts: 21
Yea I'm not sure what's up with the service. It just spits out the usage stuff when I run it. I can try start/stop install/update/remove w/e it just does nothing. Not a big deal I may write a service myself in .net to accomplish it. Thanks for all the hard work!
Jabo4 is offline   Reply With Quote
Old 03-04-2007, 08:54 PM   #83
KRKeegan
Im lost and confused
 
KRKeegan's Avatar
 
Join Date: Jul 2004
Location: Los Angeles, CA
Posts: 215
Quote:
Originally Posted by dlfl
However, not only did it start re-encoding, but the aspect ratio on the TV was wrong (corresponding to the 480x480 format of the file).
Hmm, I am trying to reproduce this. I have a TiVo file that is 352x480 and it worked properly.

Can you tell me the following details about the video:
Type: I am assuming mpeg2video, but just confirm for me
FPS
Dimensions

And I will try and figure out what is going on.

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.

A python real time video transcoding server for TiVo.
KRKeegan is offline   Reply With Quote
Old 03-04-2007, 10:36 PM   #84
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,844
@KRKeegan

Quote:
Originally Posted by KRKeegan
Hmm, I am trying to reproduce this. I have a TiVo file that is 352x480 and it worked properly.

Can you tell me the following details about the video:
Type: I am assuming mpeg2video, but just confirm for me
FPS
Dimensions

And I will try and figure out what is going on.

Kevin
Here is what mediaInfo says:

Quote:
General #0
Complete name : C:\Video\CleeseMartinOutTowners.mpg
Format : MPEG-2 Program
Format/Family : MPEG-2
File size : 166 MiB
PlayTime : 3mn 52s
Bit rate : 5970 Kbps

Video #0
Codec : MPEG-2 Video
Codec profile : Main@Main
Codec settings/Matri : Custom
PlayTime : 3mn 52s
Bit rate : 9000 Kbps
Bit rate mode : CBR
Width : 480 pixels
Height : 480 pixels
Aspect ratio : 4/3
Frame rate : 29.970 fps
Standard : NTSC
Chroma : 4:2:0
Interlacement : Interlaced
Bits/(Pixel*Frame) : 1.303

Audio #0
Codec : MPEG-1 Audio layer 2
PlayTime : 3mn 52s
Bit rate : 192 Kbps
Bit rate mode : CBR
Channel(s) : 2 channels
Sampling rate : 48 KHz
Resolution : 16 bits
This was edited out of a Best-Quality TiVo recording using VideoReDo. I'm pretty sure these specs are exactly those of the original TiVo file. VideoReDo does no re-encoding -- ever.

If you load a file in VideoReDo it will tell you specs too:
Quote:
File Name: C:\Video\CleeseMartinOutTowners.mpg
File Size: 173688836 ( 0.16 GB )
Program Duration: 00:03:52.21
File Type: PS - MPEG2
Encoding: MPEG 2
Video stream Id: xE0
Encoding Dimensions: 480 x 480
Display Size: 480 x 480
Aspect Ratio: 4/3
Frame Rate: 29.97 FPS
Bit Rate: 9.000 Mbps
VBV_Buffer: 224 KB
Profile: Main/Main
Progressive: Prog or Int
Chroma: 4:2:0
Audio Format: Layer 2
Audio Stream Id: xC0
Audio Bit Rate: 192 Kbps
Audio Sampling Rate: 48000 Hz
For the original TiVo recording you get exactly the same thing except the name and duration are different (expected) but also the Display Size is 720x480. However the mpeg2 plays with correct AR in WMP11 and when transfered to the TiVo via TiVo go back.

Actually, I remember having this same aspect ratio problem initially with TiVo.net (which always re-encodes even TiVo compliant mpeg2's as you know). It was in response to this that Pipakin added the two choices for aspect ratio. I think if you can keep it from re-encoding the problem might vanish. I'm wondering if the "Display Dimensions" are being reported by ffmpeg to pyTivo and since they are not 720x480 pyTivo thinks it needs to be re-encoded? This could be a difference between versions of ffmpeg -- I'm using the one that comes with TiVo.net.
__________________

"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.
dlfl is offline   Reply With Quote
Old 03-04-2007, 10:55 PM   #85
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,844
166 test results looking good

I've tested with a short DivX file and a 1.5 hour AVI (XVID + mp3). No end-of-file problems.

Score one for Zothar's aspect ratio patch, however. The AVI file was a 320x192 and without the patch it would not encode, throwing a top crop error (IIRC). With the patch it encoded fine. It ended up stretched about 9% vertically, but this probably would not be noticed by most viewers. I determined this by measuring a stop sign in one scene on the TV screen. When transfered with TiVo.net (with the correct aspect ratio choice) it was compressed vertically by about 4% -- I'm not sure my TV is any better than that.
__________________

"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.

Last edited by dlfl : 03-04-2007 at 11:17 PM. Reason: More accurate percent vertical stretch/compress numbers
dlfl is offline   Reply With Quote
Old 03-04-2007, 10:56 PM   #86
KRKeegan
Im lost and confused
 
KRKeegan's Avatar
 
Join Date: Jul 2004
Location: Los Angeles, CA
Posts: 215
Ok sorry folks I am dead tired tonight. I was up at 4:30 for a bike tour before the marathon here in LA.

Zothar Alright I will agree to the bad algebra in the vertical padding. But I double checked the horizontal and I think I have that one correct. I don't know look at them both again and let me know. It has been a long time since I had algebra.

Update
Other than fixing that minor bug. I didn't do anything else tonight. dlfl I will do my best to figure out why ffmpeg is still transcoding a TiVo file. Zothar I tried to move LRUcache from video.py to transcode.video_info(), but it just gave me a headache and I think I am too tired to think properly. Jabo4 Once I move the cache to it's new location I think I can create a quick extra file that can optionally be spawned at start to query all files.

So maintenance update tonight, nothing big. Have a good night all.
__________________

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.

A python real time video transcoding server for TiVo.
KRKeegan is offline   Reply With Quote
Old 03-04-2007, 11:21 PM   #87
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,844
@KRKeegan
Sleep well, oh good and faithful servant!
__________________

"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.
dlfl is offline   Reply With Quote
Old 03-05-2007, 10:51 AM   #88
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,844
More on mpeg re-encoding

Quote:
Originally Posted by KRKeegan
...... dlfl I will do my best to figure out why ffmpeg is still transcoding a TiVo file. .....
Since I am using a different ffmpeg, it could be as simple as using Zothar's ffmpeg patch, or a similar problem related to the way ffmpeg reports file specs. I haven't looked at the patch yet.
__________________

"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.
dlfl is offline   Reply With Quote
Old 03-05-2007, 12:04 PM   #89
KRKeegan
Im lost and confused
 
KRKeegan's Avatar
 
Join Date: Jul 2004
Location: Los Angeles, CA
Posts: 215
Quote:
Originally Posted by dlfl
Since I am using a different ffmpeg, it could be as simple as using Zothar's ffmpeg patch, or a similar problem related to the way ffmpeg reports file specs. I haven't looked at the patch yet.
The patch is in 167, but i dont think that is your problem. pyTivo determines by a list if a file is compatible. The only thing I can think of is that the dimensions are not in the list.
__________________

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.

A python real time video transcoding server for TiVo.
KRKeegan is offline   Reply With Quote
Old 03-05-2007, 09:18 PM   #90
dlfl
Cranky old novice
 
dlfl's Avatar
 
Join Date: Jul 2006
Location: Near Dayton, Ohio
Posts: 5,844
Nope, it's the ffmpeg info format....

Quote:
Originally Posted by KRKeegan
The patch is in 167, but i dont think that is your problem. pyTivo determines by a list if a file is compatible. The only thing I can think of is that the dimensions are not in the list.
The 480x480 is already in the table. However the format of the line returned from ffmpeg is different for the one I'm using and it messes up the return from video_info().

pyTivo-supplied ffmpeg:
Quote:
Stream #0.0 Id: 1e0: Video: mpeg2video, 480x480, 29.97 fps, 9000 kb/s
ffmpeg I'm using:
Quote:
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 480x480, 9000 kb/s, 29.97 fps(r)
I changed transcode.py as follows:
Code:
    rezre = re.compile(r'.*Video: (.+), (.+), (\d+)x(\d+), (.+), (.+) fps.*')
    m = rezre.search(output)
    if m:
        millisecs = ((int(d.group(1))*3600) + (int(d.group(2))*60) + int(d.group(3)))*1000 + (int(d.group(4))*100)
        return m.group(1), int(m.group(3)), int(m.group(4)), m.group(6), millisecs
and it returned the correct info. Then a TiVo-compatible mpeg transfered without re-encoding and played with the correct aspect ratio.

However there was still a problem. The clip was 3 min 52 sec long and it stopped transfering at about 80% and the following error message appeared in the pyTivo command window:

Quote:
mpeg2video 480 480 29.97 232300
----------------------------------------
Exception happened during processing of request from ('192.168.0.153', 1445)
Traceback (most recent call last):
File "C:\Python25\lib\SocketServer.py", line 463, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python25\lib\SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python25\lib\SocketServer.py", line 521, in __init__
self.handle()
File "C:\Python25\lib\BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "C:\Python25\lib\BaseHTTPServer.py", line 310, in handle_one_request
method()
File "C:\Program Files\pyTivo167\httpserver.py", line 31, in do_GET
plugin.SendFile(self, container, name)
File "C:\Program Files\pyTivo167\plugins\video\video.py", line 34, in SendFile

transcode.output_video(container['path'] + path[len(name)+1:], handler.wfile
)
File "C:\Program Files\pyTivo167\plugins\video\transcode.py", line 27, in outp
ut_video
shutil.copyfileobj(f, outFile)
File "C:\Python25\lib\shutil.py", line 24, in copyfileobj
fdst.write(buf)
File "C:\Python25\lib\socket.py", line 261, in write
self.flush()
File "C:\Python25\lib\socket.py", line 248, in flush
self._sock.sendall(buffer)
error: (10054, 'Connection reset by peer')
----------------------------------------
Note the first line was not part of the error message -- I just added a print statement in tivo_compatable() to indicate what info was being parsed from ffmpeg. Note the millisecs value is correct for the clip duration.

I repeated the transfer just to verify it did exactly the same thing. The part that transfers before the error does stay in the NPL and can be played.

I can't help suspecting this error is a result of underestimating the file size (???).

EDIT:
It was the estimate, I think.
I modified video.py as follows:
Code:
        def est_size(file):
	    #Size is estimated by taking audio and video bit rate adding 2%
	    return int((duration(file)/1000)*((6200 * 1.02 * 1000)/8))
(i.e., substituting 6200 for the 4288 that was there).
The entire file transfered -- after a short while the 206 response was sent, and all was well.

This was done because this clip was recorded at TiVo Best Quality which is around 5800 kbps. Of course this is just a test hack and probably shouldn't be left that way -- it overestimates re-encoded files by way too much. There needs to be a more accurate file size estimate for TiVo-compatible files, right ?
__________________

"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.

Last edited by dlfl : 03-05-2007 at 10:00 PM. Reason: Additional info
dlfl is offline   Reply With Quote
Reply
Forum Jump




Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Advertisements

TiVo Community
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
vBulletin Skins by: Relivo Media

(C) 2013 Magenium Solutions - All Rights Reserved. No information may be posted elsewhere without written permission.
TiVoŽ is a registered trademark of TiVo Inc. This site is not owned or operated by TiVo Inc.
All times are GMT -5. The time now is 03:04 PM.
OUR NETWORK: MyOpenRouter | TechLore | SansaCommunity | RoboCommunity | MediaSmart Home | Explore3DTV | Dijit Community | DVR Playground |