radek-k / FFMediaToolkit

FFMediaToolkit is a cross-platform video decoder/encoder library for .NET that uses FFmpeg native libraries. It supports video frames extraction, reading stream metadata and creating videos from bitmaps in any format supported by FFmpeg.
MIT License
357 stars 56 forks source link

'Access Violation when Opening video' #29

Closed YXuewei closed 4 years ago

YXuewei commented 4 years ago

Hello, I ran into Access Violation when opening mp4 video files. This line caused problem, and path is a valid file path. var file = MediaFile.Open(path);

Here is what debug console shows:

'WebApplicationFaceRec.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.5\System.Drawing.dll'. 
'WebApplicationFaceRec.exe' (CoreCLR: clrhost): Loaded 'C:\Work\source\repos\WebApplicationFaceRec\bin\Debug\netcoreapp3.1\FFmpeg.AutoGen.dll'. 
The program '[31540] WebApplicationFaceRec.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
The program '' has exited with code -1 (0xffffffff).

I'm using Windows 10 Insider Preview Build19640,Visual Studio Community 2019, .Net Core 3.1, and this is a ASP.Net Restful API.

However, in .Net Core Console Application, the same code went flawlessly. Access violation only appears in .Net Core Webapplication.

I tried runing this project as Admin privilege, doesn't help anything. Can you help me with it?

radek-k commented 4 years ago

I created a simple ASP.NET Core 3.1 API project with FFMediaToolkit and I don't get any exceptions. Maybe you should try this on a stable Windows version (I'm using Windows 10 2004)

YXuewei commented 4 years ago

Did you tried to read frames? Now I don't have problem with Open files, but still getting Access Violation when reading frames, not constantly at first frame, sometimes 2nd or 3rd, sometimes first one maybe. And debug console also occasionally report that I tried to read or write corrupted memory area.

dev-masih commented 4 years ago

@YXuewei did you overcome this? i'm getting the same result

YXuewei commented 4 years ago

@YXuewei did you overcome this? i'm getting the same result

@dev-masih No, I switched to OpenCVSharp from frame processing, and it worked great. You can try that too.