Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Using MobileFFmpeg in Unity

Taner Sener edited this page Aug 27, 2019 · 3 revisions

1. Android

  • 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 like mc 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 the AndroidManifest.xml inside the .aar file
  • Use the following code block to call execute method and run ffmpeg 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);

2. iOS / tvOS

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.

Clone this wiki locally