ffmpeginteropx / FFmpegInteropX

FFmpeg decoding library for Windows 10 UWP and WinUI 3 Apps
Apache License 2.0
211 stars 53 forks source link

Unrecognized .dll in Unity #260

Closed apranvoku closed 2 years ago

apranvoku commented 2 years ago

Hello, (apologies if this is a dumb question.)

I'm trying to use this package in Unity, similar to https://github.com/ffmpeginteropx/FFmpegInteropX/issues/253 I've imported all of the dlls as so and designated them to be active in the editor : image However, when I try to access functions such as await FFmpegInteropMSS.CreateFromUriAsync("udp://127.0.0.1:9005", configuration);

Nothing is found. (E.G. "The name "FFmpegInteropMSS.CreateFromUriAsync does not exist in the current context.")

Thanks for any help.

Additional Details: Unity 2020.3.17f1 HoloLens 2 Backend : .NET Standard 2.0

brabebhin commented 2 years ago

Did you install both the ffmpeginteropx package and ffmpeg.uwp?

morgabm commented 2 years ago

You should make sure UWP is enabled in build settings and surround your code using the uwp apis with #if ENABLE_WINMD_SUPPORT guards.

apranvoku commented 2 years ago

For some reason when I add the ENABLE_WINMD_SUPPORT guards the code is greyed out, even though I have UWP selected in build settings. I do have the dlls from both packages in the projects as can be seen in the screenshot.

lukasf commented 2 years ago

I think you also need the FFmpegInterop.winmd file. It contains the actual API definitions.

morgabm commented 2 years ago

For some reason when I add the ENABLE_WINMD_SUPPORT guards the code is greyed out, even though I have UWP selected in build settings. I do have the dlls from both packages in the projects as can be seen in the screenshot.

The code will be greyed out unfortunately. The alternative is to build a uwp component referencing ffmpegiterop in visual studio that encapsulates all of your uwp logic and expose a very simple api/function to call so you aren't programming without intellisense in unity.

apranvoku commented 2 years ago

I added the winmd file, didn't change anything. Building the uwp component referencing ffmpeg interop may work, but I'm not sure how to do it and without any guarantees it'll work I don't know if it's the best avenue right now. I appreciate your help though.

apranvoku commented 2 years ago

Okay, so Baileymnm1999's solution seems to be the way to go, though I'm really not sure how to do it but it will build and function if you use the #if ENABLE_WINMD_SUPPORT guards. Of course it's a huge pain to debug but such is life.