Doing a custom SAMI caption parser - problems

Apr 19, 2011 at 1:04 PM


Is there any sample of just doing a simple subtitle parsing and displaying? The TimedText plugin is of course available, but it is rather complex and not that well commented ;)

I have tried doing a IMarkerProvider that gives a bunch of CaptionRegions containing a single CaptionElement or one big CaptionRegion containing a bunch of CaptionText elements.

If i use a lot of CaptionsRegions it seems i never reach them according to my log (i set Begin on the CaptionRegions) if i set Begin on the CaptionText elements and use a big CaptionRegion without any begin, i do reach the region, but no text ever appears.

Anyone have a simple sample of doing very easy captions, without all the complexity of TimedText?


- Loke

Apr 19, 2011 at 3:14 PM

Loke, you might want to take a look at the source for the project: Microsoft.SilverlightMediaFramework.Plugins.ClearTextCaptions

It creates captions that are just plain old text from instream data. I'm not sure how close it is to what you need but it is a very simple implementation and might help shed some light.


May 23, 2011 at 9:57 AM

Hi Tim

Just a followup, i have a SAMI parser working now. I am happy to share the source with you if you want.

- Loke

Aug 23, 2011 at 12:26 PM
Edited Aug 23, 2011 at 2:39 PM


I'm currently trying to do just that!

I'm converting from an old project which wasn't using SMF, and so I'm trying to find the best method to handle subtitles (I've got SAMI and another more obscure format to support). I've started writing a custom IMarkerProvider, but I'm not sure if it's really the way to go or if there's something simpler possible.

So I'd be interested in any source that loads SAMI into SMF.


EDIT: well, got it mostly working now. I think it would be great to have all the subtitles plugins published somewhere though.

Aug 25, 2011 at 4:34 PM
Edited Sep 20, 2011 at 9:07 AM

For those interested, I've setup a Codeplex project to share plugins for MMP:PF here: where I've uploaded my SAMI and EBU-STL plugins.

EDIT: removed, see below

Sep 16, 2011 at 12:11 PM

I just tried the link above. It says the project is not yet published. I am working on developing a plugin myself. Will you be publishing the project?

Sep 16, 2011 at 12:27 PM
Edited Sep 16, 2011 at 12:29 PM

I'm not really sure, I've got a corporate policy issue at the moment regarding publishing internally developed code as FOSS.

I was thinking I could create a 'tutorial' instead, featuring most of the code if people are interested.

Sep 16, 2011 at 2:01 PM

That would be really good! you have my vote

Sep 20, 2011 at 8:41 AM
Edited Sep 20, 2011 at 1:38 PM

I've finally written an article on the CodeProject. It is currently pending edition, it should show up in the coming days.

I haven't included the actual SAMI parsing, because 1) it is company code 2) our current code is a hideous mess (see my post here for examples). But the plugin structure I provide should give you a nice boost writing your plugin.

Sep 20, 2011 at 8:59 AM


just to confirm before hand - you wrote a custom plugin right and its not possible to extend the existing  TimedText / CleartextCaption plugins.

Sep 20, 2011 at 9:00 AM

Well, for me it wasn't possible as the captions are not embedded into the video stream, which is what the samples demonstrate. My plugins deal with standalone caption files.

Sep 20, 2011 at 1:31 PM
Edited Sep 20, 2011 at 1:32 PM

Here it is: my article on CodeProject