I'm having trouble recording audio when capturing video with NrealLight

Hello!

I’m having trouble with the “First Person View Video Capture” function of NRSDK, please help me.

I have installed NRSDK 1.6.0 in my Unity project and opened the demo scene NRSDK/Demos/RGBCamera-Record.unity.

This is what the scene looks like when opened.

I was able to build the scene and run the app successfully with NrealLight.

If I turn off useAudio, the video caputure was successful, and I saw that the MP4 file was generated and played correctly.

But, when I turn on useAudio, the video capture failed. Specifically, the MP4 file was generated, but it was corrupted and could not be watched properly.

I have already added <uses-permission android:name="android.permission.RECORD_AUDIO" /> to Assets\Plugins\Android\AndroidManifest.xml.

Does anyone else have similar symptoms?

Thank you.

Development environment

  • PC OS version: Windows 10 64bit
  • Unity version: 2019.4.29f1
  • NRSDK version: 1.6.0
  • Smartphone OS version: Android 11
  • Glass Device: NrealLight

Yeah, this is the part they don’t tell you about :yum:

If you go to the app’s permissions in your phone, you’ll find the Microphone permission there, but it set to ‘denied’. You’ll have to manually flip it to ‘allowed’ for the video recordings to work.

The user-permission you added to to the AndroidManifest.xml file will add the permission, but it will not set it to allowed. You have to do that manually :+1:

Thanks for your reply!

I was not clear enough in my explanation.
I had manually set the microphone access permissions to allow.

I looked into how to reproduce the symptoms again, then I found that the behavior was different between the first launch right after the app installation and the second and subsequent launches.

First launch right after installation

I turn on “useAudio” and press the “Start” button.
(At this time, a dialog box will appear asking me to confirm the microphone access rights, so I select “Allow”.)

After a few seconds, I press the “Stop” button to stop the capture.
(At this time, the saved file will be called “Video A.”)

Launch for the second time or later

I turn on “useAudio” and press the “Start” button.
(At this time, the dialog will not appear.)

After a few seconds, I press the “Stop” button to stop the capture.
(At this time, the saved file will be called Video B.)

I press the “Start” button again, and press the “Stop” button again.
Then, the application will freeze.
(At this time, the saved file will be called Video C.)

Video B captured video and audio correctly, but Video A and Video C did not capture any image or sound and could not be played back correctly.

Thank you for your support.