Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

[Unity+AR.Drone] DllNotFoundException - Dependency on another DLL

Discussion in 'Scripting' started by Scopus, Apr 2, 2014.

  1. Scopus

    Scopus

    Joined:
    Jan 23, 2014
    Posts:
    4
    Hey guys,

    Currently I try to connect the AR.Drone 2.0 with Unity. This is part of a greater project. I already managed to control the AR.Drone with Unity. Therefore I used this library by Ruslan-B. A minor problem was, that this library is written with .Net 4.0 and I had to convert it to .Net 3.5 (because Unity only supports .Net 3.5). As I sad, I can control the Drone but now I want to get the video captured by the drone into unity. The c# framework for the drone comes with a VideoDecoder which I also use in my unity project. This line is causing the error:

    Code (csharp):
    1. FFmpegInvoke.av_register_all();
    As you can see the VideoDecoder is using FFmpeg to decode a video. The FFmpegInvoke class is a wrapper for FFmpeg and provides simple c# functions. The problem now is, that this class throws a System.DllNotFoundException. This is the full stack trace:

    Code (csharp):
    1. System.TypeInitializationException: An exception was thrown by the type initializer for AR.Drone.Video.VideoDecoder ---> System.DllNotFoundException: C:/AR.Drone-master.UNITY/Assets/Plugins/avformat-55.dll
    2.   at (wrapper managed-to-native) FFmpeg.AutoGen.FFmpegInvoke:av_register_all ()
    3.   at AR.Drone.Video.VideoDecoder..cctor () [0x00000] in C:\Users\Matthias\Downloads\AR.Drone_Rift_Unity_Project\AR.Drone-master.UNITY\Assets\Scripts\AR.Drone.Video\VideoDecoder.cs:15
    4.   --- End of inner exception stack trace ---
    5.   at AR.Drone.Video.VideoPacketDecoder.TryDecode (AR.Drone.Data.VideoPacket packet, AR.Drone.Video.VideoFrame frame) [0x0000b] in C:\Users\Matthias\Downloads\AR.Drone_Rift_Unity_Project\AR.Drone-master.UNITY\Assets\Scripts\AR.Drone.Video\VideoPacketDecoder.cs:24
    6.   at AR.Drone.Video.VideoPacketDecoderWorker.Loop (CancellationToken token) [0x0002e] in C:\Users\Matthias\Downloads\AR.Drone_Rift_Unity_Project\AR.Drone-master.UNITY\Assets\Scripts\AR.Drone.Video\VideoPacketDecoderWorker.cs:49
    7.   at AR.Drone.Infrastructure.WorkerBase.RunLoop () [0x0000c] in C:\Users\Matthias\Downloads\AR.Drone_Rift_Unity_Project\AR.Drone-master.UNITY\Assets\Scripts\AR.Drone.Infrastructure\WorkerBase.cs:5
    If I understand this correctly, he cannot find the avformat-55.dll in the Plugins folder. But actually I put avformat-55.dll and all other needed dlls in this directory.

    An interesting point is, that when I delete the dlls from the Plugins folder. I get the following Exception (cropped):

    Code (csharp):
    1. System.TypeInitializationException: An exception was thrown by the type initializer for AR.Drone.Video.VideoDecoder ---> System.DllNotFoundException: avformat-55
    As you can see, the path is missing. For me that means, that he can find the dll in the Plugin directory but cannot handle it.
    I also tried everything written in this thread: DllNotFoundException when depend on another dll
    But nothing helped.

    Do you have any ideas why I get this exception? Thanks a lot in advance.
     
  2. Scopus

    Scopus

    Joined:
    Jan 23, 2014
    Posts:
    4
    For those who are interested: I solved the problem by using the 32-Bit library files instead of the 64-Bit files.
     
  3. mdh23

    mdh23

    Joined:
    Apr 14, 2014
    Posts:
    1
    Hi Scoper, I was working on this same project for creating unity plugin to control the Ar Drone and getting the video stream. i worked with fake DLL to be able to use .net 4.0 framework. But with no succes.. Can you give me an idea and tell me what are the steps to make it work. I will be very gratefull. And think you :)
     
  4. Arno1975

    Arno1975

    Joined:
    Aug 14, 2013
    Posts:
    43
    I have this idea..can you tell me if it could work.. I want to get the drone footage and place like a marker or something and then have an object placed.. so I get an AR solution. I can fly around a building that isn't there yet..would be amazing