# Video Streaming in HME



## wmcbrine

I mentioned this in the "HME for Python" thread, but it deserves its own.

With the release of 9.4 software, HME can now do streaming video on Series 3/TiVo HD. TiVo hasn't published specs for this yet, but here's what I've found so far.

Basically, you create a stream as you would for an MP3, and then set the resource of a view to that stream. Normally you'd use the root view, but you can use any view. The stream is not resized to fit the view, but cropped (i.e., the view acts as a window on the stream). The stream is displayed according to the system's aspect ratio settings, with respect to the full screen (and then the view, if smaller than the screen, takes a portion of this). The stream appears to be displayed at the system's output resolution, not the HME resolution.

MPEG-4 (as used in the YouTube app) and MPEG-2 (traditional TiVo material), at least, are supported. Since MPEG-2 works, perhaps this feature (although not the YouTube app) will even be available on Series 2's in the future.

Any kind of HME graphics can be displayed over the video.

Here's a trivial app to do a video stream using HME for Python:



Code:


import hme

TITLE = 'Video Test'
CLASS_NAME = 'VidTest'

class VidTest(hme.Application):
    def startup(self):
        stream = hme.Stream(self, 'http://%s/vidtest/test.mp4' % 
                            self.context.headers['host'])
        self.root.set_resource(stream)


----------



## jbcooley

wmcbrine said:


> I mentioned this in the "HME for Python" thread, but it deserves its own.
> 
> With the release of 9.4 software, HME can now do streaming video on Series 3/TiVo HD. TiVo hasn't published specs for this yet, but here's what I've found so far.
> 
> Basically, you create a stream as you would for an MP3, and then set the resource of a view to that stream. Normally you'd use the root view, but you can use any view. The stream is not resized to fit the view, but cropped (i.e., the view acts as a window on the stream). The stream is displayed according to the system's aspect ratio settings, with respect to the full screen (and then the view, if smaller than the screen, takes a portion of this). The stream appears to be displayed at the system's output resolution, not the HME resolution.
> 
> MPEG-4 (as used in the YouTube app) and MPEG-2 (traditional TiVo material), at least, are supported. Since MPEG-2 works, perhaps this feature (although not the YouTube app) will even be available on Series 2's in the future.
> 
> Any kind of HME graphics can be displayed over the video.


This is great. Thanks a lot. Look for a new release of my .NET sdk soon.


----------



## wmcbrine

