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

HME/VLC video streamer, v1.0 -- watch NASA TV, etc.

Discussion in 'TiVo Home Media Features & TiVoToGo' started by wmcbrine, Aug 23, 2008.

  1. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    HME/VLC video streamer, v3.6
    by William McBrine <wmcbrine@gmail.com>
    July 3, 2010
    A simple streaming HME server for the TiVo Series 3+.
    Uses ports 9043 and 9044. Tested on Ubuntu Linux 8.04 through 10.04, Mac 
    OS X 10.4, and Windows XP.
    - TiVo S3, HD or Premiere with 9.4 or later software
    - Python -- 2.x only (2.6.x recommended)
    - VLC (0.8.6 recommended)
    - Unzip
    - (Optional) Edit config.ini to point to your files
    - Run start.py
    - Go to the Music, Photos and More menu on your TiVo
    - Ctrl-C on Linux or Mac; close the window on Windows. (Ctrl-C does an
      orderly shutdown that removes the app from the menu, but unfortunately
      this doesn't work in Windows.)
    More info:
    Streams can require VLC to reencode/rebroadcast them, or not. For the 
    TiVo to use a stream directly, without VLC, the stream must be MPEG-1, 
    MPEG-2 or MPEG-4 h.264, and served via http. Entries for new streams, 
    shares, RSS feeds or Shoutcast sources can be created in config.ini.
    Only one instance of VLC will be run at a time, but it can support 
    multiple TiVos watching the same stream, with little additional 
    overhead. However, two different TiVos can't simultaneously watch two 
    different streams if they both require VLC.
    VLC 0.9 through early 1.x was broken for HME/VLC's purposes.
    3.6 -- The latest versions of VLC finally work again, _if_ the frame
           rate is set to 30 (instead of 29.97) and the codec to mp2v
           (instead of mp1v). Reported by "Allanon".
           Now based on HME for Python version 0.18, which includes e.g.
           various fixes for Zeroconf.
           Support for non-ASCII characters in filenames and description
           The new HD UI on the TiVo Premiere requires RGB icons; use a
           standard-def RSS icon when appropriate.
           Encode audio at 48 KHz instead of 44.1; default video bitrate is
           now 4 Mbps instead of 2.
           Some broken feeds have enclosures with no types.
           Purged some streams and feeds that no longer work, including
    3.5 -- Descriptions for Shoutcast, based on the "name" field. This is
           actually backwards -- "name" should be the title, and "ct" the
           description -- but the way the name field is abused, this is the
           only way that makes sense.
           Support for pyTivo .txt files. Currently only the description is
           Retry with VLC (or show the error message) from handle_error() as
           well as handle_resource_info().
           Tweak the gap between the title and the description -- now six
           lines fit the info window neatly.
           If the only items are either live streams or RSS feeds, skip
           their folders. (This is similar to what's done for files, but
           different -- the top-level menu retains its name and background
    3.4 -- No more idle timeout during paused video.
           If live streams or RSS feeds are three or fewer items each, show
           the items in the top-level menu instead of a folder; also, if
           only one item would appear in the top-level menu, and it's a
           directory, then show the directory's contents instead.
           Display description text in the info view. Currently this is only
           automatic for RSS items, but you can set it for live streams if
           you like, by adding a "desc=whatever" line.
           More internal reorganization.
    3.3 -- Added support for "needs_vlc" in file shares. Normally, the
           extension of the file is used to determine whether VLC should be 
           used; and if playback fails without it, it's retried with VLC. 
           But some files in ostensibly compatible formats don't play, but 
           don't give an error, either, so HME/VLC doesn't know to retry 
           them. Setting "needs_vlc=True" in config.ini for the share will 
           force the use of VLC even for these not-so-compatible files.
           RSS Feeds are now kept in a separate top-level folder.
           Slightly better error reporting/logging.
           Internal reorganization.
    3.2 -- Files with the extensions ".tivo", ".m4v", ".mpeg", ".vob", and
           ".m2v" are now passed through without reencoding (in addition to
           the old ones ".mpg" and ".mp4"). The supported extension list is
           now derived from the list of MIME types in start.py.
           Skip items in RSS feeds with no enclosures, or with enclosures 
           not of type video, since some feeds include mixed media.
    3.1 -- Use HD menus when possible.
           Wrap text in the "Loading..." screen.
           Separate RSS icon.
    3.0 -- Support for iTunes-style RSS feeds, and Shoutcast TV. See the
           included config.ini for configuration examples. Mostly due to
           Jeff Mossontte, aka "Allanon".
    2.7 -- If files or streams fail a pass-through (non-VLC) attempt, try
           again using VLC, if available. Suggested by TCF user "goodtrips".
           (Not as helpful as one would expect -- VLC is refusing to
           transcode some things that it can play perfectly well.)
           Added a few more recognized extensions (let me know if there's
           one you want).
           Page Up / Page Down was messed up.
           Lists with more than 256 items caused an exception. Reported
           by "Allanon".
    2.6 -- Make sure VLC is shut down even when the HME/VLC session ends
           abnormally. Suggested by TCF user "texaslabrat".
           Use AC3 instead of MPEG audio -- should allow for more channels
           and higher quality.
           Added support for setting audio bitrate via config.ini; default 
           is 384.
           Rounded end for the highlight bar; shaded background area now 
           stays in place, as in TiVo's own menus; delay when sliding the 
           menu in is more reliable.
    2.5 -- Server port and video bitrate can be set in config.ini; the vlc
           path is taken from the [hmevlc] section instead of [DEFAULT].
           start.py is now identical to the HME for Python version; the port
           and datapath are set in config.ini. (If you're upgrading from a
           previous version and have your own, modified config.ini, you
           should copy the [hmeserver] and [hmevlc] sections from the new
           It should no longer be necessary to set the datapath under
           Windows, unless your videos are on a different drive from
           HME/VLC. You still can only use shares on one drive at a time,
           unless all the videos in a share require reencoding.
           Paths in config.ini are now validated; shares with invalid paths
           are skipped.
    2.4 -- Allow specifying the location of VLC via "vlc=/path/to/vlc" in 
           the DEFAULTS section of config.ini.
           Recognize when VLC isn't found, and don't show items that need
           Allow the Advance key to skip to the end/beginning of a menu.
           Remember the position in lower menus as well as higher. This is
           closer to the behavior of the TiVo's built-in menus. They're only
           remembered while the app is running.
           Use images for the menu backgrounds. I liked my squares routine,
           but the TiVo didn't like all those transparent views.
           A little more room for text in menus.
    2.3 -- No more leaking text resources.
           For debugging purposes, I'd disabled the 9.4-TiVo-software-only
           test, and forgot to reenable it before releasing 2.2. Not for the
           first time.
    2.2 -- Generates fewer views, less cropping in the info bar, and minor
           tweaks to bring it closer to standard TiVo menu behavior.
    2.1 -- Support for local file shares.
    2.0 -- Now presents itself as one app, generates its own menu, and uses
           config.ini to define streams.
    1.3 -- Rearranged to use the HME for Python package unmodified (except 
           for the port number and name in start.py, nee hmeserver.py).
    1.2 -- More graceful handling of some error conditions.
           Added C-SPAN and ResearchChannel.
    1.1 -- Added fps and samplerate to the VLC parameters (the TiVo can only
           accept certain values for these). Not needed for NASA TV, but for
           some other files/streams.
           The progress bar colors and sounds were not always being updated
    [Now hosted at wmcbrine.com.]
  2. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    I only have NASA TV at the moment; let me know if you'd like to see anything added. (Right now, I'm only looking for static URLs. Parsing RSS feeds etc. is the next step...)
  3. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    No suggestions?

    A couple of minor tweaks in this version.
  4. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    Unzip this and drop it in to add C-SPAN 1, 2 and 3. Sorry about the PQ.

    [file removed -- doesn't work with new versions, nor is it needed]
  5. dylanemcgregor

    dylanemcgregor New Member TC Club

    Jan 31, 2003
    Seems cool. If I ever get a S3/HD I'll have to remember to check it out.
  6. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    More graceful handling of some errors, and added the Research Channel.
  7. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    Drop-in package for CNN live video streams 1, 2, 3 and 4. Note that these don't correspond to any of their cable channels -- they do a separate web production. But that's a good thing, because there are no commercials. :)

    No icons this time.

    [file removed -- doesn't work with new versions, nor is it needed]
  8. fyodor

    fyodor New Member

    Sep 19, 2006
    Neat. I'm curious if there are plans for some sort of local file selector so that it can stream non-compliant files. Or would that mess with the current operation too much?

  9. Allanon

    Allanon Member

    Nov 2, 2005
    Been trying to get streams from http://www.americafree.tv to work but no luck. The stream plays in VLC but can't get your program to play them.

    Also under Windows XP VLC doesn't close when exiting a stream on the Tivo. If a new stream is then played the result is the requested VLC stream fails to open and the opened VLC stream is played.
  10. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    It's probably some attribute, such as the resolution, that's out of spec for the TiVo -- when I don't specify it, VLC uses the original when reencoding. I force the frame rate, the codec and the sample rate, but not everything.

    Edit: OK, it's not obvious to me what URL from there I would pass to VLC. What are you using?

    Works for me.

    Edit: I just double checked, and yeah, it's still working for me.
  11. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    New version -- just internal rearrangement. See if it works any differently for you. (It shouldn't, and it doesn't for me, but you never know.)
  12. Allanon

    Allanon Member

    Nov 2, 2005
    When trying the new version I get the following when running start.py in Windows XP:

    EDIT: Just noticed your latest build didn't include the .py files for the streams.

    EDIT: After adding the .py files for the streams I get the following error when trying to play a stream:

  13. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    I thought the zip file seemed a little small. :eek: Try it now.

    You can't use the old ones; they're done in a new way.
  14. Allanon

    Allanon Member

    Nov 2, 2005
    I fixed the VLC command window not closing problem by running a newer version of Python. I have both 2.4 and the latest version of Python installed but when double clicking on a .py file Windows launched Python version 2.4 instead of the latest. When launching with the latest version the VLC command window closed correctly.
  15. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    Hmm. Perhaps I should recommend 2.5 in the docs...

    How about this?

  16. Allanon

    Allanon Member

    Nov 2, 2005
    Here is the config I'm testing with:

    TITLE = 'SciFi'
    STREAM_URL = 'rtsp://video2.multicasttech.com/AFTVSciFiH2641000.sdp'
    from hmevid import VideoStreamer
    class Scifi(VideoStreamer):
        def startup(self):
            VideoStreamer.startup(self, TITLE, STREAM_URL, True)
    These are all the SciFi streams from smallest to largest:


    Also, when trying to use TITLE = 'AFTV SiFi' it failed when trying to play the stream, what is the criteria for the title and class name?
  17. wmcbrine

    wmcbrine Ziphead

    Aug 2, 2003
    None for the title. For the class name, just the usual Python rules.

    The class name is not derived from the title. You can specify it explicitly as you do the title:

    CLASS_NAME = 'Whatever'

    but if you don't, it's derived from the module name, capitalized. (The module name is the name of the directory, although you can also do it as "module.py".)

    Edit: OK, took a look at those streams. While VLC does play them (barely), I can't even get it to dump them to a file on disk. When watching live, I get a lot of breakup, stuttering, etc. They look about the same with MPlayer.
  18. Allanon

    Allanon Member

    Nov 2, 2005
    Most of the time the streams play fine for me in VLC but I have seen times where the video is unwatchable. Maybe their servers get overload at certain times of the day.
  19. Allanon

    Allanon Member

    Nov 2, 2005
    Here is a stream for PG24 which is a broadcast that covers online video gaming. It from the Czech Republic so it's not in English but if you like watching people play video games then you might like this stream.

    TITLE = 'PG24'
    STREAM_URL =  'rtsp://stream.pg24.tv/PG24-High'
    #STREAM_URL =  'rtsp://stream.pg24.tv/PG24-Medium'
    #STREAM_URL =  'rtsp://stream.pg24.tv/PG24-Low'
    from hmevid import VideoStreamer
    class Pg24(VideoStreamer):
        def startup(self):
            VideoStreamer.startup(self, TITLE, STREAM_URL, True)


    And Here is another stream for ReelGood TV:

    TITLE = 'ReelGood TV'
    CLASS_NAME = 'ReelGoodTV'
    STREAM_URL = 'rtsp://www.reelgood.tv/reelgoodtv'
    from hmevid import VideoStreamer
    class ReelGoodTV(VideoStreamer):
        def startup(self):
            VideoStreamer.startup(self, TITLE, STREAM_URL, True)


    Here are some streams from WPTV. They have other streams but they are not in English:

    TITLE = 'WPTV - Gaming'
    CLASS_NAME = 'WPTV_Gaming'
    STREAM_URL =  'mms://av.wp.pl/wptv-gry'
    from hmevid import VideoStreamer
    class WPTV_Gaming(VideoStreamer):
        def startup(self):
            VideoStreamer.startup(self, TITLE, STREAM_URL, True)
    TITLE = 'WPTV - Lifestyle'
    CLASS_NAME = 'WPTV_Lifestyle'
    STREAM_URL =  'mms://av.wp.pl/wptv-lifestyle'
    from hmevid import VideoStreamer
    class WPTV_Lifestyle(VideoStreamer):
        def startup(self):
            VideoStreamer.startup(self, TITLE, STREAM_URL, True)
  20. Allanon

    Allanon Member

    Nov 2, 2005
    Below is a stream that has multiple video tracks. Each track has a different video resolution. I can use the video track selector option in VLC's GUI to see the different tracks but I don't know how to select the video track from the VLC command line. Do you know how and can you add support for changing the VLC command line parameters in the .py stream file so the video track can be selected?


Share This Page