Question

I have a web application that needs to look at the duration of previously uploaded mp4 files. Using the DirectShow NET library, the code block executes without error, but it clearly is not actually accessing the file correctly since the duration is always zero.

IGraphBuilder mediaG = (IGraphBuilder) new FilterGraph();
mediaG.RenderFile(fullpath, null);
IMediaPosition mediaPos = mediaG as IMediaPosition;
mediaPos.get_Duration(out minTime);

//convert duration to millisec
time = Convert.ToInt32(Math.Floor(minTime)) * 1000;

Some searching revealed that DirectShow doesn't handle mp4 files and requires some filters such as the ones at http://www.gdcl.co.uk/mpeg4 There seems to be no documentation on what exactly should be done with these filters. Trying to include the dlls into the web application project as a reference fails saying its not a valid assembly. Is there some other way I need to include them, or do they somehow need to be installed on the web server?

Was it helpful?

Solution

For others similarly confused, the additional MP4 filters must be registered on the IIS machine that is executing the code, ie the webhost.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top