Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load DLL 'libffmpeghelper.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) #116

Open
danelec-hpm opened this issue Oct 5, 2021 · 11 comments

Comments

@danelec-hpm
Copy link

Describe the bug
I cloned the repository, opened in VS 2019 and installed the Windows SDK that was missing. When running the player I am getting the error:
System.DllNotFoundException: 'Unable to load DLL 'libffmpeghelper.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)'
For some reason the libffmpeghelper.dll is not automatically copied to the players bin/debug folder?
I tried to copy it manually, but I am still getting above error.

To Reproduce
Clone repo. Build the solution and run the SimpleRtspPlayer sample. Type correct device address, login and password and click Start button.
The code fails at FFmpegVideoDecoder.cs line 37:
int resultCode = FFmpegVideoPInvoke.CreateVideoDecoder(videoCodecId, out IntPtr decoderPtr);

Expected behavior
That the video would just play

Desktop (please complete the following information):

  • OS: Windows 10
@Husseinbeygi
Copy link

Hi
I have the same problem....
Did anyone manage to solve that?

@danelec-hpm
Copy link
Author

I managed to solve it.
You need to set the C++ project to 64 bit.
Right click the libffmpeghelper in Visual Studio and select Proerties.
Then at the top right, change platform to x64. It should then work

@Husseinbeygi
Copy link

After Compiling The libffmpeghelper.
Where should I put the DLL to C# project found it?
I still get the same error!

@danelec-hpm
Copy link
Author

It should be automatically included in the C# project, but if not copy it to the bin/debug or bin/release folder.

@Husseinbeygi
Copy link

Husseinbeygi commented Nov 16, 2021

I did what you said.
Still get the same error.
I don't know what I'm doing wrong.
And I'm Using Asp.net Core 5 on Windows 10


Capture

@Husseinbeygi
Copy link

Husseinbeygi commented Nov 16, 2021

I manage to Solve it 👍
in my case, I need to copy the X64 Folder in the same directory as libffmpeghelper.dll

@RoyLaiYi
Copy link

Still cannot work!

@nshiggins
Copy link

For me it was the post-build script that copies various DLLs to the build directory that was failing. XCOPY is temperamental and if you have spaces in the path it complains. The solution was to put quotes around the paths:

xcopy "$(ProjectDir)x64*.dll" "$(TargetDir)" /Y /E /C /F
xcopy "$(ProjectDir)..\libffmpeghelper\x64$(Configuration)\libffmpeghelper.dll" "$(TargetDir)" /Y /E /C /F

@aslamiqbal
Copy link

@nshiggins thanks for your instructions. It works but showing another error:

"RtspClientSharp.Rtsp.RtspClientException: Receive error ---> 
System.BadImageFormatException: An attempt was made to load a program with an incorrect format. 
(Exception from HRESULT: 0x8007000B)\r\n   at SimpleRtspPlayer.RawFramesDecoding.FFmpeg.FFmpegAudioPInvoke.CreateAudioDecoder
(FFmpegAudioCodecId audioCodecId, Int32 bitsPerCodedSample, IntPtr& handle)\r\n
   at SimpleRtspPlayer.RawFramesDecoding.FFmpeg.FFmpegAudioDecoder.CreateDecoder(FFmpegAudioCodecId audioCodecId, Int32 bitsPerCodedSample) 
   in....\\Examples\\SimpleRtspPlayer\\RawFramesDecoding\\FFmpeg\\FFmpegAudioDecoder.cs:line 38
   

@danelec-hpm
Copy link
Author

@aslamiqbal Sounds like you compiled the project for 64 bit and copied a 32 bit ffmpeg dll file or vise versa. Or you compiled executeable for 64 bit and your Windows is 32 bits.

@CanduD
Copy link

CanduD commented Jan 18, 2024

Here to revive this thread as I've run into this issue trying to build my own project. Tried following @danelec-hpm steps but still getting the same issue. RtspClientSharp.Rtsp.RtspClientException: Receive error ---> System.DllNotFoundException: Unable to load DLL 'libffmpeghelper.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants