Products

FFmpeg Unity Bind

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 Unity Bind at Unity 3d Asset Store

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

F.A.Q.

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?

Android: 3.0.1
IOS: 3.3
MacOS 3.4.1
Windows 3.4.1

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.

37 comments to FFmpeg Unity Bind

  • Mauricio de Souza Ferreira

    Hello, grate job.
    This bind support pipe? Because I need send image buffer and audio at runtime frame by frame from unity to ffmpeg.
    Thanks.

    Reply
    • Giga Admin

      Hi Mauricio
      We didn’t test pipe feature. In the bind there is used usual ffmpeg build with command line interface so potentially it should work. To make sure please check Preview APK.

      Reply
  • Maxim

    Hi,

    this asset looks intresting. Do you have any idea if your code is adaptable for UWP deployment using FFMPEG interop? If not, do you want to add this functionality in future releases?

    Thanks

    Reply
    • Giga Admin

      Hi Maxim, thanks for interesting FFmpeg Unity Bind. Let me sure you that it is amazing and most powerful video editing library. We are planning support of Mac OS and Windows soon. Maybe we’ll include UWP to Windows part depending on how well it go.

      Reply
  • Thomas

    Hi, is it possible to “transcode” a video to keep the per pixel transparency for android at run-time. (not in the editor but in the game engine).

    Reply
  • mossman

    biz@giganeo.comHello,

    I am very interested in your Unity plugin called FFmpeg Unity Bind. But i need some info to check if the plugin features satisfies my project needs.

    We are developing a app for iOS and Android usign Unity. This app must do:
    1- Record very short video from the screen.
    2- Preview the recorded video.
    3- Add sound to the recorded vídeo. (If the duration of the sound is less than the duration of the video, the sound must be repeated. If the duration of the sound is longer than the duration of the video, the sound must be trimmed.)
    4- Save the video in the device (video gallery).
    5- Share this video in social networks.

    FFmpeg Unity Bind Can that do points 1, 2, 3 and 4?

    Thanks!

    Reply
    • GigaAdmin

      It’s a very multi-functional tool. Most listed points can be achieved with some integration steps.
      1. There is FFmpegREC demo scene with screen recording example.
      2. After recording video you have a callback with a path to created video file. In the demo this path is passes to default device player for demonstration, but you can do even more using Unity Video Player. In this way you can play recorded video on custom surfaces, such as 3d geometry.
      3. There is Add Sound demo feature to set new sound of video. Other logic should be on application side.
      4. As mentioned in point 2. you have path to created video, so can easily move it to gallery: File.Move(appStoragePath, galleryPath).

      Reply
  • Michele

    Hi, is it possible record (for example 20 seconds) a video of the screen of ipad during a game and save it into camera roll of ipad?
    Thank you

    Reply
    • GigaAdmin

      Yes you can record video of desired duration and in the end get a callback with a file path to captured video. With this path you can move or copy file as you wish. The package requires coding skills.

      Reply
  • TamV

    Hi,
    Is it possible to live streaming to rtmp server?

    Reply
  • Valentin

    Hello. How to check screen recording functions by ffmpeg on Android/iOS? Maybe you have compiled apk or command for SampleFFmpeg.apk?

    Reply
  • Umair Bhatti

    Hi, I have purchased your FFmpeg Unity Bind plugin. The main focus to buy this to record my app screen and it does that pretty well but i encounter an issue which i didn’t foreseen before that my unity app also contain sound and i also need that sound to be in captured video. Right now its not capturing audio. Does your plugin do that? Please help me out on this that i can be able to get audio in my video somehow.

    Reply
    • GigaAdmin

      In version 3.2 Audio Recording support is added.

      Reply
      • Umair Bhatti

        Thanks for the reply i will look in to it.
        Is there any way so that without saving these textures on location i directly provide array of textures to ffmpeg to create video?

        Reply
        • GigaAdmin

          Hi Umair
          FFmpeg exists a long time before array of textures. It is designed to work with file paths.

          Reply
      • Umair Bhatti

        I created a build for windows full screen when i call stop my screen got full black. I tested the demo in separate build it also crashed and its generate an log in which it says : Read from location 00000000 caused an access violation.

        Reply
        • GigaAdmin

          Hi Umair

          Make sure you have all rights to use ffmpeg binary file in \Assets\FFmpeg\Standalone\Win directory.
          You can even replace it with new one from HERE (choose Release Windows-64bit Static) and rename as original without extension.

          Cheers!

          Reply
  • Arvind

    How do I redirect output to receive the stream as bytes ?

    Reply
    • GigaAdmin

      Hi Arvind
      Usual use case is to work with files. Take a look at this info as well.
      Have a good luck with a project!

      Reply
  • Maxime

    Hi, i want to purchase this (good, i think) asset. But, before, i want to know if i can use all ffmpeg command and bind this in Unity with your asset. Like get metadata or get all frames of a video. If i want use ffmpeg command in unity with your asset, i just must implement binding with your asset ?

    Best regards,

    Reply
    • GigaAdmin

      Hi Maxime,

      All you have to do is import the package, put FFmpeg prefab into your scene and call this static method FFmpegCommand.DirectInput(string cmd).
      Also you will find a lot of helpers and useful presets in the plugin.

      Good luck with a project and have a happy coding!

      Reply
      • Maxime

        Thanks for the reply !

        Reply
    • Maxime

      I found an answer myself. Thanks for this asset ! Cheers !

      Reply
  • Maxime

    Hi,

    Do you think add FFProbe on your project ? Because, i added FFProbe and it works but, i have problem to add in the Android Plugin. Is it possible to have your Android project to add myself Ffprobe and generate classes.jar and .aar ? I think i have dependencies problems and i’m not a Java developer 😉

    Thank for your work !

    Reply
    • GigaAdmin

      It might be a good idea.
      Thank you for warm words.
      Meanwhile you can just input (-i) file and parse detailed information received from output.

      Have a happy coding and Good Luck with a Project!

      Reply
  • John Ferreira

    I keep getting the following exception when I run my scene:

    NullReferenceException: Object reference not set to an instance of an object
    FFmpeg.FFmpegParser.Handle (System.String message) (at Assets/FFmpeg/FFmpegCode/FFmpegHelpers/FFmpegParser.cs:38)
    FFmpeg.FFmpegWrapper.Update () (at Assets/FFmpeg/FFmpegCode/FFmpegWrapper.cs:92)

    Also I have this function call in my code but nothing happens:

    cmndText = “ffmpeg -i ‘/Users/johnferreira/CIS498_Senior_Design/Project/UAV Simulator/UAV Simulator copy/Assets/FrameshotsTemp/frame_640x480.jpg’ -f mpegts udp://127.0.0.1:9050”;

    FFmpegCommands.DirectInput(cmndText);

    Reply
    • GigaAdmin

      Hi John Ferreira

      You have to put FFmpeg.prefab into your scene to start work.

      Good luck with a project!
      Sincerely Yours,
      GigaNeo

      Reply
  • Yubeen jeong

    Do you have any plans to support Android 64 bit?

    Reply
  • JH

    I am very interested in your Unity plugin called FFmpeg Unity Bind. But i need some info to check if the plugin features satisfies my project needs.

    We are developing a program for windows using Unity.
    But when we used other assets, can work in unity. but can’t work in build exe.
    that’s problem is ffmpeg process not start.
    If we use this plugin, Is ffmpeg process can start?
    Thanks!

    Reply
    • GigaAdmin

      FFmpeg Bind 2 always starts processes.
      Including IL2CPP builds.
      There is a bonus solution for this:)
      Good luck with a project! 🙂

      Reply
  • sukim

    hello

    I am a FFmpeg Unity Bind asset buyer.
    I used the asset well.
    But there is one problem.
    The function does not work properly when there are spaces in the file path.
    I wonder if there is a workaround for this problem.

    Thank You.

    Reply
    • GigaAdmin

      Yes, this is standard case.
      Path which contains spaces should be enclosed with double quotes like this “path with spaces”.
      Good luck with a project! 🙂

      Reply

Leave a Reply to Maxime Cancel reply

Comment
Name*
Mail*
Website*