For me it didn't require any updates, although I'll probably update the documentation (and I have a lot of changes to hmeserver, but that's nothing to do with this).


----------



## wmcbrine

Multiple simultaneous streams: Does not work. (I didn't expect it to, but it was worth a try.)

Completed video streams return a resource status of 11, an undocumented value.

The TiVo makes a second request for the stream after it's already started playing it, then immediately aborts the second request. I don't know why yet.


----------



## Allanon

Will this work with .tivo files?


----------



## wmcbrine

No. You'll have to unwrap them to plain MPEG-2 first.


----------



## Allanon

Here is my code:


Code:


import hme

TITLE = 'Video Test'
CLASS_NAME = 'VidTest'

class VidTest(hme.Application):
    def startup(self):
        self.stream = hme.Stream(self, 'http://%s/vidtest/test.mp4' % 
                            self.context.headers['host'])
        self.root.set_resource(self.stream)


    def handle_key_press(self, code, rawcode):
        if code == hme.KEY_PLAY:
            self.stream.play()
        
        if code == hme.KEY_PAUSE:
            self.stream.pause()

        if code == hme.KEY_REVERSE:
            self.stream.set_speed(-3)
        
        if code == hme.KEY_FORWARD:
            self.stream.set_speed(3)

The video goes fast forward nice and smooth but rewind is very choppy. Any ideas why? Is my code OK?


----------



## wmcbrine

I see the same thing in the YouTube app. I think it's just what you can expect with MPEG-4. TiVo-sourced MPEG-2 reverses a bit more smoothly.

And yes, your code looks fine. 

Now we just need to figure out how to get it to start up faster (as the YouTube app does), and ideally, how to get rid of the second request (or at least why it's there).


----------



## jbcooley

The youtube app supports three levels of fast forward and three levels of reverse. I can only get speeds of +3 and -3 to work reliably. Any ideas on what value tivo is using for the other speeds?

Any ideas about the time bar at the bottom? Is this something we have to simulate in the app or is hme providing that in some undiscovered part of the protocol?


----------



## wmcbrine

You'd have to draw the bar yourself; however, the position data is provided in resource info events.


----------



## jbcooley

wmcbrine said:


> You'd have to draw the bar yourself; however, the position data is provided in resource info events.


I was hoping that the bar could be drawn using system styles. I'd received the system events, I just didn't want to have to draw the progress bar.


----------



## wmcbrine

That's not the kind of thing that HME provides.


----------



## jbcooley

wmcbrine said:


> That's not the kind of thing that HME provides.


I'd say that's only true because it doesn't provide that feature. It does provide the standard sounds. Since it hasn't provided video support in the past, I just wondered if they had added that as a standard UI feature.

I guess I should have taken the hint from the absence of a standard progress bar for mp3s.


----------



## s2kdave

jbcooley said:


> I'd say that's only true because it doesn't provide that feature. It does provide the standard sounds. Since it hasn't provided video support in the past, I just wondered if they had added that as a standard UI feature.
> 
> I guess I should have taken the hint from the absence of a standard progress bar for mp3s.


I made a playbar component which does what you want in bananas-plus.


----------



## jbcooley

s2kdave said:


> I made a playbar component which does what you want in bananas-plus.


Thanks for the offer, but I'm going to have to work that out for myself due to licensing and language differences. I've got my own .net hme sdk that I need to get working. I've gotten initial support for streaming video done, but wanted to see if there were any additional known parameters for the streaming video.

I'll probably come back and do my own take on bananas once I get my application hosting service done.


----------



## wmcbrine

jbcooley said:


> I'd say that's only true because it doesn't provide that feature. It does provide the standard sounds.


But it doesn't provide any complex (or "themed") visual elements, at all. For the Java people, that's all in the Bananas library, which just copies the system elements (it doesn't _access_ them). A progress bar falls squarely in that area. To add such a thing to HME would, IMHO, be a more radical change than adding video streaming.

I'm not saying it's a bad idea, just that there's no reason to expect it.


----------



## perrce

wmcbrine said:


> The TiVo makes a second request for the stream after it's already started playing it, then immediately aborts the second request. I don't know why yet.


For what it's worth, I just noticed that getStream() is being called twice for MP3's as well. I assume it's related.


----------



## s2kdave

perrce said:


> For what it's worth, I just noticed that getStream() is being called twice for MP3's as well. I assume it's related.


This is because it's parsing the header info when it's an mp3 file so it can pass the duration with the first request. It immediately closes the stream after that though. it's all done in the Factory class.


----------



## wmcbrine

jbcooley said:


> The youtube app supports three levels of fast forward and three levels of reverse. I can only get speeds of +3 and -3 to work reliably. Any ideas on what value tivo is using for the other speeds?


According to uk.tivo.com, the regular trick play speeds are 3x, 18x and 60x.


----------



## perrce

wmcbrine said:


> MPEG-4 (as used in the YouTube app) and MPEG-2 (traditional TiVo material), at least, are supported.


Does the support of MPEG-4 video have any implications for the support of MPEG-4 audio (i.e. AAC)? In other words, could AAC audio be played through the MPEG-4 decoder? Or is AAC a whole different issue?


----------



## jbcooley

wmcbrine said:


> According to uk.tivo.com, the regular trick play speeds are 3x, 18x and 60x.


Thanks. I had also found the numbers 3x, 15x, and 60x in the music sample. Still only the 3x works smoothly. Of course, this result is only with one video file I didn't encode. So part of the smoothness (or lack of) in fast foward may due to the file.

In testing fast forward and normal playback, I noticed two new resource status codes - 11 and 12. 11 seems to happen when you near or hit the end of a playing video stream and 12 occurs when you hit or near the end of a video stream while you are fast forwarding. Have you seen these status codes?


----------



## wmcbrine

jbcooley said:


> In testing fast forward and normal playback, I noticed two new resource status codes - 11 and 12. 11 seems to happen when you near or hit the end of a playing video stream and 12 occurs when you hit or near the end of a video stream while you are fast forwarding. Have you seen these status codes?


I mentioned 11 in post #4, above. I had not yet noticed 12, but I can confirm it now.


----------



## Allanon

I was watching the HD Quicktime version of Systm using the code I posted above. The program plays fine for about 10 minutes then it crashes. When starting it again and then fast forwarding back to the spot it crashed I was able to watch another 10 minutes until it crashed again. Does this happen to others? Do you know the cause?


----------



## wmcbrine

New finding: Although the TiVo ignores the MIME type, it pays attention to the file extension in the URL. Bad!

Edit: ...but you can override that by specifying the MIME type in the CMD_RSRC_ADD_STREAM. It follows that one, just not the one in the HTTP headers.


----------



## wmcbrine

Allanon said:


> The program plays fine for about 10 minutes then it crashes.


I think what you're seeing is the standard HME idle timeout. Try adding this:



Code:


    def handle_idle(self, idle):
        return True


----------



## wmcbrine

OK, here's a slightly better player app, that supports all the trick play commands (except skip to tick), and makes the appropriate sounds. It also sends a lot of debug output to the console. No on-screen status bar yet, though. Requires HME for Python 0.13 or later.


----------



## moyekj

wmcbrine said:


> OK, here's a slightly better player app, that supports all the trick play commands (except skip to tick), and makes the appropriate sounds. It also sends a lot of debug output to the console. No on-screen status bar yet, though. Requires HME for Python 0.13 or later.


 Very cool stuff indeed and great job on getting this going. I got this working with mpeg2 and some sample h.264 videos. Will be great once a visual position indicator can be added.

Is there a way to make a graceful left arrow exit out of the vidtest application? I've got to resort to Tivo Central right now to exit, then find my way back to MPP&M screen again.
EDIT: Never mind I simply added the following to handle the left arrow to exit:


Code:


    def handle_key_release(self, keynum, rawcode):
        if keynum == hme.KEY_LEFT:
            self.sound('left')
            self.active = False


----------



## wmcbrine

Here's a version with a progress bar. (It's more like a YouTube bar then a TiVo bar, but anyway.) I had a hard time with the autoclear, and it's still not quite right. I also added a "Loading" indicator at startup, since I don't yet know how to shorten that delay.

BTW, as you can see in this program, multiple views can point to the same video stream.


----------



## moyekj

wmcbrine said:


> Here's a version with a progress bar. (It's more like a YouTube bar then a TiVo bar, but anyway.) I had a hard time with the autoclear, and it's still not quite right. I also added a "Loading" indicator at startup, since I don't yet know how to shorten that delay.
> 
> BTW, as you can see in this program, multiple views can point to the same video stream.


 Very nice improvements. Are you going to be looking at a video file selector at some point (instead of hardcoding a video inside the code itself)? Is the long term plan to integrate this as part of pyTivo or do you see development continuing on this "proof of concept" app? Thanks again for your hard work on this. I'm not familiar at all with Python but I do work with software quite a lot and have dabbled quite a bit with 3rd party apps for ReplayTV and more recently Tivo.


----------



## wmcbrine

moyekj said:


> Very nice improvements. Are you going to be looking at a video file selector at some point (instead of hardcoding a video inside the code itself)?


Something like that...



> _Is the long term plan to integrate this as part of pyTivo_


No. Although I still want to try to get pyTivo working with MPEG-4, which is a separate issue.

Here's version 3 -- in the last one, I was exiting on any status code >= 8 (copied from TiVo's SDK doc, although they were referring to MP3), which turned out to be a mistake, since status 9 (complete) is sometimes returned when the stream is finished buffering.


----------



## wmcbrine

So, the progress bar in that version wasn't too legible on a light background, even with the shadows. I think this is better (as well as simpler). I also tried to implement frame-by-frame, but it doesn't work very well. (Although it works better than the last one, which crashed if you pressed ff or rewind while paused.)


----------



## moyekj

I just tried out a couple of HD mpeg2 files (originally recorded on 1 of my S3s) and found that the streaming speed is not fast enough to play in real time and as soon as playback catches up to the buffer this HME app exits (and I'm thrown out to Tivo Central).

Is there a way to catch that condition and pause playback to allow buffer to build up?

EDIT: Simple way to force the issue quickly is to FF. As soon as you catch the end of buffer you are thrown out.


----------



## wmcbrine

I'm not sure I can distinguish between running out of buffer, and just coming to the end of the stream. Of course you can disable both, by taking out the "self.active = False" line in handle_resource_info().
----
I just got my first TiVo reboot as a result of using this. 
----
I can't decide if I prefer the white parts of the progress bar transparent or opaque...


----------



## moyekj

wmcbrine said:


> I'm not sure I can distinguish between running out of buffer, and just coming to the end of the stream. Of course you can disable both, by taking out the "self.active = False" line in handle_resource_info().


 For lack of a better solution right now I implemented a pause in place of "self.active = False" which works pretty well. i.e. Use the following in it's place: self.change_speed(0)
As a bonus the way the code is right now once you exceed the buffer and enter pause state the progress bar is displayed and updated so you can watch the buffer building up.

P.S. I also tried implementing such that 'Info' button would display the name of the video file being streamed, but making the info text time out after a few seconds seems harder than it should be. I ended up having to mimic how you are doing it for the progress bar time out (self.send_key(hme.KEY_TIVO) etc).


----------



## wmcbrine

- Finally got autohide working right.
- Adopted moyekj's suggestion -- go to pause when hitting the end of the buffer/stream, and sound the "alert".
- Slow motion. 1/2, 1/4 and 1/8 all seemed to work (others may, too); I picked 1/8. Anyone know what it is in regular TiVo playback?
- Experimentally, since I'm not drawing the little triangles, I'm trying color as an indicator of forward/reverse speed. It's red-shift/blue-shift, getting redder the faster you go forward and bluer the faster you rewind. Let me know what you think.


----------



## moyekj

wmcbrine said:


> - Finally got autohide working right.
> - Adopted moyekj's suggestion -- go to pause when hitting the end of the buffer/stream, and sound the "alert".
> - Slow motion. 1/2, 1/4 and 1/8 all seemed to work (others may, too); I picked 1/8. Anyone know what it is in regular TiVo playback?
> - Experimentally, since I'm not drawing the little triangles, I'm trying color as an indicator of forward/reverse speed. It's red-shift/blue-shift, getting redder the faster you go forward and bluer the faster you rewind. Let me know what you think.


 I think the color coding is a good idea. The only big piece missing now is a file browser of sorts built into the HME app so one can select a video file to play. Is that something doable without a monster amount of code? I can take a stab at it but won't bother if you already have something in mind.

Also, do you use the Java Simulator for testing purposes? It would be nice to have a way to write code and test it away from the Tivos. I think it's possible but just wanted to check with you what you do.


----------



## wmcbrine

moyekj said:


> The only big piece missing now is a file browser of sorts built into the HME app so one can select a video file to play. Is that something doable without a monster amount of code?


Eh, it wouldn't be particularly difficult, but it would be a fair bit of code, yeah. Mainly because I don't have anything like Bananas yet...

I'm actually more interested in doing a video podcaster. (There's no reason that URL in the Stream() initializer needs to point back to the HME server.)



> _Also, do you use the Java Simulator for testing purposes?_


I've used it, but not for this. It doesn't support video.


----------



## moyekj

Gotcha, and yes I realize streaming can be from any URL and not just localhost. I'm intrigued with the idea of using it locally for a bunch of recordings I have on an external drive attached to my PC. One nice feature is that it would be trivial to setup the remote numbers to jump different intervals of time forwards and backwards. It's possible even to program arbitrary skip forwards and back like ReplayTV supported: i.e. "15, ->" would jump 15 minutes ahead and "15, <-" would jump 15 minutes back.

Perhaps I'll take a look at implementing some kind of rudimentary file browser with perhaps just a single folder as a starting point. Not having any Python experience won't help. Perhaps I might have to look at the Perl HME module as I've got a lot of Perl experience. I'd think I'd rather try it in Python before Java...


----------



## moyekj

FYI I ended up implementing this using Java. It's still a work in progress but I have rudimentary file browser for video file selection (on local server machine) and of course the video streaming with the trick play functions. I still need to add a progress bar of some sort and a lot of code cleanup. It was nice to take advantage of BList class in bananas toolkit for the file selection portion.
I'm really loving this video streaming capability*. Very special thanks to wmcbrine for figuring this out!!

*NOTE: Technically this is not true streaming as one still cannot jump ahead of the buffer in the stream which is possible in true video streaming.


----------



## AbMagFab

Any update on this? I'd love to try one that can support file-selection.

We should be able to get full directory browsing as well now, right? Finally, we might get Tivo to be a real media player after all? Could it be true?


----------



## moyekj

AbMagFab said:


> Any update on this? I'd love to try one that can support file-selection.
> 
> We should be able to get full directory browsing as well now, right? Finally, we might get Tivo to be a real media player after all? Could it be true?


 Right now in my prototype version it looks for files of certain extensions I defined in the same folder where you start the server. It also includes any folders and you can descend into folders as deep as you like to search for more.
In the future I plan to setup a little config file where you can pre-define 1 or more directories and the entry screen would be the list of pre-defined directories.
Once I clean up and test my Java prototype a little more I can make it available to others to try out if anyone is interested (assuming I can figure out an easy way to release as a single jar file).


----------



## AbMagFab

moyekj said:


> Right now in my prototype version it looks for files of certain extensions I defined in the same folder where you start the server. It also includes any folders and you can descend into folders as deep as you like to search for more.
> In the future I plan to setup a little config file where you can pre-define 1 or more directories and the entry screen would be the list of pre-defined directories.
> Once I clean up and test my Java prototype a little more I can make it available to others to try out if anyone is interested (assuming I can figure out an easy way to release as a single jar file).


Put me on the list for testing...


----------



## Allanon

Here is a video player that has a scrolling file selector. To use just unzip in to 'c:/' for windows and set the HME server's basepath to 'c:/'. The default video folder is '/videos/' but you can change it by modifying VIDEO_PATH. You can also modify the background and selection bar by editing or changing the bg.jpg and select.jpg file. You can change the colors of text by changing TEXT_COLOR and SELECT_TEXT_COLOR.

I still need to add a display bar but that is on the todo list. Just use UP and DOWN to scroll through the video filenames and press SELECT to play the file. You can PAUSE, STOP, FAST FORWARD, and REWIND. Use LEFT to get back to the video filename menu. 

Also, please excuse the messy programming, I'm new to Python so it is probably a mess and can be done a lot cleaner.


----------



## turnipsun

Allanon said:


> Here is a video player that has a scrolling file selector. To use just unzip in to 'c:/' for windows and set the HME server's basepath to 'c:/'. The default video folder is '/videos/' but you can change it by modifying VIDEO_PATH. You can also modify the background and selection bar by editing or changing the bg.jpg and select.jpg file. You can change the colors of text by changing TEXT_COLOR and SELECT_TEXT_COLOR.
> 
> I still need to add a display bar but that is on the todo list. Just use UP and DOWN to scroll through the video filenames and press SELECT to play the file. You can PAUSE, STOP, FAST FORWARD, and REWIND. Use LEFT to get back to the video filename menu.
> 
> Also, please excuse the messy programming, I'm new to Python so it is probably a mess and can be done a lot cleaner.


Allanon, I just sent you a PM.. please contact me.

Thanks,
Chris


----------



## fyodor

> *NOTE: Technically this is not true streaming as one still cannot jump ahead of the buffer in the stream which is possible in true video streaming.


What does this mean, exactly? If you want to start in the middle, you have to wait for it to buffer half the movie?

Thanks much!
F


----------



## jbcooley

fyodor said:


> What does this mean, exactly? If you want to start in the middle, you have to wait for it to buffer half the movie?
> 
> Thanks much!
> F


You could probably build an application that served only half the file*. But it's not part of the protocol.

*I don't think cutting the file in half actually works, but some other transformation that performed a similar function could work.


----------



## moyekj

fyodor said:


> What does this mean, exactly? If you want to start in the middle, you have to wait for it to buffer half the movie?
> 
> Thanks much!
> F


 That's right, I haven't found a way to jump beyond the buffer yet, though I haven't looked very hard. I saw briefly something in HME about an ILookAheadBuffer class but not sure what that is about but I doubt it's what we want.

P.S. I made excellent progress today with my Java app (added status bar and have all trick play functions working) and will try to release 1st version maybe tomorrow.


----------



## fyodor

Neat program-I noticed that you included other file types .divx, wmv, etc, in the recognized formats. Is the hardware capable of playing these formats? I couldn't get anything other than mpg files to play.

Thanks
F



Allanon said:


> Here is a video player that has a scrolling file selector. To use just unzip in to 'c:/' for windows and set the HME server's basepath to 'c:/'. The default video folder is '/videos/' but you can change it by modifying VIDEO_PATH. You can also modify the background and selection bar by editing or changing the bg.jpg and select.jpg file. You can change the colors of text by changing TEXT_COLOR and SELECT_TEXT_COLOR.
> 
> I still need to add a display bar but that is on the todo list. Just use UP and DOWN to scroll through the video filenames and press SELECT to play the file. You can PAUSE, STOP, FAST FORWARD, and REWIND. Use LEFT to get back to the video filename menu.
> 
> Also, please excuse the messy programming, I'm new to Python so it is probably a mess and can be done a lot cleaner.


----------



## Allanon

I wasn't sure exactly what formats would play so I just included a lot of video extensions so I could try them all. I got MP4 and MP3 to work and I tried a h.264 MOV file but it didn't play. I really haven't tested other file formats.


----------



## wmcbrine

Allanon said:


> I tried a h.264 MOV file but it didn't play.


It will probably work; it's just the ".mov" extension the TiVo doesn't like. Try renaming it to end in ".mp4", or add the parameter 'video/mp4' after the URL in the Stream() call.


----------



## moyekj

OK, here's the 1st release of my Java based application. For lack of a better place to host I created a new Google project. I plan to post the Java source code there as well once this matures a little more and I have more chance to clean up comments and formatting. The zip file below contains everything packaged as a single Java jar file and there's also convenience run_win.bat and run_unix.sh scripts for starting the program included.
Download:
http://tivostream.googlecode.com/files/tivostream_v0p1.zip

Instructions:
http://tivostream.googlecode.com/files/README.txt

I've tried this both on Windows XP SP2 and a Linux RHE 4 machine (running a fairly recent Java 1.6).
All feedback welcome. I'll probably start a thread in the main Tivo Forums HME area on this.


----------



## Allanon

Do you think this video streaming could be made to work with streaming video off the Internet such as NASA TV? I know Galleon is able to stream Shoutcast radio, would streaming Internet video possibly work the same way? Or possibly make it work with a video stream from VLC which can convert the streaming Internet video to the correct format before streaming it to the Tivo.


----------



## wmcbrine

Allanon said:


> Do you think this video streaming could be made to work with streaming video off the Internet such as NASA TV?


NASA was one of the first things I wanted to try, but it's a bit difficult to get a real URL for a stream -- and once I did, I couldn't even get MPlayer to dump it to a file I could test with. So I put that aside... I've been able to play directly from Revision3.com, but I'm not sure if that counts as "streaming", since this was from the "download" links. 

Edit: OK, I've got NASA streaming, with VLC. Unfortunately I can't get VLC to grab the MP4 stream, which the TiVo might be able to handle directly, so I'm reencoding the WMV stream to MPEG-2. Now to see if I can fix the problems I'm having with the sound being out of sync and dropping out...

Edit 2: OK, got that sorted. I'll see about packaging up my solution properly; meanwhile, here's how to emulate it:

1. Grab http://www.nasa.gov/55644main_NASATV_Windows.asx

2. Start VLC -- my command line is:


Code:


vlc *.asx --sout "#transcode{vcodec=mp2v,acodec=a52}:standard{access=http,dst=192.168.1.12:8080,mux=ps}" --packetizer-mpegvideo-sync-iframe --sout-transcode-audio-sync

(192.168.1.12 is my computer's LAN address.) Probably you can just pass the URL directly to VLC instead of the .asx file.

3. Change the Stream initializer line in my vidtest app to:


Code:


        self.stream = hme.Stream(self, 'http://192.168.1.12:8080/',
                                 'video/mpeg')

I should probably add my latest version of vidtest -- the only change is that it switches the display from minutes:seconds to hours:minutes once the duration goes over an hour. It's also already got the URL shown above.

Edit 3: The sound still goes out of sync occasionally. You can fix it by pausing, waiting until the video actually stops, and then unpausing.

Edit 4: Using mpga instead of a52 as the audio codec seems to help.

Edit 5: Some better-quality streams:

http://playlist.yahoo.com/makeplaylist.dll?id=1368162
http://playlist.yahoo.com/makeplaylist.dll?id=1368570
http://playlist.yahoo.com/makeplaylist.dll?id=1368163


----------



## Allanon

Using your instructions I was able to get NASA TV streaming. I used MP1V and MPGA mainly because VLC crashed for some reason when using MP2V but I didn't see any out of sync audio when using those settings.


----------



## moyekj

New version posted with improvements to status bar and error handling (a message is displayed if there is an error when Tivo tries to play a stream and file existence checks now in place):
http://tivostream.googlecode.com/files/tivostream_v0p2.zip


----------



## bradleys

This is really great... 

A couple of items on my dream list! 

1. I would love to see this work for .tivo files. Takes my video server from an archive location and turns the whole unit into a true Media center! Very cool.

2. Play Netflix content. Harder, I understand but very cool.

With these two apps, my TIVO would imediately become significantly more powerful. The ability to stream is wonderful... I cannot wait to get back to work on Monday and poo poo my co-workers windows media center environment!


----------



## wmcbrine

wmcbrine said:


> I'll see about packaging up my solution properly


Posted here now. It handles starting and stopping VLC as needed.


----------



## fyodor

Neat. Can this be configured to stream locally stored files in non-compatible formats?



wmcbrine said:


> Posted here now. It handles starting and stopping VLC as needed.


----------



## wmcbrine

Well, it could, but there's no file selector yet. If you had one particular file you wanted to stream, you could just make a module like so:

STREAM_URL = yourfilename
NEEDS_VLC = True

from hmevid import *


----------



## fyodor

Gotcha-it's nothing in particular.I just imagine that it would be useful to be able to play other nonsupported file formats. I found that some of my old SageTV recordings (MPG) don't play back correctly, so it would be useful to have VLC transcode it to a compliant format.



wmcbrine said:


> Well, it could, but there's no file selector yet. If you had one particular file you wanted to stream, you could just make a module like so:
> 
> STREAM_URL = yourfilename
> NEEDS_VLC = True
> 
> from hmevid import *


----------



## Rose4uKY

I know this is a few months old thread but I downloaded the zip and I have videos in my videos folder but then inside that folder are other folders like one says new camera videos and old camera videos. I saw where it said streaming video and I saw my videos in the main folder but when I saw the folder that said other videos I clicked on it and nmow I have blank screen and my Tivo is locked up. My remote wont do anything so I am going to reboot. Do I need to just have all my vidoes in one folder and not seperate folders? I followed the directions and saw the Tivo Streaming at the bottom. I have videos I took from my digital camera at concerts and of local bands that I would like to watch on my TV. I have several posted on You Tube and have done that but this sounds so much easier if I can get it to work. I am rebooting now I hope it doesn't lock up again. But maybe I need to just play what's in the video folder and no the folder inside a folder. Should I have kept the black window open with all the debug info stuff? Cause now I rebooted and don't have the streaming icon anymore on my Tivo. 

I haven't been here in a while and my Tivo desktop told me there is an upgrade so I came here to read up on it before I got it and found this thread. Thanks, Rose

Edit: Ok I tried it again and I played a couple videos really cool. They have to be MPEG though right? Cause all the videos my digital camera takes are MVI so do I need to convert them? My Roxio has an MPeg 4 option so I am trying that. But it's working now. I just didn't wait long enough for these other folders to pop up earlier and then when they did pop up it said nothing is in there but now I know why there not MPEG. But this is still a neat program and I am going to convert all my videos if I have to.

Thanks, Rose


----------



## wmcbrine

It's not really clear to me what you did, but I think you should try HME/VLC (linked in my .sig) and/or tivostream (linked in moyekj's sig), and leave this thread for developers. It's really not intended for end-users.


----------



## Rose4uKY

That's ok I figured it out. I have Tivo Stream but I had several MVI videos and they weren't showing up. I need to convert them to Mpeg. I got it working now. It was slow at 1st and I didn't wait long enough and I thought it froze up so I rebooted. But now I know you have to wait. But thanks, it's working now so I am good..

Edit: Actually I took one of my MVI's and made it into Mpeg 4 and it wont play says error. Is it suppose to be Mpeg2?


----------



## moyekj

Rose4uKY said:


> That's ok I figured it out. I have Tivo Stream but I had several MVI videos and they weren't showing up. I need to convert them to Mpeg. I got it working now. It was slow at 1st and I didn't wait long enough and I thought it froze up so I rebooted. But now I know you have to wait. But thanks, it's working now so I am good..
> 
> Edit: Actually I took one of my MVI's and made it into Mpeg 4 and it wont play says error. Is it suppose to be Mpeg2?


 I suggest you read the tivostream documentation closely. Tivo currently only supports a certain kind of mpeg4, specifically H.264 video with AAC or AC3 audio in an mpeg4 container, and you need to run qt-faststart on the encoding.


----------



## Rose4uKY

I am all good now. I have an option to encode to that H624 but I did Mpeg 4 1st not knowing and it said MP4 on my Tivo with an error. Once I re did it to Mpeg 2 then on my Tivo it said .mpg like my ones that were working so everything is ok now and I am fine and it works converting my MVI'S to Mpeg 2 so thanks.


----------



## texaslabrat

Hey guys..I had an idea. Dunno if anyone's tried it yet..and apologies if it's been hashed out before (I didn't see anything in my perusal of the various threads on the subject)....but has anyone given any thought to the possiblilty that the 1.1GB buffer limit is a "default" buffer that's given, and that perhaps there is a way to specify an arbitrary sized buffer using the X-TiVo-Accurate-Duration (or other) MIME header? I'm not familiar enough with the code of any of the HME streaming apps out there yet to try and shoe-horn a custom MIME header in...but perhaps one of our esteemed code gurus could give it a shot (or at least shoot down the idea since it's already been tried). There's got to be a way to do it, since it seems *highly* probable that the Netflix stuff is built on the HME stack..and THAT app obviously doesn't have a 1.1GB buffer limitation. When I get some time, I'm planning on setting up a 2nd NIC on my server to sniff Tivo-Netflix traffic to see if there's any clues in the MIME headers that are being thrown back and forth (assuming it's clear text, anyway..but I can't imagine that they would waste the resources to SSL encrypt the stream...but I'll find out for sure when I do my sniff). Anyway...just a thought. I'd be very interested in hearing some folks' thoughts on the subject.


----------



## moyekj

texaslabrat said:


> Hey guys..I had an idea. Dunno if anyone's tried it yet..and apologies if it's been hashed out before (I didn't see anything in my perusal of the various threads on the subject)....but has anyone given any thought to the possiblilty that the 1.1GB buffer limit is a "default" buffer that's given, and that perhaps there is a way to specify an arbitrary sized buffer using the X-TiVo-Accurate-Duration (or other) MIME header? I'm not familiar enough with the code of any of the HME streaming apps out there yet to try and shoe-horn a custom MIME header in...but perhaps one of our esteemed code gurus could give it a shot (or at least shoot down the idea since it's already been tried). There's got to be a way to do it, since it seems *highly* probable that the Netflix stuff is built on the HME stack..and THAT app obviously doesn't have a 1.1GB buffer limitation. When I get some time, I'm planning on setting up a 2nd NIC on my server to sniff Tivo-Netflix traffic to see if there's any clues in the MIME headers that are being thrown back and forth (assuming it's clear text, anyway..but I can't imagine that they would waste the resources to SSL encrypt the stream...but I'll find out for sure when I do my sniff). Anyway...just a thought. I'd be very interested in hearing some folks' thoughts on the subject.


 A while back I tried guessing at several additions using ? separator, but no luck. If you do network sniffing that may be useful as it's a pain for me to have to pull out my old hub and my older laptop with Win XP to do the sniffing. If it's like YouTube it's likely most of it will be encrypted, but worth a shot anyway. With the 1.1 GB limitation this has made video streaming far less useful and I have halted all further development of tivostream as a result. I've asked for some pointers from Tivo but no help thus far.


----------



## wmcbrine

I have no doubt that the buffer can be manipulated. It would not be in the form of added parameters in the URL (that makes no sense), but in the CMD_RSRC_ADD_STREAM call. This command accepts additional parameters in versions of the HME protocol that postdate the last published spec. However, discovering what those parameters are is the hard part. As noted, all the apps that currently use these methods use encryption, so it's a bit trickier than regular packet sniffing (which is enough of a pain already). But it's not impossible.

Based on the behavior of the Netflix app, I suspect that it doesn't buffer at all. Or at least, it seems to discard old buffered material after playing it -- it might still cache what's coming up. It's quite weird.

And yes, this has been discussed already.


----------



## texaslabrat

wmcbrine said:


> I have no doubt that the buffer can be manipulated. It would not be in the form of added parameters in the URL (that makes no sense), but in the CMD_RSRC_ADD_STREAM call.


Ah, but that's not what I'm advocating...but rather with the MIME header (which is handed back as part of the http response header) that is discussed in the SDK for telling the tivo how long the stream is so that it can do a proper % played display. It was put in there for MP3s "back in the day" when they were the only thing the tivo could stream..but now that other media types are streamable it's possible that it is linked to the allocation of a stream buffer.



wmcbrine said:


> Based on the behavior of the Netflix app, I suspect that it doesn't buffer at all.


I disagree. Depending on your line speed, the netflix app will sit and buffer a little bit as a "look ahead" cache before it begins playing the stream. I do agree with your next statement, in that trick-plays do seem to discard the current buffer...and since virtually all fast forward and rewinds are handled as trick plays, there doesn't seem to be a need for an overly large buffer to be maintained. So, it's likely a round-robin database buffer like Live TV.

And, as you've mentioned...even SSL traffic is potentially vulnerable to the sufficiently crafty/motivated snooper. Once I get my hardware issues ironed out I'll let you guys know what I find out  It would be sweet if there's some kind of signal that the netflix server is handing the tivo to use some super-sekrit round-robin-database-style buffer. There's already an implementation of such a thing for the live tv buffer...so I don't see why they wouldn't leverage it for this purpose. Anywho..thanks for the input


----------



## wmcbrine

The part you've quoted in red was a response to moyekj, not you.


----------



## texaslabrat

wmcbrine said:


> The part you've quoted in red was a response to moyekj, not you.


oic...my apologies


----------



## davidblackledge

So I started playing with Video over my vacation after I posted my existing apps (installed CVS, too, so I can version control my releases)...anyhow...

moyekj, I'd like to share some stuff, personally... I like your filebrowser better than one I was using for some other stuff, and your trick bar is prettier than mine currently, although I think mine tries to support more state information. Any chance you'll release some pieces in their own jars like I do with my stuff? I actually haven't had a chance to download yours yet and try it out (I just now finally read that part of this thread and looked at your screenshots ;] )

Anyhow, main things I did: created a VideoView (BView subclass) for dealing with a Video stream, core remote handling, and its trick bar. It will be released in a separate jar file (maybe just my widgets package). Currently the trick bar is just text-based but it handles most everything and auto-hides. Controls already handle everything they should except skipping around (advance button in play or fast modes, instant replay button, and ff/rw in pause mode which does frame advance) - that's to come.
I currently am using .25 for slow mo, and +/- 2.0, 10.0, and 60.0 for ff/rw - I didn't read the thread closely to see if anybody had better recommendations (though I saw the 1/8 for slow-mo).
Doesn't handle end-of-stream issues nicely yet, but I did notice that the resource responds "pause" immediately before "unknown" when that happens, so that's something that can be detected.

What I built with it is a screen with a list of RSS feeds, each of which opens a list for that feed which displays the title/description of the feed item at the top of the screen (a bit like showcase stuff) [that RSSListScreen is going in my gadgets package], and selecting an item plays it in a VideoScreen which runs the VideoView and also does/will handle other Tivo-ish things like right-arrow/info to display the title and description of the current item (and left-arrow to end the video and show the listing again).
Currently the RSS Feed list is hardcoded, but I can easily put it in a properties file and maybe allow in-program editing. For now I'm trying to avoid tying it to my Mulittasker's features just because nobody appears willing to download all the jars ;] (I'll have to release a zip containing everything you need for TivoSolitaire in one package). Also because two of the major features are pictures and music which aren't useful in combination with a running video.

It's frustrating trying to find feeds that contain viewable videos since I'm not doing any converting... but I found some good sources via www.videopodcasts.tv - notably Vintage Video and Archive Classic Movies which are great ones for my wife ;].
I'm especially frustrated by ones that appear that they should work, but they don't... especially the major news networks.... in generally ones that say ".m4v" don't appear to work, and ".mp4" is a gamble. I haven't found any feeds that supply mpeg-2 format videos yet. Given the poor labeling of sources, I might even have to make VideoView accept mp3 files just to play the audio instead of complaining.

I didn't realize .mov is able to be in one of the supported video formats...I'll try some feeds with those at my next chance. I ignored a lot of feeds when I saw they used that suffix.

I'm trying to build more and more robustness into the network streams by pre-checking URLs for validity and content type before sending it to the TiVo since it doesn't deal terribly well with bad content.

- David.
(trying to up my post count to 10 so I can see links/images in signatures again... did they just turn that "feature" on here, or is it because I've got JavaScript turned off currently? oh well)


----------



## davidblackledge

Just FYI, Looks like I was wrong about the end-of-stream thing - it isn't working for me, currently... either my code is wrong (sensing pause-then-unknown), or my analysis was wrong... I'll try a few more things in that area when I get a chance. (Implemented something already, just haven't had a chance to try it out)

In the meantime, I implemented the skip around features (advance=30 second skip; ff/rw + advance = skip to (known)end/begin; pause + ff/rw = +/- one frame [except it's +/- 1ms right now...oops]; replay = back 8 seconds).
I also experimented with putting a text animation (spinning line: |, /, -, \ ) if it hasn't finished downloading yet. It's a little ugly... the "blue light" downloading icon would be better, I just need to change my bar to graphical.

Still haven't messed with the .mov format.

What's really frustrating is the error I get back when the stream doesn't work on the TiVo (e.g. bad format) just says something like "Error Code 6", text: "FFFFFF" - I guess I just need to catch Code 6 and make it pretty myself, I just wish they wouldn't put junk in the text field when there is no real message.

By the way... the Vintage Video feed sure has some bad conversions... mostly bad resolution, but some of them (at least 1) have blasts of static intermittently throughout in the audio as if they had a short in their audio equipment... I can't help but wonder if that's an issue with TiVo's interpretation of the stream, though...maybe there is extra information (like, dare I hope, captions) in the stream that TiVo is trying to play as audio?


----------



## davidblackledge

Bet you guys were just sitting back and laughing at the lazy guy who won't read the whole thread.

Ok, using +/- 3x, 18x, 60x, now. And my stuff about unknown vs. pause... that was because I forgot I called all states I wasn't handling unknown...including 11 and 12. Now it (should) handle them all very nicely.

I put RSRC_STATUS_END and RSRC_STATUS_BUFFER_OVERFLOW as constants in VideoView (and in MultitTaskerApplication which also has LIMIT constants for text render width/height)

For some reason my frame advance is still not reliable... even though I set it to 1000/30 which should be one 30fps frame.... of course it doesn't divide right, but should be close enough for two clicks to get it... at least one thing I tried it with didn't seem to response except when I hit play it was at a different spot. It wasn't the best video source, though.

And .mov... wasn't working for me, but that's at least partly because I was sending the wrong content type to the tivo...maybe it'll work now... but so far it doesn't seem to.

[Oh, and my comment about the 10 posts... it's not a problem from home, so it must be behavior that involves some blocked content whem I'm...not at home *ahem*.]


----------



## moyekj

For detecting end of play HME for mpeg4 files sends status=11 which is very handy. For mpeg2 though there is no indication (status=12 means current position caught up to end of buffer not end of playback). After a lot of ugly code trying to detect if buffer is advancing along with status=12 I gave up and took the easy way out using ffmpeg to discover length of a show before playback begins and using that information to properly detect end of playback for mpeg2. That works very well and only requires a quick call to ffmpeg before playback.

The 1.1 GB buffer limit is the single biggest problem left to be solved. I was thinking about writing code for mpeg2 playback to play back files > 1.1 GB in 1 GB chunks, starting a new stream with an offset once each 1 GB chunk completes. It's pretty ugly and only works for mpeg2 but I'm not sure what other workaround there is...

The other thing I'd really like to know is to discover the Netflix method of streaming (with no buffer on Tivo). David, if you have network sniffing capabilities that may be a handy thing to do some sniffing on though it's likely encrypted beyond comprehension.


----------



## JamieP

I've been investigating the 1GiB buffer limit from the inside out. I'm looking at messages in the tivo logs to try to better understand the code paths for the different kinds of streaming. Nothing terribly interesting to report yet, but here is what I know so far:

From perusing the logs, YouTube, tivostream and hme/vlc all go through similar code paths and use the TiVoClips "Partition" for their allocation (it's a logical partitioning of space -- not a true disk partition). Amazon and tivocast downloads go through similar code paths, but they allocate from the User "Partition". Netflix seems to be a completely different code path and doesn't attempt to buffer the entire recording as the other streaming methods do.

YouTube, tivostream and hme/vlc always allocate 1GiB. Amazon and tivocast downloads allocate the actual stream size. That at least gives some hope that there may be a way to specify the buffersize when initiating the transfer.


----------



## davidblackledge

Verrrry interesting, JamieP. I also am wondering about the "start" and "span" that get returned in resource events... start is 0 in my tests so far and span shows 0/n where n is the duration in seconds (not ms) - I would have hoped the 1 gig limit would just start indicating a different start and/or a different first number in the span. I don't think I've hit the 1 gig limit on my testing of web content. I scanned thread but can't find stuff I'm looking for on the limit - what is the actual behavior when you hit the limit? does it just act like the end of the movie? Does it send event 11 or 12? If the start/span DOES get updated maybe you just have to reset your position to account for the buffer...that'd be nice, but unlikely.
Also: anybody actually attempted texaslabrat's idea yet? It certainly makes a ton of sense.
The alternative is maybe the protocol was updated to allow additional info to get sent in the resource allocation command. That certainly makes sense, too.

By the way... I'm dealing with Network stuff myself and am having lots of "bad" streams, but have started exposing the errors more and have noticed two interesting things... trying to remember... one is I get a RSRC_ERROR_"Connection Failed" (I think) on a lot of my bad videos...notably my attempts to show a .mov file that I am supposedly sending to TiVo as "video/mp4". So maybe you get that if your content is bad for the given type. I haven't seen the RSRC_ERROR_UNSUPPORTED or RSRC_ERROR_INCOMPATIBLE...that'd be useful information. Maybe I haven't seen them just because I'm always passing in the content type, though.

The other is I am getting resource error code 11 (no documented constant name for that) when I get an error text of e.g. "Not Found (404)"...so I'm guessing 11 is something like RSRC_ERROR_HTTP_ERROR.

Question: has anybody tried a .tivo file, but sending the content type that TiVo reports in its XML interface? something like video/x-tivo-raw (but that's not it). I can post the actual string tonight or something if you need it.

moyekj: get me a Netflix subscription and I'll test that out for you 
(did I mention that I'm not only lazy, but cheap? for example: "Basic Plus" Analog cable, no HD TVs even though I have HD-capable TiVos... OK, I spent money on the TiVos...but that's it)
I also intend to never hack my tivos. Although I do crash them occasionally - lately I think that's been because of animated gifs.


----------



## moyekj

davidblackledge said:


> I don't think I've hit the 1 gig limit on my testing of web content. I scanned thread but can't find stuff I'm looking for on the limit - what is the actual behavior when you hit the limit? does it just act like the end of the movie? Does it send event 11 or 12? If the start/span DOES get updated maybe you just have to reset your position to account for the buffer...that'd be nice, but unlikely.


 Tivo closes down the stream as soon as the buffer limit is reached. You can continue playing stream to that point though.



> Question: has anybody tried a .tivo file, but sending the content type that TiVo reports in its XML interface? something like video/x-tivo-raw (but that's not it). I can post the actual string tonight or something if you need it.


 video/x-tivo-raw-tts is the actual mime. Haven't tried it but I doubt it will work in HME.
EDIT: Note that video/x-tivo-raw-tts would only apply to raw tivo files in transport stream format transferred to PC MRV style, not the normal TTG transfer.



> moyekj: get me a Netflix subscription and I'll test that out for you
> (did I mention that I'm not only lazy, but cheap? for example: "Basic Plus" Analog cable, no HD TVs even though I have HD-capable TiVos... OK, I spent money on the TiVos...but that's it)


 You can sign up for a free trial if you have never had service before. If you have had service before it's still cheap as you can sign up for the $8.99/month plan for 1 month.


----------



## wmcbrine

davidblackledge said:


> Question: has anybody tried a .tivo file, but sending the content type that TiVo reports in its XML interface? something like video/x-tivo-raw (but that's not it).


Yes. It doesn't work.


----------



## moyekj

texaslabrat said:


> Ah, but that's not what I'm advocating...but rather with the MIME header (which is handed back as part of the http response header) that is discussed in the SDK for telling the tivo how long the stream is so that it can do a proper % played display. It was put in there for MP3s "back in the day" when they were the only thing the tivo could stream..but now that other media types are streamable it's possible that it is linked to the allocation of a stream buffer.


So following up on this thought, perhaps adding addHeaders method to custom factory and adding something like the following may have an effect:


> ...
> http.addHeader("Content-Range", "bytes 0-" + (total-1) + "/" + total);
> ...
> super.addHeaders(http,uri);


In the hope that if total > 1GB it will override default buffer size allocation.
Haven't tried it, just postulating here to further the discussion.
Then as a quick test use a small number for total to see if the stream buffering stops quickly. I have a feeling that at best this may influence stream resource status returns and not affect the buffer size, but maybe it's worth a shot...


----------



## moyekj

I tried adding Content-Range, X-TiVo-Content-Range and X-TiVo-Accurate-Duration headers but they didn't seem to have any effect at all unfortunately.
I think the only hope is for someone to setup the network sniffing on Netflix and/or YouTube and see if there are any special headers being sent...


----------



## Allanon

I'm no expert at packet sniffing but I did find these packets that were sent from Google to the Tivo when playing a YouTube video:

*
mOfhE^2U
Pk:v
K^HTTP/1.1 302 Found
Location: http://td.vp.video.l.google.com/vid...zkrJNjHGVAHpaF2MoGD9LlbsOl3qUImVMV6ramM&rdc=1
Expires: Sat, 10 Jan 2009 10:49:12 GMT
Cache-Control: public,max-age=900
Date: Sat, 10 Jan 2009 10:34:12 GMT
Server: gvs 1.0
Content-Length: 0
Content-Type: text/html
Connection: Close*

*

mOfhEV/rH
Ptqk
BFKHTTP/1.1 206 Partial Content
Content-Type: video/mp4
Content-Disposition: attachment; filename=video.mp4
Last-Modified: Sat, 10 Jan 2009 09:27:00 GMT
Content-Range: bytes 0-16005445/16005446
Content-Length: 16005446
Expires: Sat, 10 Jan 2009 11:34:13 GMT
Cache-Control: public,max-age=3600
Date: Sat, 10 Jan 2009 10:34:13 GMT
Server: gvs 1.0
Connection: Close

[email protected])trak\[email protected] mdhdOPDUBhdlrsoun(C) 2007 Google Inc. v08.13.2007.minfsmhd$dinfdrefurl stbl[stsdKmp4aD'[email protected]"p(stscstsz"p=D+ufkwhVigoco`kqj`e[ZOHDJGF2G9*,00'--G.:.#)(5)$3(
*

When playing the same video from my computer to the Tivo using TivoStream, I found only this packet:

*
mOE[[email protected]@]R
xf
VGET /videostream/video.mp4 HTTP/1.1
Host: 192.168.0.22:7288
Range: bytes=0-
User-Agent: TvHttpClient
tsn: ############
Connection: close
*


----------



## moyekj

Allanon, thanks for the packet dumps. I added Content-Range & Content-Length headers but it didn't seem to make a difference. With my additions the request sent from PC-Tivo using tivostream becomes (using wireshark on my pc which doesn't require a hub since server is my pc):


Code:


HTTP/1.1 200 Media follows
Server: HttpServer
Content-Type: video/mpeg
Content-Range: bytes 0-1999999999/2000000000
Content-Length: 2000000000
Content-length: 0

These had no effect however. What is interesting is the "Content-length" header seems to be automatically added somewhere. When I add my own header (with lower case l for length) it appears before the 0 length header added automatically. I don't know if that has any effect anyway.

Since YouTube behaves same as our current implementation perhaps Netflix sniffing will be more valuable. Problem is for that I would need to set up my Hub which I'm now getting more inclined to do...


----------



## moyekj

OK, here's some dumps from Tivo/Netflix communications:


Code:


Tivo->Netflix
--------------
GET /s/d5/551/899495551.wmv?e=1231651648&h=9b149de2dbb08f15e422952f38ab723d HTTP/1.1
Host: netflix-551.vo.llnwd.net:80
Range: bytes=0-
User-Agent: TvHttpClient
tsn: xxxx
Connection: close

Netflix->Tivo
-------------
[email protected];4DOEkPw<\L)g-D
&HTTP/1.1 206 Partial Content
Server: Apache
Accept-Ranges: bytes
Content-Type: video/x-ms-wmv
Content-Range: bytes 0-1192634322/1192634323
Content-Length: 1192634323
Date: Sat, 10 Jan 2009 21:27:30 GMT
Last-Modified: Thu, 13 Nov 2008 10:46:31 GMT
Connection: close

Then a few seconds later:


Code:


Tivo->Netflix
-------------
!1E/@@kDOFPL(x"&
[GET /s/d5/551/899495551.wmv?e=1231651648&h=9b149de2dbb08f15e422952f38ab723d HTTP/1.1
Host: netflix-551.vo.llnwd.net:80
Range: bytes=1192594763-
User-Agent: TvHttpClient
tsn: xxxx
Connection: close

Netflix->Tivo
-------------
[email protected];0IDOFkP"L(P
[HTTP/1.1 206 Partial Content
Server: Apache
Accept-Ranges: bytes
Content-Type: video/x-ms-wmv
Content-Range: bytes 1192594763-1192634322/1192634323
Content-Length: 39560
Age: 1
Date: Sat, 10 Jan 2009 21:27:31 GMT
Last-Modified: Thu, 13 Nov 2008 10:46:31 GMT
Connection: close

Then a few seconds later, because when using Hub it slows everything down, there was a re-negotiation of stream quality and so I got:


Code:


Tivo-Netflix
------------
[email protected]@kDOEPK`N|
21GET /s/d5/551/899495551.wmv?e=1231651648&h=9b149de2dbb08f15e422952f38ab723d HTTP/1.1
Host: netflix-551.vo.llnwd.net:80
Range: bytes=6763-1192594762
User-Agent: TvHttpClient
tsn: xxxx
Connection: close

Netflix->Tivo
-------------
[email protected];ekDOEkPNK<H
12HTTP/1.1 206 Partial Content
Server: Apache
Accept-Ranges: bytes
Content-Type: video/x-ms-wmv
Content-Range: bytes 6763-1192594762/1192634323
Content-Length: 1192588000
Age: 5
Date: Sat, 10 Jan 2009 21:27:35 GMT
Last-Modified: Thu, 13 Nov 2008 10:46:31 GMT
Connection: close

I will add the "Accept-Ranges: bytes" header to see if that has any effect.


----------



## Allanon

> Content-Type: video/x-ms-wmv


Does that mean Tivo can play WMV files?

Also what is the Cache-Control used for?


----------



## wmcbrine

It can play a very restricted subset of WMV files -- just enough to support Netflix. moyekj has the details in his tivostreamer thread:



moyekj said:


> Video must be VC-1 Advanced Profile (WVC1 L2 or L3).
> Audio must be WMA2 2-channel Constant Bit Rate. Multi-channel or
> variable bit rate audio doesn't work, and WMAPro also does not work.
> i.e. Audio support is very limited.


----------



## moyekj

Allanon said:


> Does that mean Tivo can play WMV files?
> 
> Also what is the Cache-Control used for?


 Since 11.0x software yes, but a very limited subset, see tivostream documentation for details on what exactly works.


----------



## moyekj

Adding "Accept-Ranges: bytes" header did not seem to change any behavior and I don't see anything else related to buffer sizes in the Netflix/Tivo packet dump so I'm stumped...

I'm starting to suspect now that when tivo sees "video/x-ms-wmv" as video type the buffer length restriction of 1.1GB is lifted (maybe the headers on byte range etc. are considered for wmv but not other types). I shall have test that theory by generating a working wmv file > 1.1GB.


----------



## wmcbrine

Dude, how many times do I have to say this -- it's special parameters to the stream creation request in HME (which we haven't seen yet, due in part to the fact that it's encrypted, and of course undocumented). Not HTTP headers, and not MIME types. I'll put any amount of money on that you like.


----------



## moyekj

wmcbrine said:


> Dude, how many times do I have to say this -- it's special parameters to the stream creation request in HME (which we haven't seen yet, due in part to the fact that it's encrypted, and of course undocumented). Not HTTP headers, and not MIME types. I'll put any amount of money on that you like.


 You're likely most certainly right and you have a lot more insight into HME than most. I'm just attacking this from an angle we do have control over to eliminate the remote possibility that it may be something simple. If nothing else I'm helping to prove that you are right by not having any success.
One final input that seals it that this is the wrong path to go down: Streaming a .wmv file > 1GB with all headers similar to Tivo/Netfilx also stops streaming around 1.1 GB mark.

If there is anything in network sniffing that you feel may be of value to investigate please indicate.


----------



## mulscully

has anyone tried to get this to play HULU files? Beside the obsticle of knowing the stream url.. Maybe use the embed url.. But even if that works getting a list of the available streams and their embed urls would be the next problem..

just thinking outload....

Or even get stickam.com to work.. hmmmm...


----------



## Allanon

mulscully said:


> has anyone tried to get this to play HULU files?


HULU videos are FLV files so you can use one of the programs out their that can download the FLV file from HULU and then use wmcbrine's HME/VLC Video Streamer program to play the FLV file on the Tivo since VLC can transcode FLV files.


----------



## mulscully

right I guess that, but I am looking for the convience of browsing HULU from the couch and selecting the video.. I see that Boxee does it so was just wondering how we might get this app to work...


----------

