-
-
Notifications
You must be signed in to change notification settings - Fork 800
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. -
Patch the
mobile-ffmpeg-<package>-<version>.aar
file using an editor likemc
or by extracting the.aar
file into a directory and creating it again- Delete
res
folder inside the.aar
file - Delete
android:theme="@style/AppTheme"
attribute from theAndroidManifest.xml
inside the.aar
file
- Delete
-
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 as described in README.
Copyright (c) 2018-2021 MobileFFmpeg