Using the MediaInfo.dll within C# project

11.4k views Asked by At

I am attempting to use the MediaInfo.dll within an MVC4 project designed in c# but I am having difficulty in getting this working. I found the following page: http://teejeetech.blogspot.co.uk/2013/01/mediainfo-wrapper-for-net-projects.html and having followed the instructions I have hit a wall.

I have added the MediaInfoNet.dll to my project and have downloaded the MediaInfo.dll in both 32 and 64 bit versions without installers and placed them in my system32 and sysWOW54 folders. I have then added the following code:

MediaFile uploadedFile = new MediaFile("C:\\Users\\jpmcfeely\\Desktop\\Videos\\Quarry.mp4");
string duration = uploadedFile.General.DurationString.ToString();

When debugging through this I get the following error on MediaFile uploadedFile:

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

Any ideas what could be causing my issue?

1

There are 1 answers

0
Jay On BEST ANSWER

Upgrade the DLL in your application bin folder to the 64 bit version of the dll available from http://mediaarea.net/en/MediaInfo/Download/Windows and choose the 64 bit without installer. This can be used with the MediaInfoNet dll and it correctly returns the duration string