FFmpeg_droidFix.AutoGen
8.0.0
See the version list below for details.
dotnet add package FFmpeg_droidFix.AutoGen --version 8.0.0
NuGet\Install-Package FFmpeg_droidFix.AutoGen -Version 8.0.0
<PackageReference Include="FFmpeg_droidFix.AutoGen" Version="8.0.0" />
<PackageVersion Include="FFmpeg_droidFix.AutoGen" Version="8.0.0" />
<PackageReference Include="FFmpeg_droidFix.AutoGen" />
paket add FFmpeg_droidFix.AutoGen --version 8.0.0
#r "nuget: FFmpeg_droidFix.AutoGen, 8.0.0"
#:package FFmpeg_droidFix.AutoGen@8.0.0
#addin nuget:?package=FFmpeg_droidFix.AutoGen&version=8.0.0
#tool nuget:?package=FFmpeg_droidFix.AutoGen&version=8.0.0
What changed from original project:
As very beginning of making projectFrameCut, I selected this library to decode videos, etc. because this thing can let me call FFmpeg and read out frame directly, by all C# Managed code, save my time and increase the speed.
When I'm trying to test projectFrameCut on Android, while I try to call this library on the Android platform, I found that I kept receiving the "PlatformNotSupportedException" error. After some diagnosis, I discovered that it was caused by the changes in .NET 5+ to System.OSPlatform. So that I fixed this file by use the modern System.OperatingSystem API, also I added a Function Resolver for Android.
But, I found this is not the only problem while running on Android devices. After this fix, I start receive a "DllImportException" when I try to call the library, after days of fix, I finally discover why: "libdl.so.2" isn't exists on Android devices, and dlopen moved to "libc.so" instead of libdl. I also added a user-friendly exception processing telling why libraries failed to load.
I also added a property AddVersionSuffixToLibraryPaththat allows you to manually disable adding a version suffix to library names when attempting to load a library. This can resolve issues where certain platforms remove the version suffix when packaging the application.
This fork is fully compatible with the original FFmpeg.AutoGen library (8.0.0 branch).
Important Announcement
This project is undergoing a transition to a semi-managed model over the coming months.
- All existing packages and versions will continue to work - there will be no breaking changes to existing functionality
- The project is now MIT licensed (changed from LGPL) - see LICENSE.txt for details
- Contributions are welcome! If you'd like to help with the project, please feel free to contribute
- The FFmpeg binaries continue to be distributed with their original licenses from the source
Founder & Maintainer: Ruslan Balanukhin (Rationale One)
For questions and support, please continue using stackoverflow.com or the questions repository.
Important
The FFmpeg API is vast and complex and this project exposes it with minimum modifications - support is very limited. Please consider to ask how to questions on stackoverflow.com or in special repository on github.com. The community may be able to offer some assistance but you will largely be on your own. As another option you can search for a solution in C(lang) as with some effort you can convert it to C#. Here repository with C# converted examples: https://github.com/stjeong/ffmpeg_autogen_cs
FFmpeg.AutoGen
FFmpeg auto generated unsafe bindings for C#/.NET and Mono.
Usage
The basic example of the library usage: video decoding, conversion and frame extraction to jpeg is included in FFmpeg.AutoGen.Example project.
For the more sophisticated operations please refer to offical ffmpeg Documentation expecially API section of it.
Nuget packages version uses semantic versioning and in sync with MAJOR and MINOR version of FFmpeg as PATCH incremets does not changing API.
on Windows:
Native ffmpeg libraries are pre bundled in this repository, please note the are GPL(!) libraries. The x64 libraries source from CODEX FFMPEG. Please check to example project it shows how specify path to libraries.on MacOS (mostly Console application, not MacCatalyst):
Install ffmpeg via Homebrew:
brew install ffmpeg
Normally you need to set static ffmpeg.RootPath = with full path to FFmpeg libraries.
on iOS/iPadOS/TvOS/WatchOS/VisionOS/MacCatalyst, etc. (.NET MAUI): todo
on Android (.NET MAUI):
add these code to MauiProgram.cs:
#if ANDROID
ffmpeg.RootPath = Android.App.Application.Context.ApplicationInfo.NativeLibraryDir;
JavaSystem.LoadLibrary("c");
#endif
Then, create a directory inside <your .NET MAUI project root path>/Platforms/Android/, name it whatever you want. Create a folder named same as the FFmpeg libraries' ABI name (like arm64-v8a) your get/compile inside the folder your created. Put all .so files inside it, don't add any suffix or prefix.
Then, add these things to the project's .csproj file:
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
<AndroidNativeLibrary Include="Platforms\Android\<name of the directory your named>\**\*.so" />
</ItemGroup>
Don't forget to replace <name of the directory your named> to the name of the directory your named in 2nd step.
Your project's file structure should like this:
.
|
|
\---Platforms
+---Android
| | ......
| |
| +---Assets
| +---ffmpeg
| | \---arm64-v8a
| | libavcodec.so
| | libavfilter.so
| | libavformat.so
| | libavutil.so
| | libswresample.so
| | libswscale.so
| |
| +---Resources
| ......
|
......
- on Linux:
Use your package manager of choice. Normally you need to set staticffmpeg.RootPath = ...with full path to FFmpeg libraries.
Generation
The bindings generator uses CppSharp.
Prerequisites:
- Visual Studio 2022 with C# and C++ desktop development workloads and Windows SDK for desktop.
Steps to generate:
- Run
FFmpeg.AutoGen.CppSharpUnsafeGenerator; - All files with extension
*.g.csinFFmpeg.AutoGenproject will be regenerated.
License
Copyright © 2025 Ruslan Balanukhin (Rationale One)
All rights reserved.
Distributed under the MIT License.
See LICENSE.txt for full license text.
Note: FFmpeg binaries are distributed under their original licenses (GPL/LGPL) from the source. Please refer to FFmpeg License for details.
The fork is created by hexadecimal0x12e.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.