Search code examples
c#videodirectshow

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?


Solution

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