-
-
Notifications
You must be signed in to change notification settings - Fork 896
Using MobileFFmpeg in Unity
-
Download the latest
mobile-ffmpeg-<package>-<version>.aarfile from the Releases page and copy it under the<Your Unity Project Name>/Assets/Plugins/Androidfolder.- Please note that
Mainreleases support API Level 24 andLTSreleases support API Level 16.
- Please note that
-
Patch
mobile-ffmpeg-<package>-<version>.aarfile if necessary. The latestmobile-ffmpegreleases are already patched but to use older versions you need to perform the following steps.- Delete
resfolder inside the.aarfile - Delete
android:theme="@style/AppTheme"attribute from theAndroidManifest.xmlinside the.aarfile
- Delete
-
Disable the handling of
SIGXCPUsignal 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
executemethod and runffmpegcommands.
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-ffmpegAPI 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