-
Notifications
You must be signed in to change notification settings - Fork 623
Using FFmpegKit in Unity
-
Download the latest
ffmpeg-kit-<package>-<version>.aar
file from the Releases page and copy it under the<Your Unity Project Name>/Assets/Plugins/Android
folder.- Please note that
Main
releases support API Level 24 andLTS
releases support API Level 16.
- Please note that
-
FFmpegKit
Android library depends on smart-exception library. It must be imported as well. Go to the Releases page, find the latest release, download thesmart-exception-common-a.b.c.jar
andsmart-exception-java-a.b.c.jar
files and copy them under the<Your Unity Project Name>/Assets/Plugins/Android
folder. -
Disable the handling of
SIGXCPU
signal by running the following code block.AndroidJavaClass configClass = new AndroidJavaClass("com.arthenica.ffmpegkit.FFmpegKitConfig"); AndroidJavaObject paramVal = new AndroidJavaClass("com.arthenica.ffmpegkit.Signal").GetStatic<AndroidJavaObject>("SIGXCPU"); configClass.CallStatic("ignoreSignal", new object[] { paramVal });
-
Use the following code block to call
execute
method and runffmpeg
commands.AndroidJavaClass javaClass = new AndroidJavaClass("com.arthenica.ffmpegkit.FFmpegKit"); AndroidJavaObject session = javaClass.CallStatic<AndroidJavaObject>("execute", new object[] {"-version"}); AndroidJavaObject returnCode = session.Call<AndroidJavaObject>("getReturnCode", new object[] {}); int rc = returnCode.Call<int>("getValue", new object[] {});
-
You can call other
ffmpeg-kit
API methods using a similar approach.string output = session.Call<string>("getOutput", new object[] {}); Debug.Log("Output " + output);
Unity Cloud Build does support importing Xcode frameworks
. So it should be possible to import ffmpeg-kit
frameworks using the Xcode frameworks guide. Unfortunately, it is not tested and documented yet.
There are unofficial blogs about using Cocoapods
under Unity
. If you can make them work then you can import ffmpeg-kit
by adding ffmpeg-kit
dependency into your Podfile
as described in README.
Copyright (c) 2021-2024 FFmpegKit
- Status
- Versions
- Changelog
- Project Layout
- API
- Using
- Building
- External Libraries
- Patents
- License