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.
Requirements:
- TiVo S3, HD or Premiere with 9.4 or later software
- Python -- 2.x only (2.6.x recommended)
http://python.org/
- VLC (0.8.6 recommended)
http://www.videolan.org/
Use:
- Unzip
- (Optional) Edit config.ini to point to your files
- Run start.py
- Go to the Music, Photos and More menu on your TiVo
Stop:
- 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.
Changes:
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
text.
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
C-SPAN.
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
used.
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
color.)
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
one.)
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.
Reorganized.
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
it.
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
correctly.

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]

__________________

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

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.

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?

Quote:

Also under Windows XP VLC doesn't close when exiting a stream on the Tivo.

Works for me.

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

__________________

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

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.

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?

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.

__________________

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

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.

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?

I guess some people will think this is the first useful version -- it now supports streaming your local files (and navigating through them) as well as Internet streams. See config.ini for some example file shares (commented out) -- basically, you use "dir" instead of "url" to specify them.

Local files can be transcoded, just like streams. I almost didn't include this, because it should really be done in a different way, rather than using a method designed for live streaming. You may miss a bit from the beginning, and the image may be messed up at first. But, it worked better than I expected, so I'm going ahead with it. (MPEG files won't have this problem -- files with an ".mpg" or "mp4" extension.)

__________________

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

I guess some people will think this is the first useful version -- it now supports streaming your local files (and navigating through them) as well as Internet streams. See config.ini for some example file shares (commented out) -- basically, you use "dir" instead of "url" to specify them.

Local files can be transcoded, just like streams. I almost didn't include this, because it should really be done in a different way, rather than using a method designed for live streaming. You may miss a bit from the beginning, and the image may be messed up at first. But, it worked better than I expected, so I'm going ahead with it. (MPEG files won't have this problem -- files with an ".mpg" or "mp4" extension.)

The way around this is to specify the datapath on the command line. I used an entry like this successfully:

Code:

[Movies]
dir=e:\home\movies
[Misc]
dir=e:\home\Desktop\misc

by invoking the program like this:

Code:

python start.py --datapath e:\

Alternatively, you can edit the "data_root = " line in start.py. The default datapath is "/", which should work for a single drive if you leave off the drive letter, and use slashes instead of backslashes in the config.ini. However, you can't have shares on multiple drives at the same time. You could work around that by using "join", or, preferably, by using a real operating system.

I know this is an area that needs work.

P.S. What exactly happens with the VLC nightly?

__________________

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

The app runs at 640x480. However, this only applies to the menus and overlays -- HD streams will play in HD.

I think the menus and overlays look pretty good as is (apart from some cropping in the info bar, which is fixed for the next release), and HD HME is just slightly harder to work with (you can't set a background color on a view larger than a certain size), so I haven't bothered in this case.

__________________

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