Video Streaming in HME

Discussion in 'Developers Corner' started by wmcbrine, Aug 1, 2008.

  1. Rose4uKY

    Rose4uKY Member

    495
    11
    Mar 28, 2003
    Kentucky
    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
     
  2. wmcbrine

    wmcbrine Well-Known Mumbler

    11,688
    805
    Aug 2, 2003
    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.
     
  3. Rose4uKY

    Rose4uKY Member

    495
    11
    Mar 28, 2003
    Kentucky
    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?
     
  4. moyekj

    moyekj Well-Known Member

    12,156
    808
    Jan 23, 2006
    Mission...
    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.
     
  5. Rose4uKY

    Rose4uKY Member

    495
    11
    Mar 28, 2003
    Kentucky
    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.
     
  6. texaslabrat

    texaslabrat New Member

    61
    0
    Oct 24, 2007
    Austin, TX
    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.
     
  7. moyekj

    moyekj Well-Known Member

    12,156
    808
    Jan 23, 2006
    Mission...
    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.
     
  8. wmcbrine

    wmcbrine Well-Known Mumbler

    11,688
    805
    Aug 2, 2003
    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.
     
  9. texaslabrat

    texaslabrat New Member

    61
    0
    Oct 24, 2007
    Austin, TX
    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.

    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 :)
     
  10. wmcbrine

    wmcbrine Well-Known Mumbler

    11,688
    805
    Aug 2, 2003
    The part you've quoted in red was a response to moyekj, not you.
     
  11. texaslabrat

    texaslabrat New Member

    61
    0
    Oct 24, 2007
    Austin, TX
    oic...my apologies :)
     
  12. davidblackledge

    davidblackledge Registered lÜser

    563
    36
    Sep 9, 2008
    NM
    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)
     
  13. davidblackledge

    davidblackledge Registered lÜser

    563
    36
    Sep 9, 2008
    NM
    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?
     
  14. davidblackledge

    davidblackledge Registered lÜser

    563
    36
    Sep 9, 2008
    NM
    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*.]
     
  15. moyekj

    moyekj Well-Known Member

    12,156
    808
    Jan 23, 2006
    Mission...
    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.
     
  16. JamieP

    JamieP Member

    991
    0
    Aug 2, 2004
    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.
     
  17. davidblackledge

    davidblackledge Registered lÜser

    563
    36
    Sep 9, 2008
    NM
    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 :p
    (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.
     
  18. moyekj

    moyekj Well-Known Member

    12,156
    808
    Jan 23, 2006
    Mission...
    Tivo closes down the stream as soon as the buffer limit is reached. You can continue playing stream to that point though.

    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.

    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.
     
  19. wmcbrine

    wmcbrine Well-Known Mumbler

    11,688
    805
    Aug 2, 2003
    Yes. It doesn't work.
     
  20. moyekj

    moyekj Well-Known Member

    12,156
    808
    Jan 23, 2006
    Mission...
    So following up on this thought, perhaps adding addHeaders method to custom factory and adding something like the following may have an effect:
    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...
     

Share This Page