in

andy vt's tools & blog

automating lazy

This Blog

Syndication

andy vt's blog

Media Broker - Streaming TV

Back in February I started thinking about what was the biggest missing piece of an all PC based Media Center solution.  I got thinking about this again after a recent post by Charlie Owen about how they could better document Microsoft's approach to the "Connected Home".  It's a great idea, but the scenarios listed are very telling in that he completely left off the multiple WMC home.

As much as I want to rant about how that doesn't make sense, that's not the point of this post.  The big thing that I couldn't do with the Media Broker idea was streaming tv content (live or recorded).  After some research this doesn't seem like a huge problem.  I've narrowed it down to two approaches.

  1. Windows Media Format: The same guys who provided a managed wrapper around DirectShow started doing the same thing with the Windows Media Format interfaces.  I've got a working sample that transcodes dvr-ms to wmv for broadcast, but because I'm targeting local network broadcast it would be more practical (unless you've got a quad core) to just stream the MPEG data using the library.  Fortunately MS provided access to most of the WMF interfaces in the WM ASF Writer DirectShow filter so it should be possible to do this.  Unfortunately I haven't been able to get it to work.  The biggest issue is setting the audio media type in the ASF profile.  If I ignore audio and just write the video (which does work without complaint), the file won't playback.  This is probably a codec issue, the SDK tells me to retrieve the codec info from the source header and write it to the target, but there isn't any codec info in the DVR-MS file.  The main benefit of this solution is everything necessary (except the glue) is on every Windows machine, and it could be free.  Assuming I can get it working, I'm hoping that the MC SDK could work with this solution easily.
  2. Third Party Streaming: This is definitely the easiest approach.  Elecard sells a couple filters that make this very easy, they even include a sample that can stream MPGs with AC3 audio in their SDK.  Some minor modifications should make it work for DVR-MS files.  The major drawback here is that I doubt that it could be free.  There are other issues, the main one is client graph construction (I don't know how to force MC to create the necessary graph).
Right now I'm just messing around; but I am curious what the different perspectives are out there on how useful something like this would be.

Comments

 

jelwood said:

I personally think this would be a great feature!  Webguide provides the streaming functionality, but it is only through a web browser (he is a Microsoft employee now, so if you asked how he overcame some of the issues, hopefully he would help).  If this would provide functionality to stream live tv or a show that is currently recording through the media center interface I think that would be a wonderful feature.  Personally I have Directv service and local cable service in my house (Directv is hooked up to my main MCE, and the local cable service is just running on my desktop pc).  To watch a show recorded on the local cable service (on my main tv) I’ve always had to wait until that show is completed before I can start watching it.  It sounds like this might overcome that limitation.

Do you know how much the Elecard filter would be?  If they work really well, I don’t think it would be bad to collect a fee for them.  Of course, the Webguide author might be able to help for a free solution because I don’t see any special filters he is using.

November 19, 2007 5:21 PM
 

babgvant said:

I'm almost positive that Webguide transcodes to wmv when streaming.  And given the audience he's targeting that makes perfect sense.  Surprisingly, that isn't much more difficult than just transcoding to a file (the asf writer uses a file sink by default, using a network sink makes it write to a network port instead).  Given a beefy enough machine this would work, but on the local network bandwidth isn't an issue (for the most part).  I'd rather not take the CPU hit for real time transcoding and also reap the quality benefits of using the native MPEG streams.  Transcoding is even less realistic when considering ATSC content.

I haven't heard back from Elecard yet.  I doubt that it's going to be terrible per license, but I suspect that the initial fee will be in the thousands.  Hopefully they have tiers based on usage (i.e. non-commercial).  Licensing the SDK is around $1,000 but that's more geared towards developers who aren't familiar with DirectShow, so I doubt I'll need it to get it working.

I haven't messed with it yet, but it should also be possible to handle playback using the WMF SDK to interact with the files directly (w/o DirectShow).  This would be more work, but also provide more control over what's getting written.  Not being much of an expert on the guts of DVR-MS files (or media files in general) I hesitate to explore this route, but it would certainly be educational.

How do ffmpeg and mencoder parse the contents of the files?  Do they read the ASF directly?  I can't imagine that they use the WMF SDK.

November 19, 2007 6:17 PM
 

Saben said:

How does this thought differ from the products Such and TwonkyVision and/or TVersity (one commercial, other freeware) that provide on-demand transcoding of different media depending on what the device desires.  I've setup Tversity and it will replace the MCE DNLA server functionality with the added benefit of transcoding.  My problem so far has been the limitations that on demand transcoding places on the process.  Namily video stutters, in-ability to pause/restart, rewind/fast-forward, etc.

November 19, 2007 7:42 PM
 

jelwood said:

ffmpeg and Mencoder don't use WMF SDK.  In those products we are just parsing the dvr-ms format directly (remember they were written for Linux, so no Windows SDK or API's are allowed).  This is a real pain, but it can be done.  Now there is another product called ffserver.  It is a component of ffmpeg that allows streaming (where ffmpeg is used for conversions).  I haven't played with ffserver at all, but since it uses the same source as ffmpeg I know it can read dvr-ms files.

November 20, 2007 6:43 AM
 

babgvant said:

The major difference b/w this application and those types of apps is the lack of transcoding.  The intended client for this application is another PC, most likely a WMC PC.  Given the lack on WMC-WMC integration, I think there is demand for a "remote tv" application that provides access to other WMC machines on your home network.  Assuming I can get the streaming part to work, I'd like to have the client piece be a MCML application hosted on a WMC PC.

November 20, 2007 7:56 AM
 

jelwood said:

I asked some of the ffmpeg developers about using ffserver for streaming.  They said that ffserver does basic streaming; however they really recommended looking at VLC (www.videolan.org).  They said this application uses some of the ffmpeg source so it should be able to read dvr-ms, but in their opinion it was far better for streaming.

November 22, 2007 11:03 AM
 

babgvant said:

Looking at VLC makes me realize how limited WMP is.  This looks like it's a very viable solution; it can playback and stream dvr-ms files, and I even found a .net control that wraps the player.  If it can be embedded in a MCML page then I think that's an easy solution.  

thanks

November 23, 2007 2:02 PM
 

jelwood said:

I don't know if you saw this, but this project might give you a head start since they have already done some of the MCE integration.

http://wiki.videolan.org/Use_in_Media_Center

November 23, 2007 7:13 PM
 

babgvant said:

That looks like a hosted HTML addin.  Which probably uses the ActiveX control.  I'd like to get tighter integration and take advantage of the Vista UI more than can be accomplished with that method.

Another part of this would be exposing guide data on a remote machine.  Writing that in HTML would be more effort than it's worth.

November 24, 2007 11:42 AM
 

jelwood said:

Here is something else I found that is interesting.

http://www.dvbportal.de/projects/hdtvpump/

If you can use VLC to be the MPEG TS Server then you might be able to use this DirectShow filter to play the Transport Streams.  Of course, this would play the streams using the normal MCE player.

November 26, 2007 4:48 PM
 

babgvant said:

I think that filter will only read off of the disk.  Doing something like this (using VLC as streaming end points) was one of the options I was looking at, but the file is locked as it is written so DirectShow won't load it.  It would be great if VLC could stream directly into a DVR-MS file because it's designed for these sorts of scenarios.

It might be possible to stream the files over MMS if filters can be found/written that transform the media types into something the standard DirectShow filters will understand.  The FourCC code that VLC writes in the stream is MPGV which is non-standard (at least in a MS world).  I think if a filter was created that registered for that type it should just have to change the AMMediaType to standard MPEG Video and pass the data through to connect to the MPEG Decoder.  It might be necessary to do the same for audio, but that appears to be working ok, at least with  MPG Audio (not AC3).

November 26, 2007 8:29 PM
 

jelwood said:

This is too bad that Directshow won't read the dvr-ms file as it is being written.  I wonder how MS gets around this when they play the file?  Also, how does Gere do it with ShowAnalyzer (does he not use Directshow)?  Anyway, here is another filter that I found.  It allows you to use Directshow and create the .ts files.  Of course, if Directshow worked, then you could just write to the SBE, so I don't know how useful this is.

http://www.dvbportal.de/projects/hdtvdump/

Another thought I have is I know both Mencoder and ffmpeg can read the dvr-ms files as they are being written.  I wonder if we used ffmpeg to re-mux the dvr-ms into a .ts if that would help...

November 27, 2007 2:40 AM
 

babgvant said:

DVR-MS, at least when you use the SBE to create it, does support multiple readers.  I was trying to stream the output into an MPEG file and read that using DirectShow, but VLC was locking the file.  Jere reads DVR-MS files using his own parser written off of the ASF specification.

I haven't tried using VLC to read a DVR-MS while it's recording, that would probably be a good idea :)

I think an approach where the dvr-ms file is streamed from the source pc directly into a dvr-ms file on the other end would be ideal.  It would be the least invasive to WMC, which has limited extensibility in this area.  I don't think direct streams would be seekable so much of the timeshifting value would be lost.

Worst case; an alternate shell can be written and launched from WMC.

November 27, 2007 7:10 AM
 

andy vt's blog said:

It's been a month since I started looking at streaming tv b/w WMC PC's at first I was interested

December 18, 2007 10:50 AM
@2008 andy vt
Powered by Community Server (Non-Commercial Edition), by Telligent Systems