Description
I get an app crash whenever I call Resources.UnloadUnusedAssets after executing something on the library. Im currently testing it with the "-i path -hide_banner" arguments.
Expected behavior
I expect the app not to crash.
Current behavior
The app crashes immediately.
Screenshots
If applicable, add screenshots to help explain your problem.
Logs
https://ghostbin.co/paste/vt9t4
Environment
Other
Add any other context about the problem here.
I have the same problem. I used all the different versions of Unity (2018 LTS to 2019.2), built it for ARMv7 and ARM64 and reduced my app to the minimum. The encoding process is working with sync or async calls and I can repeat them without any problem. But it seems mobileffmpeg/ffmpeg is using resources or memory that belong to Unity.
It crashed when I call:
As long as there was no encoding process started, everything runs fine, but with the start of mobileffmpeg Unity becomes unstable. I spend so much time right now to fix that in Unity, but without success. There must be something within the plugin, not unlinking or discard resources.
I'm happy that I'm not alone anymore with that huge problem. My logs look the same:
signal 11 (SIGSEGV).... Consumer closed input channel or an error occurred.
@cyliax Haha yeah i saw your posts on being able to work with the library Asynchronously and thought you had everything resolved. (If we get this resolved I'll probably ask you about how you got it running asynchronously haha)
On your crashes, I think its always the same thing. I was recording images from a RenderTexture and it always crashed on the 13th image, but i noticed on the memory profiler that every 13th image, without me calling the ffmpeg library previously, the GC allocation got released. So either that means Unity was internally calling UnloadUnusedAssets, or C# was doing GC.Collect and UnloadUnusedAssets calls GC.Collect internally as well.
Reloading a scene in a non-additive fashion causes Unity to call UnloadUnusedAssets as well.
After much testing Im also sure the plugin is mishandling memory in some way that causes the app to panic when garbage collection is done.
Have you manage to find anything in your tests? Today Im gonna try out a couple of things and will post here if I find anything.
Your right, I thought everything is resolved, but with that crashes all the time, it is not. So I wasn't that happy and I haven't shared my solution yet (but I will).
You might be right, that all our problems are coming from the same Resources.UnloadUnusedAsset and GC.Collect somehow. That leads me to disable garbage collection in my single scene with:
GarbageCollector.GCMode = GarbageCollector.Mode.Disabled;
for a test, and you know what: IT IS WORKING! (as long as I'm not reloading the scene)
But of course, that can't be the solution. I would be interesting if a non Unity app using the plugin is crashing as well, when calling Javas System.gc().
@cyliax Huh really? I did test disabling Garbage Collection but got the crash anyways, but even then disabling garbage collection makes the app a ticking bomb until it crashes haha
Tried a lot of things to resolve this, unfortunately I wasn't successful.
So yeah, I retried @cyliax 's mode of disabling the Garbage Collection and it works. Ive also managed to get it running asynchronously but without disabling the garbage collector the app crashes without finishing processing the video.
Ive tried researching a lot on what could be causing this, and apparently it should be an error from the unmanaged part of code (the C part) but obviously the ffmpeg library is immense and would take a long time to figure out which part causes the issue. So ideally we should try and find where the issue is.
Ive got this trace:
`11-25 16:00:47.029 8062 8081 E CRASH : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0013c288
11-25 16:00:47.029 8062 8081 E CRASH : * *
11-25 16:00:47.029 8062 8081 E CRASH : Build type 'Release', Scripting Backend 'il2cpp', CPU 'armeabi-v7a'
11-25 16:00:47.029 8062 8081 E CRASH : Build fingerprint: 'samsung/beyond2qlteue/beyond2q:9/redacted/Gredacted:user/release-keys'
11-25 16:00:47.029 8062 8081 E CRASH : Revision: '17'
11-25 16:00:47.029 8062 8081 E CRASH : pid: 8062, tid: 8081, name: UnityMain >>> com.redacted.redacted <<<
11-25 16:00:47.029 8062 8081 E CRASH : r0 c8906bc0 r1 00000000 r2 00000000 r3 00000000
11-25 16:00:47.029 8062 8081 E CRASH : r4 00000000 r5 c8905aa0 r6 c962e680 r7 00000005
11-25 16:00:47.029 8062 8081 E CRASH : r8 00000000 r9 00000000 sl 00000001 fp caafe970
11-25 16:00:47.029 8062 8081 E CRASH : ip c9628e2c sp caafe950 lr c8906868 pc 0013c288 cpsr c06f8700
11-25 16:00:47.029 8062 8081 E CRASH :
11-25 16:00:47.029 8062 8081 E CRASH : backtrace:`
If we can find a way to translate the trace to something more readable that could help.
Hello,
I'm currently facing the same issue. Is there any progress on your side?
I might try a workaround by exporting Unity into an Android project and add the library in the native app, where Unity project will be a in a different library (https://forum.unity.com/threads/integration-unity-as-a-library-in-native-android-app-version-2.751712/). I'm not sure thought if that will fix the problem.
Has anybody had success with this garbage collection/crash problem? I could cry because I'm loosing day after day and nothing helps. Extracted AAR to JAR, using instance calls except of static, switching back to sync calls, updating Unity to 2019.3.6f1, updating mobile-ffmpeg to 4.3.1, checking and unchecking options in unity... and so on.
At the moment I'm still switching off garbage collection at app start, then I have an overlay button to enable garbage collection and call Resources.UnloadUnusedAssets() or GC.Collect(), and switching it off again.
I can press that button as often as I like before mobile-ffmpeg was running. But when I started a successful ffmpeg conversion and I press that button once or twice... crash, without a helpful crash log via ADB.
@tanersener if I could send you a simple Unity example scene with everything you need, It would be awesome if you'd have a look. Would it help to support you with some money via your donation channel?
Any help is highly appreciated, thank you for your great work.
@cyliax created my own sample project to demonstrate this issue. Unfortunately, I don't have any ideas about the solution. This integration is too complex for me. I think someone who has experience in loading native libraries inside Unity can help us solve this.
I have a question about the crash scenario.
As far as I understand, application crashes when MobileFFmpeg is not used and one of theResources.UnloadUnusedAssets()/GC.Collect() methods is executed.
My question is; what happens when Resources.UnloadUnusedAssets()/GC.Collect() is called when FFmpeg.execute() is still executing the command. Does your application crash in that case too?
I found a workaround and it this also answers your question a bit (I will build your scenario today):
My workaround for now:
As long as MobileFFmpegplugin wasn't startet I let Unity decide when to call Resources.UnloadUnusedAssets() or call it by myself as normal.
After the plugin was started, it is possible to run Resources.UnloadUnusedAssets() ONCE but not TWICE. So at the moment when I'm starting the plugin I disable Unity's automatic GC and after that I'm using a little helper which is doing a dummy call to the plugin just asking MobileFFmpegfor its "-version" and call Resources.UnloadUnusedAssets() after that (everywhere in my app).
This sounds stupid but it is working, the app isn't crashing anymore when I do this dummy call before GC. GC is done, when the completeHandlerof the async call was exectuted and the plugin as already set back to null in Unity.
Now back to your question: I'll try calling GC during encoding...
Hey @tanersener! I've experienced something similar, where Android is crashing silently when trying to load an asset after using ffmpeg (doesn't have to be the asset that was just generated).
No error is given or exception thrown before the crash so it makes it very difficult to track, but after some research we were able to figure out that it was only ever happening when making certain calls AFTER using mobile-ffmpeg. The same call made before using ffmpeg does not cause the app to crash.
Hey guys. I use ffmpeg for operations on audio data, e.g. generating .ogg files. In my cases, @cyliax 's solution doesn't work. Has anyone else succeeded in making Unity not crash after encoding?
I build mobile-ffmpeg.arr with lots of comments on the native side written in c and tried different things. In the "fftools_ffmpeg_opt.c" file in "ffmpeg_parse_options(int argc, char **argv)" method, I removed call to "term_init ();". After that it seems to work with Unity without crash. I'm not a "c" guy, don't understand why it's not crashing after that and don't know consequences of removing this call.
Someone?
void term_init(void)
{
#if HAVE_TERMIOS_H
if (!run_as_daemon && stdin_interaction) {
struct termios tty;
if (tcgetattr (0, &tty) == 0) {
oldtty = tty;
restore_tty = 1;
tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
tty.c_oflag |= OPOST;
tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
tty.c_cflag &= ~(CSIZE|PARENB);
tty.c_cflag |= CS8;
tty.c_cc[VMIN] = 1;
tty.c_cc[VTIME] = 0;
tcsetattr (0, TCSANOW, &tty);
}
signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
}
#endif
signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
#ifdef SIGXCPU
signal(SIGXCPU, sigterm_handler);
#endif
#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN); /* Broken pipe (POSIX). */
#endif
#if HAVE_SETCONSOLECTRLHANDLER
SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE);
#endif
}
P.S. @tanersener I love you man for this project :)
I did further tests, which showed that after removing the following line, Unity no longer crash after encoding and calling Resources.UnloadUnusedAssets().
file fftools_ffmpeg.c -> void term_init(void)
signal(SIGXCPU, sigterm_handler);
Anybody knows what's going on? SIGXCPU signal means "CPU time limit exceeded".
This is signal handler:
static void
sigterm_handler(int sig)
{
int ret;
received_sigterm = sig;
received_nb_signals++;
term_exit_sigsafe();
if(received_nb_signals > 3) {
ret = write(2/*STDERR_FILENO*/, "Received > 3 system signals, hard exiting\n",
strlen("Received > 3 system signals, hard exiting\n"));
if (ret < 0) { /* Do nothing */ };
exit(123);
}
}
That are great news, Thanks for your test to find out where those crashes come from. Unfortunately I'm not a C guy as well, so I can't give you support. But I'll try your approach to get rid of my workaround routine. Using UnloadUnsedAssets as normal would be awesome.
@wloczykij89 sigterm_handler is a common structure used in C applications. It is used to handle signals sent by Operating System.
I'm not sure whether your solution is fixing the problem or postponing it. Because not handling a signal looks scary a little bit. Is it possible to test which statement in sigterm_handler is causing the crash?
@tanersener I totally agree with you and treat this as a clue to finding the real cause of the error. But damn, in my test project, it works after that change :/ Maybe I'll do more tests on a complex project and different devices.
The specific line of code that cause crash in sigterm_handler (int sig):
exit(123);
I have created test handler only for SIGXCPU:
signal (SIGXCPU, test_sigterm_handler);
"test_sigterm_handler" with logs and commented out "exit(123)" line:
static void test_sigterm_handler(int sig)
{
int ret;
received_sigterm = sig;
received_nb_signals++;
term_exit_sigsafe();
int signal_id = received_nb_signals;
av_log(NULL, AV_LOG_WARNING, "sigterm_handler 1 - signal_id: %d, sig: %d.\n", signal_id, sig);
if(received_nb_signals > 3) {
ret = write(2/*STDERR_FILENO*/, "Received > 3 system signals, hard exiting\n",
strlen("Received > 3 system signals, hard exiting\n"));
av_log(NULL, AV_LOG_WARNING, "sigterm_handler 2 - signal_id: %d, sig: %d, ret: %d.\n", signal_id, sig, ret);
if (ret < 0) { /* Do nothing */ };
// cause Unity crash if call Resources.UnloadUnusedAssets() or GC.Collect()
//exit(123);
}
av_log(NULL, AV_LOG_WARNING, "sigterm_handler 3 - signal_id: %d, sig: %d.\n", signal_id, sig);
}
During encoding, "test_sigterm_handler" may invoke several times or not at all.
After encoding and calling Resources.UnloadUnusedAssets() or GC.Collect(), "test_sigterm_handler" is invoked every time. Logcat output:
05/31 00:16:28.518 30049 30062 Warn Unity Call Resources.UnloadUnusedAssets();
05/31 00:16:28.518 30049 30062 Warn Unity #0 0x5fe15df9 (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #1 0x604ec57f (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #2 0x5fffc185 (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #3 0x5fffc0f3 (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #4 0x61e7e174 (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #5 0x621cfe70 (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #6 0x61e71850 (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #7 0x61e79a80 (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #8 0x62162d20 (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #9 0x61ff36ec (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #10 0x61cb9fa4 (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #11 0x61cb9250 (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #12 0x61cb8f0c (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #13 0x61b4443c (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #14 0x61bc2838 (libil2cpp.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #15 0x5ff8efbd (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #16 0x5ff97df7 (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #17 0x5ff9e12b (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #18 0x5fe6f903 (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #19 0x5ff0594d (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #20 0x5ff05969 (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #21 0x5ff05aff (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #22 0x5ffde15d (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #23 0x5ffeb9dd (libunity.so) ? 0x0
05/31 00:16:28.518 30049 30062 Warn Unity #24 0x418d290c (libdvm.so) dvmPlatformInvoke 0x70
05/31 00:16:28.518 30049 30062 Warn Unity #25 0x41903bbd (libdvm.so) dvmCallJNIMethod(unsigned int const*, JVal
05/31 00:16:28.538 30049 30127 Warn mobile-ffmpeg sigterm_handler 1 - signal_id: 1, sig: 24.
05/31 00:16:28.538 30049 30127 Warn mobile-ffmpeg sigterm_handler 1 - signal_id: 1, sig: 24.
05/31 00:16:28.538 30049 30127 Warn mobile-ffmpeg sigterm_handler 3 - signal_id: 1, sig: 24.
05/31 00:16:28.538 30049 30127 Warn mobile-ffmpeg sigterm_handler 3 - signal_id: 1, sig: 24.
05/31 00:16:36.762 30049 30049 Info View Touch down dispatch to android.view.SurfaceView{41ca62d0 VFE..... .F....I. 0,0-1280,800 #7f010000 app:id/unitySurfaceView}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=1035.1913, y[0]=779.02625, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=789991175, downTime=789991175, deviceId=2, source=0x1002 }
05/31 00:16:36.763 30049 30049 Info View Touch down dispatch to com.unity3d.player.UnityPlayer{41c9bfa8 V.E..... ......I. 0,0-1280,800}, event = MotionEvent { action=ACTION_DOWN, id[0]=0, x[0]=1035.1913, y[0]=779.02625, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=789991175, downTime=789991175, deviceId=2, source=0x1002 }
05/31 00:16:36.891 30049 30049 Info View Touch up dispatch to com.unity3d.player.UnityPlayer{41c9bfa8 V.E..... ......I. 0,0-1280,800}, event = MotionEvent { action=ACTION_UP, id[0]=0, x[0]=1035.1913, y[0]=779.02625, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=789991306, downTime=789991175, deviceId=2, source=0x1002 }
05/31 00:16:36.909 30049 30062 Warn Unity Call GC.Collect()
05/31 00:16:36.909 30049 30062 Warn Unity #0 0x5fe15df9 (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #1 0x604ec57f (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #2 0x5fffc185 (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #3 0x5fffc0f3 (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #4 0x61e7e174 (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #5 0x621cfefc (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #6 0x61e71850 (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #7 0x61e79a80 (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #8 0x62162d20 (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #9 0x61ff36ec (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #10 0x61cb9fa4 (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #11 0x61cb9250 (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #12 0x61cb8f0c (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #13 0x61b4443c (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #14 0x61bc2838 (libil2cpp.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #15 0x5ff8efbd (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #16 0x5ff97df7 (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #17 0x5ff9e12b (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #18 0x5fe6f903 (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #19 0x5ff0594d (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #20 0x5ff05969 (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #21 0x5ff05aff (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #22 0x5ffde15d (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #23 0x5ffeb9dd (libunity.so) ? 0x0
05/31 00:16:36.909 30049 30062 Warn Unity #24 0x418d290c (libdvm.so) dvmPlatformInvoke 0x70
05/31 00:16:36.909 30049 30062 Warn Unity #25 0x41903bbd (libdvm.so) dvmCallJNIMethod(unsigned int const*, JValue*, Method const*,
05/31 00:16:36.911 30049 30127 Warn mobile-ffmpeg sigterm_handler 1 - signal_id: 2, sig: 24.
05/31 00:16:36.911 30049 30127 Warn mobile-ffmpeg sigterm_handler 1 - signal_id: 3, sig: 24.
05/31 00:16:36.911 30049 30127 Warn mobile-ffmpeg sigterm_handler 3 - signal_id: 2, sig: 24.
05/31 00:16:36.911 30049 30127 Warn mobile-ffmpeg sigterm_handler 3 - signal_id: 3, sig: 24.
05/31 00:16:36.914 30049 30066 Debug dalvikvm threadid=17: interp stack at 0x6d521000
05/31 00:16:36.915 30049 30066 Debug dalvikvm threadid=17: bye!
05/31 00:16:36.915 30049 30066 Debug dalvikvm threadid=17: interp stack at 0x6d521000
05/31 00:16:36.915 30049 30066 Debug dalvikvm threadid=17: bye!
05/31 00:16:56.558 30049 30054 Debug dalvikvm GC_CONCURRENT freed 2956K (86629), 51% free 3164K/6420K, paused 2ms+1ms, total 30ms
@wloczykij89 Thanks for doing these tests. I think you've already found the real cause of this issue.
If you ask google SIGXCPU Mono you can see that there are similar issues created by other Unity users. It looks like Unity uses Mono framework and Mono uses SIGXCPU internally for GC. That's why this signal is sent when Resources.UnloadUnusedAssets() or GC.Collect() is called. You can see this information in signal handling section of official Mono documentation.
The solution is to ignore SIGPWR and SIGXCPU signals. Unfortunately, these two signals still have to handled for non-Unity users. So I can't disable them totally. I'll try to find a solution for that.
Added a new API method, ignoreSignal, to ignore signals in the development branch. You can use this method to ignore SIGXCPU signal under Unity. Other frameworks that use Mono framework can benefit from that method too. As far as I know Xamarin also uses Mono framework.
ignoreSignal is added for both Android and iOS/tvOS platforms, it will be included in the next MobileFFmpeg release.
Android
Config.ignoreSignal(Signal.SIGXCPU);
iOS/tvOS
[MobileFFmpegConfig ignoreSignal:SIGXCPU];
July 2020.
Awesome, I'll try this as soon as I can. Hopefully I can remove my stupid garbage collection workarounds. Great work!
Hi cyliax and tanersener,
I'm seeing the same crash on my side too using Unity 2019, do you have a link to download an Android LTS binary so I could test it on my side too?
Thanks.
@shpitsmedia You can use this dev build for testing, mobile-ffmpeg-min-4.3.3.LTS.aar.
@tanersener Amazing, it works! can you please also send me a link to the full LTS version?
Thank you so much for your help!
I don't have a full LTS dev build. You can build it yourself though.
@tanersener This is a bit over my head :) do you know when you are going to release the next release?
Again, thanks a lot for the help!
July 2020.
@tanersener Excellent, its just around the corner, thanks again!
@tanersener Hi again, we've got a little problem, we're trying to merge 2 mp4 videos using -filter_complex concat but it seems that without libx264 the output video is very low quality, do you have a clue how can it be done without using GPL if even possible?
@shpitsmedia You don't have too many options there. You can try to use vp8 or vp9, but they're slow. Increasing the quality of mpeg4 can be a better option. Can you try using some of the options given here or manually set the profile with something like -profile:v 15.
@tanersener mpeg4 works, thank you so much for the help!
Hi, I just tried the MobileFFmpeg 4.4 (not the LTS) in Unity 2019.4.5f1 and it works. Many thanks :). You do a great job.
Here is the the code I used in Unity in case someone struggles with it:
using (AndroidJavaClass configClass = new AndroidJavaClass("com.arthenica.mobileffmpeg.Config"))
{
AndroidJavaObject paramVal = new AndroidJavaClass("com.arthenica.mobileffmpeg.Signal").GetStatic<AndroidJavaObject>("SIGXCPU");
configClass.CallStatic("ignoreSignal", new object[] { paramVal });
using (AndroidJavaClass ffmpeg = new AndroidJavaClass("com.arthenica.mobileffmpeg.FFmpeg"))
{
cmd = " -i " + <input_path> + <output_path>; // put your ffmpeg command here
int rc = ffmpeg.CallStatic<int>("execute", new object[] { cmd });
Debug.Log("MobileFFmpeg result: " + rc);
}
}
I'm also attaching .unitypackage with dependency solver (Unity project just needs to be set up for it to work) and very rough iOS wrapper. Let's hope it helps.
mobile-ffmpeg-unity.zip
Thanks again and keep up the good work :).
Fixed and released in v4.4.
Most helpful comment
Hi, I just tried the MobileFFmpeg 4.4 (not the LTS) in Unity 2019.4.5f1 and it works. Many thanks :). You do a great job.
Here is the the code I used in Unity in case someone struggles with it:
I'm also attaching .unitypackage with dependency solver (Unity project just needs to be set up for it to work) and very rough iOS wrapper. Let's hope it helps.
mobile-ffmpeg-unity.zip
Thanks again and keep up the good work :).