Audio Capture Crashes on Android when using Open Level

Hello, I am trying to capture and record my android device’s microphone audio.

I am able to do to, with the audio capture component on my pawn. I ask for the permissions for recording and i can even get the audio from my device and sounds fine, the issue come up if i have to use “open level” after recording. i then get a crash. if i open level before recording everything is fine. but after recording i get a crash on open level.

here is my blueprint setup.

i tried this on my oculus quest 2 but the log did not return an error so i recreated the setup on my phone, one plus 8, and the save issue exists but at least the log has an actual error in it.

and here is the crash log from my device

MICAndroidTest.log (134.9 KB)

any help would be appreciated. thank you!

2 Likes

We had this exact same issue in 4.27.2 and unfortunately believe it is a bug in the engine, we have been able to fix it by patching the engine as follows:

At line 64 in the github link below, if(!InputOboeStream) should be changed to if(InputOboeStream) (exclamation point is gone).

https://github.com/EpicGames/UnrealEngine/blob/4.27.2-release/Engine/Source/Runtime/AudioCaptureImplementations/Android/AudioCaptureAndroid/Private/AudioCaptureAndroid.cpp#L64

To patch the engine, we followed the following guide Building Unreal Engine from Source | Unreal Engine Documentation .

2 Likes

I am having the same problem but in this case from the Editor itself, The origin of the problem is to have the tick marked “Automatic activation” this is happening in Unreal Engine 5.1, however it did not happen in Unreal Engine 5.0.3

1 Like

Reported on github, they should fix it soon.
https://github.com/EpicGames/UnrealEngine/pull/9950

You have 2 options, wait for the fix to be uploaded or compile unreal engine from the source code and change that line of code.


1 Like

The fix is already in the repository, official for both 4.27 plus and 5.1 release. In a short time they will release the patch



1 Like

The problem still happend in 5.1.1

I hope there is a fix in 5.2, any idea on how to customize it to record the audio stream of the device ? I want to get the audio from the device and pipe it to a submix and create VFX using Niagara. How can I do that ?

I am having a exact same problem on my oculus (which is android device). Is Anyone find any solution or workaround without recompiling engine.
My Log:
LogPlayLevel: 10-25 14:02:07.465 29953 30008 D UE4 : Assertion failed: !CaptureSynth.IsStreamOpen() [File:D:/Build/++UE4/Sync/Engine/Plugins/Runtime/AudioCapture/Source/AudioCapture/Private/AudioCaptureComponent.cpp] [Line: 68]
LogPlayLevel: 10-25 14:02:07.465 29953 30008 D UE4 :
LogPlayLevel: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]Assertion failed: !CaptureSynth.IsStreamOpen() [File:D:/Build/++UE4/Sync/Engine/Plugins/Runtime/AudioCapture/Source/AudioCapture/Private/AudioCaptureComponent.cpp] [Line: 68]
LogPlayLevel: 10-25 14:02:07.465 29953 30008 D UE4 :
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: === Critical error: ===
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error:
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: Assertion failed: !CaptureSynth.IsStreamOpen() [File:D:/Build/++UE4/Sync/Engine/Plugins/Runtime/AudioCapture/Source/AudioCapture/Private/AudioCaptureComponent.cpp] [Line: 68]
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error:
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: [Callstack] 0x0000007DEB94C1DC libUE4.so(0x00000000092FC1DC)!FDebug::CheckVerifyFailedImpl(char const*, char const*, int, char16_t const*, …)
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: [Callstack] 0x0000007DEB3451C0 libUE4.so(0x0000000008CF51C0)!UAudioCaptureComponent::FinishDestroy()
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: [Callstack] 0x0000007DEBEF4BF8 libUE4.so(0x00000000098A4BF8)!UObject::ConditionalFinishDestroy()
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: [Callstack] 0x0000007DEBE63D38 libUE4.so(0x0000000009813D38)!IncrementalPurgeGarbage(bool, float)
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: [Callstack] 0x0000007DEBE67230 libUE4.so(0x0000000009817230)!CollectGarbageInternal(EObjectFlags, bool)
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: [Callstack] 0x0000007DEBE68F20 libUE4.so(0x0000000009818F20)!CollectGarbage(EObjectFlags, bool)
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: [Callstack] 0x0000007DEFBA579C libUE4.so(0x000000000D55579C)!UEngine::TrimMemory()
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: [Callstack] 0x0000007DEFBA2C70 libUE4.so(0x000000000D552C70)!UEngine::LoadMap(FWorldContext&, FURL, UPendingNetGame*, FString&)
LogPlayLevel: Error: 10-25 14:02:07.465 29953 30008 D UE4 : [2023.10.25-06.02.07:465][512]LogAndroid: Error: [Callstack] 0x0000007DEFB9FA7C libUE4.so(0x000000000D54FA7C)!UEngine::Browse(FWorldContext&, FURL, FString&)
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error: [Callstack] 0x0000007DEFBA1230 libUE4.so(0x000000000D551230)!UEngine::TickWorldTravel(FWorldContext&, float)
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error: [Callstack] 0x0000007DEF148B34 libUE4.so(0x000000000CAF8B34)!UGameEngine::Tick(float, bool)
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error: [Callstack] 0x0000007DEA3F8FE4 libUE4.so(0x0000000007DA8FE4)!FEngineLoop::Tick()
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error: [Callstack] 0x0000007DEA3F063C libUE4.so(0x0000000007DA063C)!AndroidMain(android_app*)
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error: [Callstack] 0x0000007DEA400104 libUE4.so(0x0000000007DB0104)!android_main()
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error: [Callstack] 0x0000007DEA42F5C8 libUE4.so(0x0000000007DDF5C8)Unknown
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error: [Callstack] 0x0000007F0218A1D8 libc.so(0x00000000000DF1D8)Unknown
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error: [Callstack] 0x0000007F021362EC libc.so(0x000000000008B2EC)Unknown
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error:
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error:
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error:
LogPlayLevel: Error: 10-25 14:02:07.466 29953 30008 D UE4 : [2023.10.25-06.02.07:466][512]LogAndroid: Error:
LogPlayLevel: 10-25 14:02:07.480 29953 30008 D UE4 : [2023.10.25-06.02.07:480][512]LogExit: Executing StaticShutdown

The engine has some bugs related to the capture feature working on Android, as well as on Quest 2 and iOS for example, and these were fixed in RuntimeAudioImporter plugin (it’s completely free and open source): GitHub - gtreshchev/RuntimeAudioImporter: Runtime Audio Importer plugin for Unreal Engine. Importing audio of various formats at runtime.
Runtime Audio Importer in Code Plugins - UE Marketplace

It also automatically requests audio capture permissions.

Here’s documentation specifically about the capturable sound wave (which can capture audio from input devices): 4. Capturable Sound Wave · gtreshchev/RuntimeAudioImporter Wiki · GitHub

This bug has already been fixed