C# Get video file duration from metadata
Posted
by Rekreativc
on Stack Overflow
See other posts from Stack Overflow
or by Rekreativc
Published on 2009-08-10T19:46:53Z
Indexed on
2010/05/17
22:00 UTC
Read the original article
Hit count: 204
I am trying to read metadata from a file. I only need the Video -> Length property, however I am unable to find a simple way of reading this information.
I figured this would be fairly easy since it is visible by default in Explorer, however this looks to be way more complicated than I anticipated. The closest I came was using:
Microsoft.DirectX.AudioVideoPlayback.Video video = new Microsoft.DirectX.AudioVideoPlayback.Video(str);
double duration = video.Duration;
However this throws a LoaderLock exception, and I don't know how to deal with it.
Any ideas?
© Stack Overflow or respective owner