FFmpeg for Unity

Hi guys!

For everybody struggling for video editor functionality on mobile.
Here you go: FFmpeg is integrated into Unity Editor and is reachable from C# code.
Platforms: Windows, Mac OS, IOS, Android.

Available at GitHub:

What you can do:

  • Convert formats
  • Video to Audio
  • Create video from images and sounds
  • Extract images and sounds from video
  • Record video with audio

Also there is available powerful console for direct control of any ffmpeg features:
https://ffmpeg.org

There is a detailed documentation included into the package, check it out.
Cheers!





4 Likes

Isn’t FFMPEG licensed under the GPL/LGPL? I’m not sure that 3rd party libraries that are licensed under those licenses are allowed on the asset store.

See Asset Store Provider Agreement section 5.10.4

2 Likes

The product is not a library itself. The product is an integration it to Unity3d.
You can make it by yourself or buy with a price of one working hour.
Cheers

hey,

can i use it to merge a mp4 file with wav/mp3 audio?
Also, how long would it takes you to add iOS support? I need it for this week… :slight_smile:

1 Like

Hi!! Great that someone finally implemented it! Although for my needs right now i just needed to know if its possible to merge a mp4 video file (example videoplayback.mp4) with a m4a audio file (exampple videoplayback.m4a) and giving a new file called for example output.mp4.

I think its possible using ffmpeg using this command “ffmpeg -i videoplayback.mp4 -i videoplayback.m4a -c:v copy -c:a copy output.mp4”, would it be possible in unity with your asset (for android)?

If so, id be really interested to have it for android but also for ios!!!

Thanks

1 Like

Hi guys.

Thank you for join our video processing community.

Try to achieve what you are trying to do with this native Android solution.
APK with direct command line:
https://github.com/writingminds/ffmpeg-android-java/releases/download/v0.3.2/app-debug.apk
If it works - It will work in our FFmpeg Unity Bind from C# code as well.

I believe IOS version will be developed some day.
Keep in touch for updates.

Cheers.

P.S. Don’t hesitate to contact our team for development services when you need to extend this product functionality.

1 Like

Yeahhhh!!! It worked!!! So i can call the command by code in C# with your plugin? Do i have any instructions on how to do it after i buy it?

Basically i called this command:

-i videoFileAbsolutePath -i audioFileAbsolutePath -c:v copy -c:a aac -map 0:v:0 -map 1:a:0-shortest destinationAbsolutePath

Thanks :slight_smile:

1 Like

Just bought it!!! And it works!! Awesome!!! Just what i needed!! I was even able to merge watermark in the video with it!!! So cool!!!

So now, we are just needing it for ios :wink: !!! Please please please :slight_smile:

1 Like

Hi All

I’m glad to anounce you a global upgrade of FFmpeg Unity Bind:

  1. Full IOS Support
  2. New Presets:
  • Compress
  • Append / Concat Fast (For same codec)
  • Append / Concat Full (Re-encoding)
  1. Progress Bar Feature
  2. Processing callbacks on correct thread
  3. Debug, Improvements, Optimization

FFmpeg is a 17 years of Video Processing experience. You’ll find everything what you need with this package.
Have a fun in development.
Good luck!

P.S. Don’t hesitate to contact our team for development services when you need to extend this product functionality.

1 Like

So good to suddenly find out that you added iOS support :slight_smile:
I will definitely buy your asset now. Btw is it possible to merge a video file and a audio file from a specific point? Like taking all the video and only a portion of the audio?
Thanks!!!

I’m glad that you enjoy the product.

Here is how you can append sound to video in usual cases:
-y -i video.mp4 -i sound.wav -map 0:v:0 -map 1:a:0 result.mp4

Here is how you can cut the audio file:
-ss 0 -t 30 -i file.mp3 output.mp3

It is a little bit more challenging to make a start offset when merging it with video. Try like this:
-y -i a.mp4 -itsoffset 00:00:30 sng.m4a -map 0:0 -map 1:0 -c:v copy -preset ultrafast -async 1 out.mp4

Cheers!

1 Like

Dear Developers

I’m glad to announce our F.A.Q. section where you can learn cases which other teams met.

It will be updated and boosted, by all our video programmers community. I hope you’ll find it useful. To become a part of video development community you just have to post reply to F.A.Q comments or this thread when people ask.

Good luck and let The Force will be with you.

This looks great. For converting image sequences to video, does anyone know if unity’s Texture format can be used? Or will everything first need to be converted to a file first?

Hey Eric_Bates
Usual workflow is when you first save to the file and then work with an absolute path.
If we find opportunity to pass files into FFmpeg lib in another way, we publish update or information how to do it within Unity.

Hi @Max-Bot , thanks for letting me know!

I was wondering if there’s a way where I can append images at the end of video. I’m capturing an image every 10th frame and approximately after 10 seconds I want all the images captured encoded into video. I tried the traditional way of saving all the captured images and then running the //-y -i .../image%1d.jpg -r 30 video.mp4 ffmpeg command but this takes like 15-20 seconds on Android, not tested iOS yet. Wondering if there’s a way where I can encode these images on the fly to be part of one single video output ? I’ve been googling for the last couple of days but none of the solution I’ve seen so far has worked for me. Also, in all of this, there is no audio involved at all.

Any help/pointers would be much appreciated.

@Max-Bot

Hi kushG

You can take a look to this thread:
https://stackoverflow.com/questions/18452058/ffmpeg-concat-videos-and-images

The idea is to convert every single image to extreme short video of certain codec.
At the end you can append all this videos with muxing instead of encoding.
It’ll speed-up process a lot.

Cheers!

Hi

Does your implementation of FFmpeg include any screen recording functionality? I found this page in the wiki describing how to do it for desktop, but is it possible on iOS and Android?
https://trac.ffmpeg.org/wiki/Capture/Desktop

Dear Video Developers

I’m glad to present to you an upgrade of FFmpeg Unity Bind - version 3.1
Now it supports Mac OS and Windows.
That means you can test video operations right in the Editor before deploy to mobile!

NOTE: Some things may differs on standalone vs mobile due to very different hardware. Always do final testing on end destination device.

Also we’ve included SCREEN CAPTURING DEMO.
It is absolutely cross-platform and easy to use.

We’ve added extra UI presets / Examples:

  • Adding sound to existing video
  • Adding your own watermark with scale and position parameterization.

Good luck with your projects.
Cheers!

Hi Peter

Yes, take a look to a new upgrade (version 3.1):
https://assetstore.unity.com/packages/tools/video/ffmpeg-unity-bind-93622