RtspClientSharp icon indicating copy to clipboard operation
RtspClientSharp copied to clipboard

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

Open danelec-hpm opened this issue 2 years ago • 11 comments

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

danelec-hpm avatar Oct 05 '21 12:10 danelec-hpm

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

Husseinbeygi avatar Nov 14 '21 05:11 Husseinbeygi

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

danelec-hpm avatar Nov 15 '21 07:11 danelec-hpm

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

Husseinbeygi avatar Nov 16 '21 05:11 Husseinbeygi

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

danelec-hpm avatar Nov 16 '21 07:11 danelec-hpm

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 avatar Nov 16 '21 07:11 Husseinbeygi

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

Husseinbeygi avatar Nov 16 '21 08:11 Husseinbeygi

Still cannot work!

RoyLaiYi avatar Nov 22 '21 01:11 RoyLaiYi

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

nshiggins avatar Dec 06 '21 14:12 nshiggins

@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
   

aslamiqbal avatar Aug 25 '23 21:08 aslamiqbal

@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.

danelec-hpm avatar Aug 28 '23 07:08 danelec-hpm

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).

CanduD avatar Jan 18 '24 22:01 CanduD