StackOverflower
StackOverflower

Reputation: 5761

Programmatically get video duration

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?

Upvotes: 1

Views: 1975

Answers (2)

Jeremiah Morrill
Jeremiah Morrill

Reputation: 4268

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

Upvotes: 1

ChrisF
ChrisF

Reputation: 137118

-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)?

Upvotes: 6

Related Questions