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

pyTivo - Transcoding server

Discussion in 'TiVo Home Media Features & TiVoToGo' started by armooo, Nov 25, 2006.

  1. PaulS

    PaulS Member

    674
    1
    Sep 16, 2002
    Southern NH

    More info on further investigation. It's clear why I'm seeing degraded video. It's because everything's being downrezzed to 480p. Duh! :)

    Here's an example transfer I did tonight. Source file is a Matroska contained H.264 1280x720 @ 23.98 fps video, being transferred to my Series3.


    My really simple pytivo.conf file :
    Code:
    [Server]
    Port=9042
    GUID=314253
    debug=true
    aspect169=true
    ffmpeg=j:\pyTivo-2007-12-04\plugins\video\ffmpeg_mp2.exe
    
    [StuffToWatch2]
    type=video
    path=c:\Videos
    auto_subshares=true

    From my debug.txt log :

    Code:
    video_info: [B]Codec= h264  width= 1280  height= 720  fps= 23.98[/B]  millisecs= 3357300 
    tivo_compatible:  c:\Videos\File1 - 720p.mkv  is not mpeg2video it is  h264 
    output_video:  c:\Videos\File1 - 720p.mkv  is not tivo compatible
    video_info:  c:\Videos\File1 - 720p.mkv  cache hit! 
    tsn: 648000123456789 
    aspect169: True 
    optres: False 
    select_aspect: File= c:\Videos\File1 - 720p.mkv  Type= h264  width= 1280  height= 720  fps= 23.98  millisecs= 3357300  ratio= 177  rheight= 9  rwidth= 16  [B]TIVO_HEIGHT= 480 TIVO_WIDTH= 544[/B] 
    select_aspect: File is within 16:9 list and 16:9 allowed.
    transcode: ffmpeg command is  j:\pyTivo-2007-12-04\plugins\video\ffmpeg_mp2.exe -i c:\Videos\File1 - 720p.mkv -vcodec mpeg2video -r 29.97 -b 4096K -maxrate 17408k -bufsize 1024k -aspect 16:9 [B]-s 544x480 [/B]-comment pyTivo.py -ac 2 -ab 192K -ar 44100 -f vob -
    
    So, I guess I've got to enable "optres=true" in my pytivo.conf file if I want to keep 720p stuff at that resolution.
     
  2. grahamkent

    grahamkent New Member

    16
    0
    Feb 15, 2003
    Seattle, WA
    I have a similar setup but only a single series 2 Tivo. This is working well for me.

     
  3. DinoBambino

    DinoBambino New Member

    53
    0
    Nov 18, 2003

    Thanks! I will give it a try tomorrow night. I just got done watching Superbad when I should be asleep. :eek:
     
  4. dlfl

    dlfl Cranky old novice

    6,996
    16
    Jul 6, 2006
    Near...
    Yep, you've demonstrated that pyTivo defaults to 544x480 res unless you force it to do otherwise, either with optres or by setting width and height explicitly.

    Also, when you do get it to use a larger format you will probably want to set the video_br to something higher than the default (4096k), perhaps 8Mi to 10Mi for the format you mention. Also set bufsize to something large like 17Mi.
    (1 Mi = 1024k).
     
  5. PaulS

    PaulS Member

    674
    1
    Sep 16, 2002
    Southern NH
    I'd probably want to go a different route, as far as maintaining the bitrates is concerned. In fact, I think that what I'd like to do should be integrated into the base OptRes option behavior.

    Since OptRes is already selecting the output resolution based upon the input resolution of the source material, wouldn't it stand to reason that it should also select an appropriate output bitrate as well ? It doesn't really make sense to spit out everything at a single bitrate (either 4Mbps or 17Mbps) if you're mixing SD and HD content.

    Make sense ?
     
  6. jcthorne

    jcthorne Active Member

    2,721
    3
    Jan 28, 2002
    Houston
    This may be off topic here but can anyone explain just what is the -bufsize parameter? I have it set to 1024k as recomended by someone sometime back and my ffmpeg conversions from mkv to tivo seem to work fine, but what would changing it do?

    Also as stated earlier, for my TivoHD, I removed the framerate, height and width parameters from the ffmpeg_params line completely so that ffmpeg leaves the output the same as input file resolution and framerate.
     
  7. PaulS

    PaulS Member

    674
    1
    Sep 16, 2002
    Southern NH
    Is this still the ffmpeg_pline you're using ? I'll exclude the "threads" parameter, since not all folks will have a multi-core or multi-CPU set up at their disposal.

    Code:
    ffmpeg_prams=-vcodec mpeg2video -maxrate 17Mi -qscale 1.2 -bufsize 1024k -comment pyTivo.py -acodec ac3 -ab %(audio_br)s -ar 48000 -f vob -
    
     
  8. tivostriker

    tivostriker New Member

    2
    0
    Mar 10, 2006
    I've had pyTivo working great for months now with no problems an occasional restart couldn't solve.

    Suddenly, I went to launch pyTivo.py this morning, and it just opens the dos box with no text, completely blank and black. I'm not sure where to begin.

    I've tried getting the latest versions, turning off firewalls, but nothing. I can launch pyTivoConfigurator.py, so I know python is working, but pyTivo.py is just blank.

    I'm using WinXP.

    Any thoughts? Thanks
     
  9. ruttmeister

    ruttmeister New Member

    18
    0
    Dec 8, 2007
    West Des...
    This may sound like a stupid question, but once the dos box opens, have to actually tried going to your TiVo and viewing the shares? Sometimes when I start pyTiVo it does the same thing, but everything still works just fine. Try it, see what happens and post back.
     
  10. dlfl

    dlfl Cranky old novice

    6,996
    16
    Jul 6, 2006
    Near...
    Welcome to the forum!

    A blank dos box isn't that unusual at startup. Are you saying your shares aren't seen by the TiVo?
     
  11. tivostriker

    tivostriker New Member

    2
    0
    Mar 10, 2006
    Thanks for the inputs. I was saying that launching pyTivo did nothing at all except display a blank/empty/black dos box, with no words or anything. Nothing was showing on Tivo either, but no suggestion or question is stupid when it comes to solving weird problems. I used to work tech support, people do forget to just plug the thing in or push the power button.

    I figured it out, but just wanted to post. Turns out we had a power outage last night (I'm in Oklahoma, we're seeing "Ice Storm 2007!&#*"). Once I unplugged my Tivo and replugged back in, rebooted the computer and launched pyTivo, all was good. Perhaps the developer can add some verbage to say something about Tivo not communicating or communicating problem or something.

    Thanks!
     
  12. dlfl

    dlfl Cranky old novice

    6,996
    16
    Jul 6, 2006
    Near...
    Mea culpa -- mea stupido!

    I've been advising setting bufsize to huge (e.g., 17Mi) and I think that is wrong -- I was confusing it with maxrate, which now defaults to that large value -- OP found this necessary to prevent quality problems on high bitrate HD transcoding, and it apparently does no harm for lower bitrate cases

    The default bufsize is 1024k and after searching the thread I find no indication it needs to be higher.

    My apologies ... you know what free advice is worth!
     
  13. wmcbrine

    wmcbrine Ziphead

    10,366
    22
    Aug 2, 2003
    Yeah, and they're saying that it doesn't display a startup banner (unless you count the Cheetah error message, which I don't get on my system since I installed Cheetah from the repositories), so that's not abnormal. You only see requests as they come in from Tivos. Now, normally, there's a request from each Tivo on your LAN shortly after pyTivo starts up. But not always.

    pyTivo has (initially) no way of knowing whether there are any Tivos on your network, or whether they should be responding. See, what happens is, on startup, pyTivo sends out a broadcast message that says "I'm here!". Typically, then, each Tivo that receives this message sends back a (non-broadcast) request that says "So tell me what you've got!". And everything after that is just the Tivo making requests, and pyTivo responding. Tivos can come and go off the LAN, and pyTivo won't know the difference, because these are your standard stateless HTTP connections.

    The "I'm here" beacon is resent at intervals for the benefit of any Tivos that do come online. Meanwhile, if a Tivo gets a beacon from a server that's already sent it one recently, it doesn't bother to make a new "so tell me what you've got" request. So in that case -- for instance, if you stop pyTivo and start it up again fairly quickly -- you can get a situation where nothing will show up in the pyTivo window.
     
  14. dlfl

    dlfl Cranky old novice

    6,996
    16
    Jul 6, 2006
    Near...
    Yes. One possible sensible algorithm might be to start with the default video_br and scale it by the ratio of total pixels, e.g., if you are encoding to 1440x720, multiply 4096kbps by (1440x720)/(544x480), which would yield
    15.88 Mi. This seems a little high so maybe the base value should be 3Mi instead of 4Mi, or maybe it could be based on the video_br you put in the config file. In other words you configure what would normally be acceptable to you for non-HDTV and then it is scaled up from that based on the ratio of total pixels.
     
  15. PaulS

    PaulS Member

    674
    1
    Sep 16, 2002
    Southern NH

    If it can be shown that the Series3/TiVoHD can accomodate any MPEG-2 file, regardless of height, width, and framerate, this may all be a moot point for the HDTV capable TiVo units.

    jcthorne's parm list for ffmpeg simply has it perform the necessary transcode (any_codec -> MPEG-2) operation, while retaining the same width, height and frame rate. The TiVo will then perform the scaling in hardware to get the output to the desired height, width and framerate on playout.

    So, if this holds true, then there is no need for OptRes (with or without a modified bitrate algorithm) for the HDTV capable TiVo units. The source file will simply be transcoded to MPEG-2, and scaled by the TiVo.

    Of course, this likely doesn't hold true for the SD TiVo units, who will need to have their content force fed to them in 544x480@29.97 MPEG-2.
     
  16. reneg

    reneg Member

    699
    0
    Jun 19, 2002
    Something simple to force recognition of the "I'm here" beacon is to change the GUID in the pytivo.conf file.
     
  17. wmcbrine

    wmcbrine Ziphead

    10,366
    22
    Aug 2, 2003
    Oh yeah, BTW -- I was wondering about the GUID thing. Is there any reason not to just set it to a random number? That way, you could have multiple servers on your LAN without having to manually set the GUIDs. I did this experimentally:

    Code:
    def getGUID():
        if config.has_option('Server', 'GUID'):
            guid = config.get('Server', 'GUID')
        else:
            rand = random.Random()
            guid = str(rand.randint(100000, 999999))
        return guid
     
    and it seemed to work fine. But I don't know what rules, if any, are supposed to apply to the GUID. (I guess I need to read up on Bonjour/Rendevous?) Anyway, I did notice some flickering in my Now Playing list when I had a pyTivo share highlighted while I restarted it with a different GUID, but that was the only problem (easily corrected by moving the highlight).
     
  18. reneg

    reneg Member

    699
    0
    Jun 19, 2002
    I also noticed no ill effects, but have not thoroughly researched it myself. For your own little subnet, you are most likely OK as long as your random numbers don't come out the same.
     
  19. Hercules67

    Hercules67 TiVo addict

    354
    0
    Dec 8, 2007
    Folks, excuse my ineptitude and newbie question. I have read the FAQ and the WIKI, and have performed a search in the thread, but I could be doing something that you all have not done, or something that is so obvious it's just escaping me.

    Ok, so, I have installed pyTivo, Python 2.5, ffmpeg (actually already had that, but anyway, it's included with pyTivo). My pyTivo.conf looks like this:
    -----------------------------------------
    [Server]
    port=9032
    beacon=192.168.1.103
    ffmpeg=C:\Documents and Settings\Mike\My Documents\pyTivo

    [My Videos]
    type=video
    path=F:\My Videos
    -----------------------------------------

    Ok, the path is an external USB WD Hard Drive where I keep a lot of Videos I download.

    So, [My Videos] shows up in NPL, but of course nothing shows up in it. I suspected, at first that it was the USB Hard Drive, so I changed the path and put stuff locally on the C: drive. But that made no difference.

    Ok, so, now I am suspecting, the network as the problem. I am getting an "Error 5". Whatever that means. Do you all need to see my Debug file?

    Here's what I am doing different with my network, that I have not seen discussed ANYWHERE. My TiVo (yes, I only have one Series 2 TiVo) is being run by Wireless connection. I have three other computers on my router (they are hardwired in by ethernet cable.) I also have a laptop that gets a wireless connection handed to it by the router. (Other than that, the network is "secured down" pretty heavily). Because, after I installed TiVo Desktop way back last year, I had trouble downloading shows to the main Video Processing PC, I ended-up setting the TiVo IP address in stone as 192.168.1.103. That's the only one that's set in stone. Everything else is assigned by the router.

    I am also running WEP security. Does that matter? Is that what is causing my problem? On the software firewall, I have of course allowed Python to get through and all of that. I am running a Linksys Wireless router. Do I need to open port 9032 in it or something? How do I do that?

    Any help would be appreciated, up to and including, PM-ing me or pointing me to the right posts.

    Thanks in advance!
     
  20. TreborPugly

    TreborPugly Unreal!

    4,542
    0
    May 2, 2002
    Eastern TN
    Is your ffmpeg path really only that text? It should probably be something like:
    ffmpeg=C:\Documents and Settings\Mike\My Documents\pyTivo\plugins\video\ffmpeg_mp2.exe
     

Share This Page