views:

66

answers:

2

Hi I'd need to get the video duration of a mp4 video (video format AVC)

I'm using DirectShowLib 2.1

I downloaded a couple of codecs but I'm still getting code -2147220891 (an error code that I don't know what it means) doing

 graphBuilder.RenderFile(filePath, null);

Any idea how to get the duration of this kind of video?

+4  A: 

-2147220891 is 0x80040265 in hex. A search for that error code revealed this thread

0x80040265 isn't really "unknown". Strictly, it is VFW_E_UNSUPPORTED_STREAM, which means that your AVI files contain at least one stream (e.g., the video) that you do not have the right codec for.

So it looks like you still haven't found the right codec.

Does the file play in Windows Media Player or VLC (for example)?

ChrisF
This is great help. Sorry for my ignorance but how do you get this number: 0x80040265. I did a conversion to hexadecimal of the number 2147220891 and I get something else
Timmy O' Tool
@Timmy - you forgot to include the minus sign in your conversion - easily done. I've used enough Microsoft APIs over the years to do this automatically now. You can switch Visual Studio to show hex in it's watch window too.
ChrisF
you're great man. Thanks!
Timmy O' Tool
+1  A: 

If you just need the duration of a file, you can try using IMediaDet. I have an example of usage here: http://wpfmediakit.codeplex.com/SourceControl/changeset/view/41623#245585

Jeremiah Morrill
Thanks, I'll take a look to this
Timmy O' Tool