FFmpeg Unity Bind is a powerful solution to perform all kind of video editing operations. 17 years of Video Programming experience now can be easily integrated into every mobile cross-platform app. Thousands of developers enjoys a power of the product.
FFmpeg Unity Bind is a functionality of complete Video Editor on phones and tablets (Supports IOS + Android).
FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable.
This package offers FFmpeg Binding to Unity + Helpers for quick commands building and callbacks handling. FFmpeg API is easily available inside Unity C # scripting environment to control from code of your app.
In version 3.1 we’ve added Screen Capturing Demo
1. How to use FFmpeg?
Here is a great guide which most people like to start from. If you understand how to use the library which is built for Stand Alone, then it will be easier to work on mobile.
2. Is The FFmpeg Unity Bind works for me?
To make sure that it works on mobile do the same with this Preview Apk DOWNLOAD
Use Absolute paths instead of local. First element of the command (ffmpeg) is no needed on mobile. Test with this build whatever you want to achieve. If it works there it will definitely work from Unity C#.
NOTE: Make sure you are starting every command without “ffmpeg” keyword, because you are already located inside ffmpeg program. So your command should look like -i input.mp4 output.mp3.
Also you can DOWNLOAD Preview REC Apk which is doing actual screen capturing on Mobile Phone. Android is fastest to distribute as a Demo, it works on all rest platforms as well. Often on other platforms you have stronger devices and performance is even higher.
You check the API and documentation here DOWNLOAD
3. Where I can find usage examples?
Here is a great collection of examples VIEW
In the package there are a lot of runtime commands written in C# with UI examples.
4. How can I add custom command to FFmpeg Unity Bind Helpers?
FFmpegCommands.cs is the best place for it. Every command in the examples are implemented with it method like (Convert, Trim etc.) and reusable command elements at the top of the class file.
5. Which filters are included into the FFmpeg lib?
To check available filters download preview build from the point 2. and input -filters command. Original filter name starts after dots. There are several sections order by name (i.e. new alphabetical sequence starts after current section again due to different libraries).
6. Log text in example scene is truncated.
It’s because UnityEngine.UI.Text have limitation on vertices and can’t handle too big texts. You can find full log of operation in ffmpeg_log_to_unity_bind.txt file at Aplication.persistentData folder. NOTE: To access this files you may need Root on Android and software like iExplorer on IOS.
7. Which version of FFmpeg is used?
8. What is the size (weight) of the build?
Unpacked, installed build on IOS device with full library and examples content is 57.4 mb.
Same on android is 79.78mb. APK without example content (UI) is 22mb.
On MacOS ffmpeg binaries weights 35.7 mb and example contents 52.4 mb.
On Windows binaries weights 35.8 and everything else 38.6 mb.
9. What eldest Unity Editor version is supported?
It supports latest editor version. Fine, but what about backward compatibility?
Successful tests were made in older versions up to Unity 5.5.2f1 (is supported).
10. Why FFmpeg doesn’t work on Mac OS?
Please make sure you have all rights to execute ffmpeg binary file in Assets/FFmpeg/Standalone/Mac folder.
You can navigate to this directory in terminal and execute: chmod 700 ffmpeg
11. I have Unknown CPU architecture Exception in Unity 2018.2+ for Android
If you’ve got an exception:
Exception: Unknown CPU architecture for library Assets/FFmpeg/Plugins/IOS/libx264.a
That’s because compiling rules in latest Unity versions were changed.
Before we release auto fix you can deselect “Any Platform” checkbox from libx264.a file which is located under Assets/FFmpeg/Plugins/IOS directory.
Auto-fix should be available in latest package in Asset Store if Unity Team updated packages appropriate during Review process.
12. Screen Recording doesn’t work because I have odd Screen Width or Height.
It’s obvious that you should use normal Device resolution on a Device.
You are Odd newbie if didn’t knew that) Sorry.
Luckily it’s easy to fix and learn everything else.
13. I miss meta files on Prefab.
Meta files are missing you too. It’s easy to predict that you opened package in “not known” Unity Version which is probably newer than origin at time of Development.
Another case is when you need to cleanup Library folder of the Project.
Solution can be open package with Unity version which was used for Uploading.
14. I have IOS crash related to Memory Allocation.
We never had a chance reproduce this issue.
A Developer reported this solution which worked for him:
If solution works for you, say thanks to Developer.
Good luck and have a Happy coding,
Sincerely yours GigaNeo.