11

I am using Aforge.net frame work for doing image processing work. I have add 'AForge.Video.FFMPEG.dll' as a referance to my project. I am using VS2012 and 32 bit build target. When Buiding i get

 System.IO.FileNotFoundException was unhandled
  HResult=-2147024770
  Message=Could not load file or assembly 'AForge.Video.FFMPEG.dll' or one of its dependencies. The specified module could not be found.
  Source=VideoReadere
  FileName=AForge.Video.FFMPEG.dll
  FusionLog=""
  StackTrace:
       at VideoReadere.Form1..ctor()
       at VideoReadere.Program.Main() in c:\Users\Prabad\Documents\Visual Studio 2012\Projects\VideoReadere\VideoReadere\Program.cs:line 19
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

my code for that is occur exception

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace VideoReadere
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
//here below line give exception
            Application.Run(new Form1());
        }
    }
}
Prathibha Chiranthana
  • 822
  • 1
  • 10
  • 28

8 Answers8

11

You need to copy DLLs from "Externals\ffmpeg\bin" to your AForge.Video.FFMPEG.dll location and maybe you need to install Microsoft Visual C++ Redistributable.

skm
  • 143
  • 6
3

I know its a bit late but i hope my answer helps someone. I had this problem and it gave me a bit of a hard time. Here's how it worked for me:

  1. Project -> Add Existing Item (Browse to the DLLs from "Externals\ffmpeg\bin" as mentioned in other answers)
  2. Make sure you show all types from the file type dropdown list
  3. Select all the DLLs and from the add button choose add link option
  4. The DLLs should be shown on you project solution, select all of them
  5. Edit the Build Action property and make it NativeBinary
  6. Edit the Copy to Output Directory and make it Copy Always

That's it. This worked for me, i published my application and it worked on a windows tablet. Cheers

2

try this

check that the project target is x86 because the assembly will not work in 64. then check if the FFMPEG dll is in the same directory of your application.

Ateeq
  • 797
  • 2
  • 9
  • 27
0

try this tool: Dependency Walker It save my time few times.

EDIT: Sorry I saw last comment too late.

Marcin
  • 821
  • 12
  • 20
0

I solved the problem by rebuilding the project in Release mode (I use Visual studio 2013)

Ahmad
  • 8,811
  • 11
  • 76
  • 141
0

I tried every recommended solution and none of them worked for me, when i used dependencywalker i noticed that the library has missing files(version 2.2.5). So i downloaded previous version 2.2.4 and it works fine for me.

srinced
  • 124
  • 8
0

In order to fix this error, I change target CPU to X86 to match with architecture of Chilkat-dll component being referenced to. For other dll's, you must select correct target CPU of your project that matches with architecture of the dll component. The error will be solved. Right Click on project name > Properties > Compile > Target CPU --> you will come to Target CPU.

Han N.
  • 1
0

This worked for me:

  1. Add useLegacyV2RuntimeActivationPolicy="true" to App.Config
  2. Link two dll - AForge.Video.dll, AForge.Video.FFMPEG.dll
  3. Copy to out put folder \AForge.NET Framework-2.2.5\Externals\ffmpeg\bin *.dlls
konstantin_doncov
  • 2,725
  • 4
  • 40
  • 100
Eduardo Preto
  • 21
  • 1
  • 1
  • 8