Search Unity

NatCorder - Video Recording API

Discussion in 'Assets and Asset Store' started by Lanre, Nov 18, 2017.

  1. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    Delete and reimport NatCorder into your project. Then delete and rebuild your Xcode project from Unity.
     
  2. Bongo_Studios

    Bongo_Studios

    Joined:
    Jan 26, 2019
    Posts:
    33

    This is the full log

    I tried the ReplyCam example.
    it's crashing as soo as I open the app (Xiaomi Redmi Note 4x)

    Code (CSharp):
    1. 12-02 19:34:09.019: I/udios.Guitarin(12146): Late-enabling -Xcheck:jni
    2. 12-02 19:34:10.141: W/DynamiteModule(12146): Local module descriptor class for com.google.firebase.auth not found.
    3. 12-02 19:34:10.171: V/FA(12146): Deferring to Google Analytics for Firebase for event data collection. https://goo.gl/J1sWQy
    4. 12-02 19:34:10.172: D/FirebaseAuth(12146): Notifying id token listeners about user ( J5FcinDdAFQriCjJTrENTtKJpOO2 ).
    5. 12-02 19:34:10.177: I/FirebaseInitProvider(12146): FirebaseApp initialization successful
    6. 12-02 19:34:10.179: W/DynamiteModule(12146): Local module descriptor class for com.google.firebase.auth not found.
    7. 12-02 19:34:10.186: W/udios.Guitarin(12146): Unsupported class loader
    8. 12-02 19:34:10.190: W/udios.Guitarin(12146): Skipping duplicate class check due to unsupported classloader
    9. 12-02 19:34:10.191: I/FirebaseAuth(12146): [FirebaseAuth:] Preparing to create service connection to gms implementation
    10. 12-02 19:34:10.194: I/DynamiteModule(12146): Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
    11. 12-02 19:34:10.195: I/DynamiteModule(12146): Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
    12. 12-02 19:34:10.195: V/DynamiteModule(12146): Dynamite loader version >= 2, using loadModule2NoCrashUtils
    13. 12-02 19:34:10.217: I/FA(12146): App measurement is starting up, version: 19000
    14. 12-02 19:34:10.217: I/FA(12146): To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
    15. 12-02 19:34:10.217: I/FA(12146): To enable faster debug mode event logging run:
    16. 12-02 19:34:10.217: I/FA(12146):   adb shell setprop debug.firebase.analytics.app com.bongostudios.Guitaring
    17. 12-02 19:34:10.226: I/DynamiteLoaderV2(12146): [71] AdsFdrDynamite.integ
    18. 12-02 19:34:10.229: W/udios.Guitarin(12146): Unsupported class loader
    19. 12-02 19:34:10.231: W/udios.Guitarin(12146): Skipping duplicate class check due to unsupported classloader
    20. 12-02 19:34:10.265: I/CrashlyticsCore(12146): Initializing Crashlytics 2.6.8.32
    21. 12-02 19:34:10.295: I/CrashlyticsInitProvider(12146): CrashlyticsInitProvider initialization successful
    22. 12-02 19:34:10.363: D/NetworkSecurityConfig(12146): No Network Security Config specified, using platform default
    23. 12-02 19:34:10.445: D/Unity(12146): CommandLine:
    24. 12-02 19:34:10.449: D/OpenGLRenderer(12146): Skia GL Pipeline
    25. 12-02 19:34:10.487: I/Unity(12146): onResume
    26. 12-02 19:34:10.494: I/ViewRootImpl(12146): CPU Rendering VSync enable = true
    27. 12-02 19:34:10.502: I/FA(12146): Tag Manager is not found and thus will not be used
    28. 12-02 19:34:10.543: D/Unity(12146): SetWindow 0 0x790a8c7010
    29. 12-02 19:34:10.543: D/Unity(12146): SetWindow 0 0x790a8c7010
    30. 12-02 19:34:10.584: I/Unity(12146): windowFocusChanged: true
    31. 12-02 19:34:10.643: D/Unity(12146): Enabling Unity systrace
    32. 12-02 19:34:10.651: W/udios.Guitarin(12146): Accessing hidden method Ljava/lang/invoke/MethodHandles$Lookup;-><init>(Ljava/lang/Class;I)V (light greylist, reflection)
    33. 12-02 19:34:10.694: D/Unity(12146): [VFS] Mount /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/base.apk
    34. 12-02 19:34:10.705: D/Unity(12146): Loading player data from /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/base.apk/assets/bin/Data/data.unity3d
    35. 12-02 19:34:10.732: I/Unity(12146): SystemInfo CPU = ARM64 FP ASIMD AES, Cores = 8, Memory = 2817mb
    36. 12-02 19:34:10.732: I/Unity(12146): SystemInfo ARM big.LITTLE configuration: 8 big (mask: 0xff), 0 little (mask: 0x0)
    37. 12-02 19:34:10.734: I/Unity(12146): ApplicationInfo com.bongostudios.Guitaring version 1.2.14 build 8d3e1ff8-b5c0-441b-b0fd-2b0bce3149a8
    38. 12-02 19:34:10.734: I/Unity(12146): Built from '2019.2/staging' branch, Version '2019.2.14f1 (49dd4e9fa428)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a', Stripping 'Enabled'
    39. 12-02 19:34:10.740: D/Unity(12146): Script Patching: Patch files are not available, '/storage/emulated/0/Android/data/com.bongostudios.Guitaring/cache/ScriptOnly/2019.2.14f1/il2cpp/patch.config' is missing.
    40. 12-02 19:34:10.773: D/Unity(12146): Same Unity build, not extracting il2cpp resources.
    41. 12-02 19:34:10.784: D/Unity(12146): PlayerConnection initialized from /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/base.apk/assets/bin/Data (debug = 0)
    42. 12-02 19:34:10.785: D/Unity(12146): PlayerConnection initialized network socket : 0.0.0.0 55447
    43. 12-02 19:34:10.785: D/Unity(12146): PlayerConnection initialized unix socket : Unity-com.bongostudios.Guitaring
    44. 12-02 19:34:10.790: D/Unity(12146): Multi-casting "[IP] 192.168.0.12 [Port] 55447 [Flags] 3 [Guid] 289166336 [EditorId] 3341504570 [Version] 1048832 [Id] AndroidPlayer(Xiaomi_Redmi_Note_4@192.168.0.12) [Debug] 1 [PackageName] AndroidPlayer"'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
    45. 12-02 19:34:15.346: E/CRASH(12146): Build fingerprint: 'xiaomi/mido/mido:7.0/NRD90M/V9.6.1.0.NCFMIFD:user/release-keys'
    46. 12-02 19:34:15.346: E/CRASH(12146): Revision: '0'
    47. 12-02 19:34:15.346: E/CRASH(12146): pid: 12146, tid: 12233, name: UnityMain  >>> com.bongostudios.Guitaring <<<
    48. 12-02 19:34:15.346: E/CRASH(12146):     x0   0000000000000000  x1   00000079219c6e10  x2   0000007921e00000  x3   0000000000000000
    49. 12-02 19:34:15.346: E/CRASH(12146):     x4   0000000000000089  x5   0000000000000004  x6   00000000341555ad  x7   00000000026fc84c
    50. 12-02 19:34:15.346: E/CRASH(12146):     x8   0000007918f595f8  x9   f6b02e0fe97a63f1  x10  0000000000000089  x11  0000007921d3a620
    51. 12-02 19:34:15.346: E/CRASH(12146):     x12  000000793b2529f8  x13  0063006e00610074  x14  0008000000000000  x15  0008000000000000
    52. 12-02 19:34:15.346: E/CRASH(12146):     x16  00000079c6bb1bc8  x17  00000079c6b47280  x18  00000000177b1827  x19  0000000000000000
    53. 12-02 19:34:15.346: E/CRASH(12146):     x20  0000007922b4b000  x21  0000000000000000  x22  0000000000000000  x23  00000079219c6e10
    54. 12-02 19:34:15.346: E/CRASH(12146):     x24  0000000000000000  x25  0000000000000010  x26  0000000000000001  x27  0000000000000001
    55. 12-02 19:34:15.346: E/CRASH(12146):     x28  00000079177095d8  x29  0000007918f59140  x30  00000079237c1b60
    56. 12-02 19:34:15.346: E/CRASH(12146):     sp   0000007918f59100  pc   00000079237c40c8  pstate 0000000060000000
    57. 12-02 19:34:15.346: E/CRASH(12146): backtrace:
    58. 12-02 19:34:15.481: E/CRASH(12146):     #00  pc 00000000000007ec  [vdso] ()
    59. 12-02 19:34:15.481: E/CRASH(12146):     #01  pc 00000000005ad0c4  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libil2cpp.so ()
    60. 12-02 19:34:15.481: E/CRASH(12146):     #02  pc 00000000005aab5c  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libil2cpp.so ()
    61. 12-02 19:34:15.481: E/CRASH(12146):     #03  pc 00000000005f9968  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libil2cpp.so ()
    62. 12-02 19:34:15.481: E/CRASH(12146):     #04  pc 00000000005f8454  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libil2cpp.so ()
    63. 12-02 19:34:15.481: E/CRASH(12146):     #05  pc 00000000005f9afc  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libil2cpp.so ()
    64. 12-02 19:34:15.481: E/CRASH(12146):     #06  pc 00000000005f9adc  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libil2cpp.so ()
    65. 12-02 19:34:15.481: E/CRASH(12146):     #07  pc 0000000000646958  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libil2cpp.so ()
    66. 12-02 19:34:15.481: E/CRASH(12146):     #08  pc 0000000001e306f4  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libil2cpp.so ()
    67. 12-02 19:34:15.481: E/CRASH(12146):     #09  pc 000000000053c7e4  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libil2cpp.so ()
    68. 12-02 19:34:15.481: E/CRASH(12146):     #10  pc 00000000006038c8  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libil2cpp.so ()
    69. 12-02 19:34:15.481: E/CRASH(12146):     #11  pc 0000000000525d90  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libunity.so (_Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb+164)
    70. 12-02 19:34:15.481: E/CRASH(12146):     #12  pc 0000000000513324  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libunity.so (_ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb+152)
    71. 12-02 19:34:15.481: E/CRASH(12146):     #13  pc 000000000050e74c  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libunity.so (_ZN13MonoBehaviour19HandleNotificationsEPviR11MessageData+468)
    72. 12-02 19:34:15.481: E/CRASH(12146):     #14  pc 00000000008b9924  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libunity.so (_ZN14MessageHandler13HandleMessageEPvjRK17MessageIdentifierR11MessageData+92)
    73. 12-02 19:34:15.481: E/CRASH(12146):     #15  pc 00000000008b9864  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libunity.so (_ZN10GameObject14SendMessageAnyERK17MessageIdentifierR11MessageData+296)
    74. 12-02 19:34:15.482: E/CRASH(12146):     #16  pc 00000000006ceefc  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libunity.so (_Z21SendMessageToEveryoneRK17MessageIdentifier11MessageData+204)
    75. 12-02 19:34:15.482: E/CRASH(12146):     #17  pc 00000000006b1088  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libunity.so (_Z15PlayerInitStatev+72)
    76. 12-02 19:34:15.482: E/CRASH(12146):     #18  pc 000000000048cf2c  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libunity.so (_Z24UnityPostLoadApplicationv+4)
    77. 12-02 19:34:15.482: E/CRASH(12146):     #19  pc 000000000048d0ec  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libunity.so (_Z15UnityPlayerLoopv+396)
    78. 12-02 19:34:15.482: E/CRASH(12146):     #20  pc 0000000000486844  /data/app/com.bongostudios.Guitaring-LtrBrLt2ftFprhingq3e6A==/lib/arm64/libunity.so (_Z12nativeRenderP7_JNIEnvP8_jobject+72)
    79. 12-02 19:34:15.482: E/CRASH(12146):     #21  pc 000000000053ebe0  /system/lib64/libart.so (art_quick_generic_jni_trampoline+144)
    80. 12-02 19:34:15.482: E/CRASH(12146):     #22  pc 0000000000535b88  /system/lib64/libart.so (art_quick_invoke_stub+584)
    81. 12-02 19:34:15.482: E/CRASH(12146):     #23  pc 00000000000a8740  /system/lib64/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+200)
    82. 12-02 19:34:15.482: E/CRASH(12146):     #24  pc 000000000025b3f0  /system/lib64/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPNS_11ShadowFrameEtPNS_6JValueE+344)
    83. 12-02 19:34:15.482: E/CRASH(12146):     #25  pc 00000000002553ac  /system/lib64/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+948)
    84. 12-02 19:34:15.482: E/CRASH(12146):     #26  pc 0000000000506798  /system/lib64/libart.so (MterpInvokeDirect+296)
    85. 12-02 19:34:15.482: E/CRASH(12146):     #27  pc 0000000000528214  /system/lib64/libart.so (ExecuteMterpImpl+14484)
    86. 12-02 19:34:15.482: E/CRASH(12146): chained_signal_handler 628 got 11
    87. 12-02 19:34:15.486: A/libc(12146): Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x2c in tid 12233 (UnityMain), pid 12146 (udios.Guitaring)
    88. 12-02 19:34:15.564: A/libc(12146): crash_dump helper failed to exec
    89.  
     
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    If it's crashing as soon as you open the app, then it likely has nothing to do with NatCorder. NatCorder doesn't silently initialize itself, so NatCorder code would not have run by the time this crash happens.
     
  4. vnxxx

    vnxxx

    Joined:
    Jun 7, 2017
    Posts:
    14
    Hi Lanre,
    I record video by use 2 camera, code below:

    Camera[] camRecords;
    cameraInput = new CameraInput(videoRecorder, recordingClock, camRecords);

    I want to on/off one camera in recording, I have try enable camera component but not solve
    so How to do it or It can't do
    thanks!
     
  5. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    It isn't possible to 'turn off' a camera that you pass to CameraInput; it will render even if the camera is disabled. I think a better approach would be to determine which cameras should be recorded beforehand.
     
  6. vnxxx

    vnxxx

    Joined:
    Jun 7, 2017
    Posts:
    14
    I have test turn on/off camera by setting culling mask of camera to Nothing, and It's working :D
    thank!
     
    Lanre likes this.
  7. frikic

    frikic

    Joined:
    Dec 22, 2011
    Posts:
    23
    Hi Lanre,

    I'm currently using NatCorder to record video from MainCamera and audio from AudioListener, and this works fine.
    I tried adding microphone as AudioSource AudioInput and playing it after in order to record it, but i dont get any sound

    Code (CSharp):
    1. deviceMicrophone.clip = Microphone.Start(Microphone.devices[0], false, (int)maxRecordingTime, 44100);
    2. deviceMicrophone.Play();
    3. microphoneInput = new AudioInput(videoRecorder, recordingClock, deviceMicrophone, false);
    Please let me know if I'm doing something wrong, also is this issue that can be solved using NatMic?
     
  8. bhtruong93

    bhtruong93

    Joined:
    Jul 12, 2017
    Posts:
    7
    I'm noticing in the unity profiler that the memory usage slowly creeps up every time I'm starting/stopping, starting/stopping, etc. Tried it on iOS and the memory leak seems to be more serious. Can you confirm or deny what I'm seeing?
     
  9. rpra

    rpra

    Joined:
    Jun 5, 2013
    Posts:
    1
    Hello, Lanre,

    I was build IOS for Natcorder example [ReplayCam] in Ipad. "When I press the record button screen is freeze, but thus time recording is worked. And the video is fine.Please help...

    Video File is Below
    https://drive.google.com/file/d/1E9uyW4zKaKqjtj7oDq4QLuuzZMEy69-5/view

    Software:-
    Natcorder Version:1.6.4
    unity:2018.4.9f1
    IPad:iPad Air 2
    iPad version:12.3.1
     
  10. radraghag

    radraghag

    Joined:
    Jul 15, 2015
    Posts:
    5
    Hi!
    I encountered a bug on Android.
    If you use "Linear" color space in your player settings all videos will be too dark.
    So can you please add Linear color space support on android? On other platforms, it works well.

    Right now I worked around it by doing additional color space transformation blit, but it is bad for my application performance.

    Thank.
     
  11. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    I've just found the fix for this: you have to wait until Microphone.GetPosition is greater than zero before calling AudioSource.Play. NatMic isn't affected by weird issues like this.
     
  12. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    Are you observing this in the ReplayCam example? I am unable to reproduce this.
     
  13. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    This is a bug in Unity 2018. It has been fixed in Unity 2019.2.
     
  14. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    NatCorder does not support linear rendering on mobile platforms, and is not advertised to support it (though it will work on iOS). We can't avoid the blit, so it won't make a difference whether it's in our code or yours. We've tried before but we faced issues across several devices.
     
  15. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    What features would you like to see?

    I've been trying to collect all the Nat* API's into a full AV suite of plugins for Unity (see NatSuite on GitHub). In doing this, I'm looking to build a potentially cross-API feature wishlist to build out. I expect to add some of these features to the current API's and would be pretty excited to make others into standalone, open-source projects (like NatReader, which is a cross-platform video decoder). Please comment your wishes, and I'll add them to this list:
    • NatCorder: Linear rendering support on mobile (Android specifically, as it is unofficially supported on iOS).
    • NatCorder: Linux support?
     
  16. igor691

    igor691

    Joined:
    Apr 23, 2018
    Posts:
    8
    Good day. You have good sample, demo scene? How to use NatShare with NatCoder.
     
  17. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    See NatMicCorder-Demo.
     
  18. igor691

    igor691

    Joined:
    Apr 23, 2018
    Posts:
    8
    But I dont understand why when I stop record screen and then watch preview videos I not hear sound. Microphone not record? Test your sample in Natcorder
     
  19. igor691

    igor691

    Joined:
    Apr 23, 2018
    Posts:
    8
    when I go into the application access to the sound recording requests. but there is no sound in video
    I'm use Natcorder and Android 9

    Or need use only Natcorder + Natmic?
     
    Last edited: Dec 8, 2019
  20. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    Unity's Microphone API has a weird bug that causes the audio to be silent depending on how the microphone clip is played. I have a workaround and will publish it in the next update.
     
  21. igor691

    igor691

    Joined:
    Apr 23, 2018
    Posts:
    8
    when will the update be?
     
  22. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    Aiming for it to be live by the end of this coming week.
     
  23. igor691

    igor691

    Joined:
    Apr 23, 2018
    Posts:
    8
    Cool, I hope you finish)
     
  24. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    5
    Can confirm this works! Thank you

    Although, probably not a NatCorder thing, but I had to change my audio settings DSP Buffer Size to Best latency. It was very choppy using Best Performance.
     
    Lanre likes this.
  25. bhtruong93

    bhtruong93

    Joined:
    Jul 12, 2017
    Posts:
    7
    Hey thanks for the response. For my test case, I modified the ReplayCam so that it doesn't record the microphone and only the audio listener. I can see the memory leak with this code.
    Code (CSharp):
    1. /*
    2. *   NatCorder
    3. *   Copyright (c) 2019 Yusuf Olokoba
    4. */
    5.  
    6. namespace NatCorder.Examples {
    7.  
    8.     #if UNITY_EDITOR
    9.     using UnityEditor;
    10.     #endif
    11.     using UnityEngine;
    12.     using Clocks;
    13.     using Inputs;
    14.  
    15.  
    16.     public class ReplayCam : MonoBehaviour {
    17.  
    18.         /**
    19.         * ReplayCam Example
    20.         * -----------------
    21.         * This example records the screen using a `CameraRecorder`.
    22.         * When we want mic audio, we play the mic to an AudioSource and record the audio source using an `AudioRecorder`
    23.         * -----------------
    24.         * Note that UI canvases in Overlay mode cannot be recorded, so we use a different mode (this is a Unity issue)
    25.         */
    26.  
    27.         [Header("Recording")]
    28.         public int videoWidth = 1280;
    29.         public int videoHeight = 720;
    30.  
    31.         [Header("Microphone")]
    32.         public AudioSource microphoneSource;
    33.  
    34.         private IMediaRecorder videoRecorder;
    35.         private IClock recordingClock;
    36.         private CameraInput cameraInput;
    37.         private AudioInput audioInput;
    38.  
    39.         public void StartRecording () {
    40.             // Start recording
    41.             recordingClock = new RealtimeClock();
    42.             videoRecorder = new MP4Recorder(
    43.                 videoWidth,
    44.                 videoHeight,
    45.                 30,
    46.                 AudioSettings.outputSampleRate,
    47.                 (int)AudioSettings.speakerMode,
    48.                 OnReplay
    49.             );
    50.             // Create recording inputs
    51.             cameraInput = new CameraInput(videoRecorder, recordingClock, Camera.main);
    52.             audioInput = new AudioInput(videoRecorder, recordingClock, Camera.main.GetComponent<AudioListener>());
    53.         }
    54.  
    55.         public void StopRecording () {
    56.             audioInput.Dispose();
    57.             cameraInput.Dispose();
    58.             videoRecorder.Dispose();
    59.         }
    60.  
    61.         private void OnReplay (string path) {
    62.             Debug.Log("Saved recording to: " +path);
    63.    //         // Playback the video
    64.    //         #if UNITY_EDITOR
    65.             //EditorUtility.OpenWithDefaultApp(path);
    66.             //#elif UNITY_IOS
    67.             //Handheld.PlayFullScreenMovie("file://" + path);
    68.             //#elif UNITY_ANDROID
    69.             //Handheld.PlayFullScreenMovie(path);
    70.             //#endif
    71.         }
    72.     }
    73. }
    I've also attached a screenshot from my xcode's memory profiler. The high peaks are when I start recording and I stop recording after a couple of seconds before trying it again. These are the results after a couple of tries, you can see that the plateaus are slowly rising. In my app I'm starting/stopping pretty frequently and can get it to crash after maybe 50 times
     

    Attached Files:

  26. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    I was able to reproduce this. I'll check it out. Thanks for bringing it to my attention.
     
    raphaelnew and bhtruong93 like this.
  27. monikpatel757

    monikpatel757

    Joined:
    Sep 20, 2019
    Posts:
    2
    I am trying to use unity plugin in my native android app.
    Its Screen recording works fine if i directly use "Build and Run" option in unity.
    But when i use it as a plugin in my native android project it gives error.

    E/Unity(13608): AndroidJavaException: java.lang.ClassNotFoundException: Didn't find class "com/olokobayusuf/natcorder/MP4Recorder" on path: DexPathList[[zip file "/data/app/com.unity.unitylib-1/base.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.unity.unitylib-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.unity.unitylib-1/lib/arm, /dat

    Thanks
     
  28. WattyDev

    WattyDev

    Joined:
    Nov 28, 2018
    Posts:
    4
    Hi Lanre,
    I wonder how I can add a watermark to video from Ar Camera (Ar Foundation)?
     
  29. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    I don't think Unity's AndroidJavaObject class (what we use to communicate to Java) supports being encapsulated as a module in a native app. NatCorder isn't built for this purpose; you are better off writing your own Android code to record since you're already working in a native Java environment.
     
  30. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    You can use multiple cameras to do this. Setup a second camera to only see the watermark and keep it disabled in the scene, then record your normal camera and this camera with CameraInput.
     
    bhtruong93 likes this.
  31. reysantana

    reysantana

    Joined:
    Dec 13, 2019
    Posts:
    3
    Hello
    I have this error.
    Architecture: arm64
    iOS Target: 11.3
    Please help me to fix this error
    Thanks
     

    Attached Files:

    • 1.png
      1.png
      File size:
      24 KB
      Views:
      46
  32. reysantana

    reysantana

    Joined:
    Dec 13, 2019
    Posts:
    3
    upload_2019-12-13_18-25-11.png here is additional screenshot
     
  33. reysantana

    reysantana

    Joined:
    Dec 13, 2019
    Posts:
    3
    Hi @Lanre, please help me to resolve this issue...
     
  34. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    Delete and reimport NatCorder into your project.
     
  35. mtalbott

    mtalbott

    Joined:
    Dec 21, 2011
    Posts:
    112
    Hi @Lanre,

    I've asked this before but never got a clear answer. How do I record both scene audio AND microphone using NatMic in a single video. I could really use a clear code snippet on how to set this up. I'm using NatCorder 1.6.5 and NatMic 1.3.3

    Thanks,
    Mike
     
  36. WattyDev

    WattyDev

    Joined:
    Nov 28, 2018
    Posts:
    4
    Lanre, Could you tell me how I can improve recorded video quality. I ask it, because I have different what I see on screen and what I see on video. On video I see some pixels and squares, but in code I use smartphone screen resolution and 60 fps.
     
  37. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    NatMic doesn't have a way to mix microphone and game audio (we've tried in the past but could not get past synchronization issues). What you can do instead is record only the microphone as it should pick up audio coming out of the speakers (game audio).
     
  38. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    You can increase the recording bitrate in the recorder's constructor.
     
  39. igor691

    igor691

    Joined:
    Apr 23, 2018
    Posts:
    8
  40. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
  41. igor691

    igor691

    Joined:
    Apr 23, 2018
    Posts:
    8
    Sorry, but I dont understand what information from this link i need take.
     
  42. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    You can wait for the NatShare update or pull the NatShare code from this pull request into your project.
     
  43. igor691

    igor691

    Joined:
    Apr 23, 2018
    Posts:
    8
    ok, I understood. But I dont see how use new NatShare with old NatCorder. Previous code We have

    if (shareRecordings)
    NatShare.Share(path);

    but this moment I not see same code.
    maybe you can say me what need write, or need add to my code.
    Thank you.
     
  44. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,783
    Check out the README.
     
  45. mtalbott

    mtalbott

    Joined:
    Dec 21, 2011
    Posts:
    112
    I know this is out-of-scope for NatCorder but I'm having an issue with playing back NatCorder Videos through the Unity VideoPlayer on Android 10. My project is on Unity 2019.2.16f1. Has anyone here figured out a workaround? Seems to do with file permission changes in Android 10.
     
  46. Bongo_Studios

    Bongo_Studios

    Joined:
    Jan 26, 2019
    Posts:
    33
    We've already found the reason why it was crashing and has already been solved. The new version has been reimported and it is working well.
    However the performance is very bad, in Android the AndroidJNIHelper.InvokeJavaProxyMethod() method is using more than 50% of the CPU, thus making that whenever something is being recorded, the game is at 30 FPS only when nothing else is being executed.
    As soon as anything related with gameplay is used the FPS drops drastically. The game in execution without recording works at a stable 60 FPS, when recording at 30 FPS and interacting with the game the frames drop around to 15-20 FPS.
    We've been doing all the fixes and updates as you request all the time, and still recording and playing is impossible given the exessive amount of CPU used, which makes using the plugin useless since a user can't have a good experience if recording gameplay.
    Therefore, the plugin doesn't work for what it was purchased, its impossible to play when recording and all the effort to implement it has yielded more pains in the head than possitive impact for our game.

    Working on Unity 2019.2.16.
     
  47. monda

    monda

    Joined:
    May 14, 2015
    Posts:
    11
    Hi, I'm about to publish an AR App (ARCore), but I got a major issue with the Video Recording on Android.
    Like many apps I'm using Native calls (Prime31 Etcetera but tried others with same result), basically it records the video with a huge lag (5/6 fps) and also, slow the whole game while recording, if I remove all the Native plug ins or even a simple one I've wrote, Natcorder works fine but once added it goes very laggy.. Any idea how to solve this?
    I'm using Natcorder latest version on Unity 2019.2.6

    PS: ARkit version on iOS works fine
     
    WattyDev and raphaelnew like this.
  48. monikpatel757

    monikpatel757

    Joined:
    Sep 20, 2019
    Posts:
    2
    How can i change my path of video recording in android device and video size(in MB)?
    Thanks
     
  49. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    26
    Hello

    I am trying to build a MacOS version of our app and I'm using a few plugins to help with the app(Natcorder, UTMail and Unibill).

    I kept getting an error in the application loader when I was trying to validate the app
    This didn't go through the application loader.

    I also got a warning for Natcorder saying the certificate is expired.

    So, I tried to change the bundle identfiers of these to what we used for our app, and that made it go through the application loader, but it didn't get approved by apple with this mail sent as the issue report
    Can anyone help with these issue?
     
  50. WattyDev

    WattyDev

    Joined:
    Nov 28, 2018
    Posts:
    4
    I have the same issue !
     
    monda likes this.
unityunity