[mythtv-users] HTTP live stream and seeking in .25

Ian Bishop ibishop at gmail.com
Tue Mar 6 18:38:42 UTC 2012

> I'm not an expert but I have noodled around with streams a little and can
> pass on what I know. MythTV implements http streaming as originated by Apple
> which you can read about in their developer library document titled "HTTP
> Live Streaming Overview". At this moment the document lives here & I believe
> nearby is a link to a PDF.

Sweet, well that's what I wanted to hear!  I would expect the native
Android video player to play nicely with the Apple-like stream.  I
just didn't want to dive in and waste a bunch of time to find out what
I wanted to do wasn't possible.  I guess I'll need to build up a .25
backend in a VM now.  :)

> The big picture goes like this: a server (MythTV in this case) encodes a
> video as a series of short clips, say 10 seconds long, and supplies clients
> with an "m3u8" file url containing the names of the segments. You retrieve
> each segment in turn and play them back to back so it's seamless to the
> user. If the list is open ended then it's considered to be an in-progress
> event and you have to periodically requery the m3u8 url for the current list
> of segments. As you might guess you can calculate the total length of the
> video by multiplying the segment duration by the number of segments and you
> can seek by dividing your desired position by the segment duration to get
> the segment number and using the remainder as an offset into that clip.
> In the previous paragraph I said "you" a few times but you personally don't
> have to get involved at such a low level. Software such VLC will take an url
> and do the grunt work. Or, in writing your own application you would embed a
> video widget supplied by your O/S and have it do the grotty stuff. I'm
> pretty sure you don't want to write your own widget, go with your OS's one.
> Typically a widget will take an URL and play it without further prodding but
> they also expose an api for you to query the current position, seek to a
> given offset, pause, resume, etc. Also, widgets supply an OSD so users can
> see where they're at and click arrows or a slider to move back and forth.
> Your job as a programmer then becomes slicing and dicing the list of media
> offered up by mythtv, initiating streaming transcodes, and handing off m3u8
> urls to your embedded player.
> That's a fairly breezy introduction but hopefully gets you oriented. It's
> really not very complicated but there are several moving parts and at first
> it's hard to tell where one ends and the other begins.
> Assuming you're running a recent master you can get a decent education by
> kicking off a stream and examining the entrails. Start by defining a
> directory for the "Streaming" storage group (mythtv-setup -> Storage
> Directories) and then starting a stream. In that folder you'll find the
> expected m3u8 file but also an html file which shows how you might play a
> stream in a browser. An Android application would be conceptually similar.
> Aside from the video clips everything in that streaming directory will be
> text files so snoop and learn.
> - George

Sounds straightforward.  Thanks again for the help!


More information about the mythtv-users mailing list