-
-
Notifications
You must be signed in to change notification settings - Fork 796
Using MobileFFmpeg in Unity
-
Download the latest
mobile-ffmpeg-<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
-
Patch
mobile-ffmpeg-<package>-<version>.aar
file if necessary. The latestmobile-ffmpeg
releases are already patched but to use older versions you need to perform the following steps.- Delete
res
folder inside the.aar
file - Delete
android:theme="@style/AppTheme"
attribute from theAndroidManifest.xml
inside the.aar
file
- Delete
-
Disable the handling of
SIGXCPU
signal by running the following code block.
AndroidJavaObject paramVal = new AndroidJavaClass("com.arthenica.mobileffmpeg.Signal").GetStatic<AndroidJavaObject>("SIGXCPU");
configClass.CallStatic("ignoreSignal", new object[] { paramVal });
- Use the following code block to call
execute
method and runffmpeg
commands.
AndroidJavaClass jc = new AndroidJavaClass("com.arthenica.mobileffmpeg.FFmpeg");
int rc = jc.CallStatic<int>("execute", new object[] {"-version"});
Debug.Log("FFmpeg ended with " + rc);
- You can call other
mobile-ffmpeg
API methods using a similar approach.
string output = jc.CallStatic<string>("getLastCommandOutput", new object[] {});
Debug.Log("Output " + output);
Unity Cloud Build does support importing Xcode frameworks
. So it should be possible to import mobile-ffmpeg
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 mobile-ffmpeg
by adding mobile-ffmpeg
dependency into your Podfile
as described in README.
Copyright (c) 2018-2021 MobileFFmpeg