StefH / MediaInfo.DotNetWrapper

A C# .NET Wrapper for the MediaInfo.Native and MediaInfo.dll
MIT License
37 stars 8 forks source link

Unable to load MediaInfo library #7

Open ahvahsky2008 opened 6 years ago

ahvahsky2008 commented 6 years ago

I add MediaInfo folder to PATH, but program rise error.

dashkan commented 6 years ago

Assuming you are targeting .net standard / core.

Can you give more detail? Are you running x86 or x64? What's the exception?

StefH commented 6 years ago

When using this on Linux, I also doubt if this works.

I installed mediainfo using apt-get. And this gets installed in

/usr/bin/mediainfo

However when I clone this git project in Linux (bash on windows 10) and do a dotnet run: I get the same error.

dashkan commented 6 years ago

I must have broken something. I'll check it out on all platforms ASAP.

dashkan commented 6 years ago

I did a fresh clone in win x64, MacOs 10.13 and Ubuntu 16.04 and all three environments work for me.

You do need to use the official MediaInfo release in linux distros. Please uninstall apt-get version of media info and do the following

# Download libzen
wget https://mediaarea.net/download/binary/libzen0/0.4.37/libzen0v5_0.4.37-1_amd64.Debian_9.0.deb
# Install libzen package
dpkg -i libzen0v5_0.4.37-1_amd64.Debian_9.0.deb
# Force install missing packages
apt-get upgrade -f 
# Download libmediainfo
wget https://mediaarea.net/download/binary/libmediainfo0/17.12/libmediainfo0v5_17.12-1_amd64.Debian_9.0.deb
# Install libmediainfo package
dpkg -i libmediainfo0v5_17.12-1_amd64.Debian_9.0.deb
# Force install missing packages
apt-get upgrade -f
# Create symbolic link for libmediainfo.so. For whatever reason the official package does not create it
ln -s /usr/lib/x86_64-linux-gnu/libmediainfo.so.0.0.0 /usr/lib/x86_64-linux-gnu/libmediainfo.so

git clone https://github.com/StefH/MediaInfo.DotNetWrapper.git
cd MediaInfo.DotNetWrapper/test/MediaInfo.DotNetWrapper.ConsoleTest.NetCore20/
dotnet run
StefH commented 6 years ago

Running the first step gives me error:

stef@stef: /mediainfo/MediaInfo.DotNetWrapper/test/MediaInfo.DotNetWrapper.ConsoleTest.NetCore20$ sudo dpkg -i libzen0v5_0.4.37-1_amd64.Debian_9.0.deb dpkg: considering removing libzen0:amd64 in favour of libzen0v5:amd64 ... dpkg: yes, will remove libzen0:amd64 in favour of libzen0v5:amd64 (Reading database ... 29563 files and directories currently installed.) Preparing to unpack libzen0v5_0.4.37-1_amd64.Debian_9.0.deb ... Unpacking libzen0v5:amd64 (0.4.37-1) ... dpkg: dependency problems prevent configuration of libzen0v5:amd64: libzen0v5:amd64 depends on libstdc++6 (>= 5.2); however: Version of libstdc++6:amd64 on system is 4.8.4-2ubuntu1~14.04.4.

dpkg: error processing package libzen0v5:amd64 (--install): dependency problems - leaving unconfigured Processing triggers for libc-bin (2.19-0ubuntu6.14) ... Errors were encountered while processing: libzen0v5:amd64

dashkan commented 6 years ago

You are trying to install ubuntu 16.04 version on ubuntu 14.04. The MediaInfo ubuntu site has the links for each version of ubuntu.

Here are instructions for 14.04

# So you dont have to run sudo command for the following
sudo -s
apt-get install -y git wget curl apt-transport-https libunwind8 liblttng-ust0 libcurl3 libssl1.0.0 libuuid1 libkrb5-3 zlib1g libicu52
# Start install dotnet sdk - only do the following if you dont have dotnet sdk installed
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg
sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
apt-get update
apt-get install -y dotnet-sdk-2.1.4
# End install dotnet sdk

# Download libzen & libmediainfo for ubuntu trusty 14.04
wget https://mediaarea.net/download/binary/libzen0/0.4.37/libzen0_0.4.37-1_amd64.xUbuntu_14.04.deb
wget https://mediaarea.net/download/binary/libmediainfo0/17.12/libmediainfo0_17.12-1_amd64.xUbuntu_14.04.deb
# Install packages
dpkg -i libzen0_0.4.37-1_amd64.xUbuntu_14.04.deb
dpkg -i libmediainfo0_17.12-1_amd64.xUbuntu_14.04.deb
# Fix pacakge dependencies
apt-get install -f 
# Create symbolic link
ln -s /usr/lib/x86_64-linux-gnu/libmediainfo.so.0.0.0 /usr/lib/x86_64-linux-gnu/libmediainfo.so
# Exit sudo
exit
# Clone and run mediainfo wrapper
git clone https://github.com/StefH/MediaInfo.DotNetWrapper.git
cd MediaInfo.DotNetWrapper/test/MediaInfo.DotNetWrapper.ConsoleTest.NetCore20/
dotnet run
StefH commented 6 years ago

Still some error Unhandled Exception: System.Exception: Unable to load MediaInfo library.

(I did not install dotnet again.)

dashkan commented 6 years ago

It was also successful using aptitude version of libmediainfo. Be happy to do some sort of screen sharing if this doesn't work.

Please try the following

# Uninstall official / downloaded versions
sudo apt remove --purge libmediainfo0v5 libzen0v5
sudo apt autoremove
sudo apt install libmediainfo-dev
# Clone and run mediainfo wrapper
git clone https://github.com/StefH/MediaInfo.DotNetWrapper.git
cd MediaInfo.DotNetWrapper/test/MediaInfo.DotNetWrapper.ConsoleTest.NetCore20/
dotnet run
StefH commented 6 years ago

All works fine, except for E: Invalid operation autoremove.