C# Get video file duration from metadata
- by Rekreativc
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?