Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

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,615
    A few things need to change. The first is that you should only commit audio from one place. You are committing audio from both NatMic's delegate and from the AudioRecorder you are creating. This results in garbage audio. Instead, you should go through NatMic. NatMic has an overload for StartRecording that takes in an AudioListener. NatMic will automatically mix the audio from the microphone and the audio listener and provide the mixed audio in sample buffer callback.

    The second thing is that you want to change the NatMic format from `Format.Default` to `Format.DefaultForMixing`. This will cause NatMic to match the microphone sample rate and channel count to that of Unity's audio engine.

    With these changes, you will not need to use an AudioRecorder at all.
     
  2. HEROTECH70

    HEROTECH70

    Joined:
    May 24, 2017
    Posts:
    24
    Thank you for the reply.

    Another main issue is that when creating a video file using NatMic and saving it to the camera roll using nat share
    The video cannot be played back on the device (it is ok on the pc) so we had to revert to the old microphone recording system.

    Another thing, I don't know how much control you have over this but you should optimize the memory usage when recording. trying to record the screen with original sizes will cause most of our devices to crash due to out of memory exceptions, my quick fix for the moment is to record at half resolution.
     
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    I'm not sure I completely understand. Are you creating a WAV file with NatMic, or recording a video with NatCorder but with microphone audio from NatMic? If it's the former, we are adding a recorder for recording audio to an AudioClip in the next NatMic update.
    We have optimized NatCorder for memory as much as we can. Most devices nowadays have screens with resolutions beyond 1920x1080. The H.264 codec which NatCorder uses doesn't support resolutions above 1920x1080. It adds significant memory pressure to the app that usually leads to app termination.
     
  4. HEROTECH70

    HEROTECH70

    Joined:
    May 24, 2017
    Posts:
    24
    getting the logs from logcat

    Code (csharp):
    1.  
    2. 11-05 09:55:42.166  2618  2695 D Unity   : > ExceptionOccurred()
    3. 11-05 09:55:42.166  2618  2695 D Unity   : > NewStringUTF()
    4. 11-05 09:55:42.166  2618  2695 D Unity   : > ExceptionOccurred()
    5. 11-05 09:55:42.166  2618  2695 D Unity   : > NewStringUTF()
    6. 11-05 09:55:42.166  2618  2695 D Unity   : > ExceptionOccurred()
    7. 11-05 09:55:42.166  2618  2695 D Unity   : > CallStaticObjectMethod(0x28c2, 0xed292bc4
    8. 11-05 09:55:42.166  2618  2695 D Unity   : ? getMethodID("com.yusufolokoba.natcorder.NatCorder", "isRecording", "()Z", non-static)
    9. 11-05 09:55:42.166  2618  2695 D Unity   : ! boolean NatCorder.isRecording();
    10. 11-05 09:55:42.166  2618  2695 D Unity   : > ExceptionOccurred()
    11. 11-05 09:55:42.166  2618  2695 D Unity   : > DeleteLocalRef()
    12. 11-05 09:55:42.166  2618  2695 D Unity   : > DeleteLocalRef()
    13. 11-05 09:55:42.166  2618  2695 D Unity   : > FromReflectedMethod()
    14. 11-05 09:55:42.166  2618  2695 D Unity   : > ExceptionOccurred()
    15. 11-05 09:55:42.166  2618  2695 D Unity   : > DeleteLocalRef()
    16. 11-05 09:55:42.166  2618  2695 D Unity   : > CallBooleanMethod(0x2e76, 0xed2a1afc)
    17. 11-05 09:55:42.166  2618  2695 D Unity   : > ExceptionOccurred()
    18. 11-05 09:55:42.166  2618  2952 D Unity   : ReflectionHelper.Proxy.invoke(73204, [interface com.yusufolokoba.natcorder.NatCorderDel
    19. 11-05 09:55:42.166  2618  2695 D Unity   : > NewStringUTF()
    20. 11-05 09:55:42.166  2618  2695 D Unity   : > ExceptionOccurred()
    21. 11-05 09:55:42.166  2618  2695 D Unity   : > NewStringUTF()
    22. 11-05 09:55:42.166  2618  2952 D Unity   : > GetArrayLength()
    23. 11-05 09:55:42.166  2618  2695 D Unity   : > ExceptionOccurred()
    24. 11-05 09:55:42.166  2618  2952 D Unity   : > ExceptionOccurred()
    25. 11-05 09:55:42.166  2618  2695 D Unity   : > CallStaticObjectMethod(0x28c2, 0xed292bc4
    26. 11-05 09:55:42.166  2618  2952 D Unity   : > GetObjectArrayElement()
    27. 11-05 09:55:42.166  2618  2952 D Unity   : > ExceptionOccurred()
    28. 11-05 09:55:42.166  2618  2695 D Unity   : ? getMethodID("com.yusufolokoba.natcorder.NatCorder", "encodeFrame", "(IJ)V", non-stati
    29. 11-05 09:55:42.166  2618  2952 D Unity   : > GetObjectClass()
    30. 11-05 09:55:42.166  2618  2952 D Unity   : > ExceptionOccurred()
    31. 11-05 09:55:42.166  2618  2695 D Unity   : ! void NatCorder.encodeFrame(int, long);
    32. 11-05 09:55:42.166  2618  2952 D Unity   : > NewGlobalRef()
    33. 11-05 09:55:42.166  2618  2695 D Unity   : > ExceptionOccurred()
    34. 11-05 09:55:42.166  2618  2952 D Unity   : > NewGlobalRef()
    35. 11-05 09:55:42.166  2618  2695 D Unity   : > DeleteLocalRef()
    36. 11-05 09:55:42.166  2618  2952 D Unity   : > DeleteLocalRef()
    37. 11-05 09:55:42.166  2618  2695 D Unity   : > DeleteLocalRef()
    38. 11-05 09:55:42.166  2618  2695 D Unity   : > FromReflectedMethod()
    39. 11-05 09:55:42.166  2618  2952 D Unity   : > GetStringUTFChars()
    40. 11-05 09:55:42.166  2618  2695 D Unity   : > ExceptionOccurred()
    41. 11-05 09:55:42.166  2618  2695 D Unity   : > DeleteLocalRef()
    42. 11-05 09:55:42.166  2618  2695 D Unity   : > CallVoidMethod(0x2e76, 0xed2a1abc
    43. 11-05 09:55:42.166  2618  2952 D Unity   : > NewStringUTF()
    44. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    45. 11-05 09:55:42.167  2618  2952 D Unity   : > NewStringUTF()
    46. 11-05 09:55:42.167  2618  2695 D Unity   : > ExceptionOccurred()
    47. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    48. 11-05 09:55:42.167  2618  2952 D Unity   : > CallStaticObjectMethod(0x28c2, 0xed292bc4
    49. 11-05 09:55:42.167  2618  2952 D Unity   : ? getMethodID("java.lang.Integer", "getClass", "()Ljava/lang/Object;", non-static)
    50. 11-05 09:55:42.167  2618  2952 D Unity   : ! Class Object.getClass();
    51. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    52. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    53. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    54. 11-05 09:55:42.167  2618  2952 D Unity   : > FromReflectedMethod()
    55. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    56. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    57. 11-05 09:55:42.167  2618  2952 D Unity   : > CallObjectMethod(0x431a, 0x70b52750)
    58. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    59. 11-05 09:55:42.167  2618  2952 D Unity   : > GetObjectClass()
    60. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    61. 11-05 09:55:42.167  2618  2952 D Unity   : > NewGlobalRef()
    62. 11-05 09:55:42.167  2618  2952 D Unity   : > NewGlobalRef()
    63. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    64. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    65. 11-05 09:55:42.167  2618  2952 D Unity   : > NewStringUTF()
    66. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    67. 11-05 09:55:42.167  2618  2952 D Unity   : > NewStringUTF()
    68. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    69. 11-05 09:55:42.167  2618  2952 D Unity   : > CallStaticObjectMethod(0x28c2, 0xed292bc4
    70. 11-05 09:55:42.167  2618  2952 D Unity   : ? getMethodID("java.lang.Class", "getName", "()Ljava/lang/String;", non-static)
    71. 11-05 09:55:42.167  2618  2952 D Unity   : ! String Class.getName();
    72. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    73. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    74. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    75. 11-05 09:55:42.167  2618  2952 D Unity   : > FromReflectedMethod()
    76. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    77. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    78. 11-05 09:55:42.167  2618  2952 D Unity   : > CallStringMethod(0x4336, 0x70b5bcc0)
    79. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    80. 11-05 09:55:42.167  2618  2952 D Unity   : > NewStringUTF()
    81. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    82. 11-05 09:55:42.167  2618  2952 D Unity   : > NewStringUTF()
    83. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    84. 11-05 09:55:42.167  2618  2952 D Unity   : > CallStaticObjectMethod(0x28c2, 0xed292bc4
    85. 11-05 09:55:42.167  2618  2952 D Unity   : ? getMethodID("java.lang.Integer", "intValue", "()I", non-static)
    86. 11-05 09:55:42.167  2618  2952 D Unity   : ! int Integer.intValue();
    87. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    88. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    89. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    90. 11-05 09:55:42.167  2618  2952 D Unity   : > FromReflectedMethod()
    91. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    92. 11-05 09:55:42.167  2618  2952 D Unity   : > DeleteLocalRef()
    93. 11-05 09:55:42.167  2618  2952 D Unity   : > CallIntMethod(0x431a, 0x70b29ea4)
    94. 11-05 09:55:42.167  2618  2952 D Unity   : > ExceptionOccurred()
    95. 11-05 09:55:42.182  2618  2695 D Unity   : > NewStringUTF()
    96. 11-05 09:55:42.182  2618  2695 D Unity   : > ExceptionOccurred()
    97. 11-05 09:55:42.182  2618  2695 D Unity   : > NewStringUTF()
    98. 11-05 09:55:42.182  2618  2695 D Unity   : > ExceptionOccurred()
    99. 11-05 09:55:42.182  2618  2695 D Unity   : > CallStaticObjectMethod(0x28c2, 0xed292bc4
    100. 11-05 09:55:42.183  2618  2695 D Unity   : ? getMethodID("com.yusufolokoba.natcorder.NatCorder", "isRecording", "()Z", non-static)
    101.  
    This happens regardless if we use NatMic or not, the only difference is that when using NatMic it just won't save anything resulting in a 0 byte file, without NatMic The sound is terrible but at least we can get videos recorded.

    This plugin in its' current state is working only in standalone
     
  5. HEROTECH70

    HEROTECH70

    Joined:
    May 24, 2017
    Posts:
    24
    Sorry discard the previous message, apparently some exception in vuforia was causing your plugin to throw exceptions too.

    This one on the other hand is the issue as to why we can't record videos with NatMic

    Code (csharp):
    1.  
    2. 11-05 10:30:52.603  5703  5732 I Unity   : NatCorder: Initialized NatCorder 1.3 Android backend
    3. 11-05 10:30:52.603  5703  5732 I Unity   :
    4. 11-05 10:30:52.603  5703  5732 I Unity   : (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
    5. 11-05 10:30:52.603  5703  5732 I Unity   :
    6. 11-05 10:30:52.613  5703  5732 I Unity   : 1079 540
    7. 11-05 10:30:52.613  5703  5732 I Unity   :
    8. 11-05 10:30:52.613  5703  5732 I Unity   : (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
    9. 11-05 10:30:52.613  5703  5732 I Unity   :
    10. 11-05 10:30:52.616  5703  5732 I Unity   : NatMic: Initialized NatMic 1.0 Android backend
    11. 11-05 10:30:52.616  5703  5732 I Unity   :
    12. 11-05 10:30:52.616  5703  5732 I Unity   : (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
    13. 11-05 10:30:52.616  5703  5732 I Unity   :
    14. 11-05 10:30:52.622  5703  5732 D Unity   : NatCorder: Preparing video encoder with format: {color-format=2130708361, i-frame-interval=3, mime=video/avc, width=540, bitrate=5909759, frame-rate=30, height=1078}
    15. 11-05 10:30:52.643  5703  5929 D Unity   : NatMic: Microphone started recording
    16. 11-05 10:30:52.708  5703  5929 E Unity   : Exception: No such proxy method: NatMicU.Core.Platforms.NatMicAndroid.onSampleBuffer(System.Int32,UnityEngine.AndroidJavaObject,System.Int32,System.Int32)
    17. 11-05 10:30:52.708  5703  5929 E Unity   :   at UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) [0x0015a] in <6e9e7a5d37e54b228d5e80e246cf5d03>:0
    18. 11-05 10:30:52.708  5703  5929 E Unity   :   at UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, UnityEngine.AndroidJavaObject[] javaArgs) [0x00029] in <6e9e7a5d37e54b228d5e80e246cf5d03>:0
    19. 11-05 10:30:52.708  5703  5929 E Unity   :   at UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) [0x00065] in <6e9e7a5d37e54b228d5e80e246cf5d03>:0
    20.  
     
  6. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Are you building with IL2CPP or Mono? Can you try switching to Mono and completely disabling stripping?
     
  7. HEROTECH70

    HEROTECH70

    Joined:
    May 24, 2017
    Posts:
    24
    I disabled stripping and was already running mono.

    Still not working
     
  8. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    I'm looking into this. For some reason I can't reproduce it at all.
     
  9. mathias_unity633

    mathias_unity633

    Joined:
    Jul 17, 2018
    Posts:
    35
    My NatCorder just broke in the editor on OSX, unity version 2018.1.2f1, NatCorder version 1.3f1

    I get this when trying to Create a CameraRecorder:

    Code (CSharp):
    1. DllNotFoundException: NatCorder
    2. NatCorderU.Core.Platforms.NatCorderOSX..ctor () (at Assets/Third Party/NatCorder/Plugins/Managed/Platforms/NatCorderOSX.cs:41)
    3. NatCorderU.Core.NatCorder..cctor () (at Assets/Third Party/NatCorder/Plugins/Managed/NatCorder.cs:110)
    4. Rethrow as TypeInitializationException: The type initializer for 'NatCorderU.Core.NatCorder' threw an exception.
    5. NatCorderU.Core.Recorders.CameraRecorder.OnRenderImage (UnityEngine.RenderTexture src, UnityEngine.RenderTexture dst) (at Assets/Third Party/NatCorder/Plugins/Managed/Recorders/CameraRecorder.cs:69)
    I didn't see anyone else here getting a DllNotFoundException. It's kind of crazy because it was working fine yesterday, but suddenly it stopped working today. I haven't changed anything related to NatCorder. I even tried checking out a previous commit from yesterday where I know it was working, but still I get a DllNotFoundException. I have no idea what's going on, I don't even expect this to be a NatCorder issue per se, but anyone got any tips? Perplexed here.
     
    ina likes this.
  10. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Can you upload the full editor logs in a .txt file? That should explain what's happening here.
     
  11. halilkayim

    halilkayim

    Joined:
    Feb 27, 2018
    Posts:
    21
    I'm having the exact same issue. I was going to try to update the package to its latest version, but my version is 1.1f1 and there are just too many breaking changes between my version and the latest one. Is there a way to solve this without having to update the package?
     
  12. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    I'll need to see the logs to know. In any case, I highly recommend updating to the latest version.
     
  13. halilkayim

    halilkayim

    Joined:
    Feb 27, 2018
    Posts:
    21
    I don't have a log but this is the warning I get on the Unity console before the DllNotFoundException:

     
  14. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Try deleting NatCorder then reimporting it from the Asset Store. Let me know if that works.
     
  15. SachinGanesh

    SachinGanesh

    Joined:
    Jun 28, 2015
    Posts:
    10
    iOS (ARkit/Metal) Crashing Bug:

    [B]2018-11-08 10:23:10.618434+0530 Myapp[1385:346966] NatCorder: Prepared MP4 video encoder at resolution 2732x2048@30Hz with average bitrate 5909760 and keyframe interval 3s[/B]

    [B]2018-11-08 10:23:10.620664+0530 [B]Myapp[/B][1385:346966] NatCorder: Prepared MP4 audio encoder for 2 channels at 24000Hz[/B]

    [B]2018-11-08 10:23:10.620752+0530 [B]Myapp[/B][1385:346966] NatCorder: MP4 recorder started recording[/B]

    [B]Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak[/B]



    [B](Filename: Line: 372)[/B]


    [B]To Debug, enable the define: TLA_DEBUG_STACK_LEAK in ThreadsafeLinearAllocator.cpp. This will output the callstacks of the leaked allocations[/B]



    [B](Filename: Line: 374)[/B]


    [B]2018-11-08 10:23:14.832473+0530 [B]Myapp[/B][1385:346966] Got memory pressure notification (critical)[/B]

    [B]WARNING -> applicationDidReceiveMemoryWarning()

    ....
    [/B]

    [B]NatCorder Error: Unable to commit frame because texture ID is null[/B]

    [B]NatCorderU.Core.Platforms.NatCorderiOS:CommitFrame(RenderTexture, Int64)[/B]

    [B]NatCorderU.Core.Recorders.CameraRecorder:OnRenderImage(RenderTexture, RenderTexture)



    -----



    [B]2018-11-08 10:47:04.271640+0530 [B]Myapp[/B][1425:352168] -[MTLRenderPipelineDescriptorInternal validateWithDevice:], line 2660: error 'No valid pixelFormats set.'[/B]

    [B]-[MTLRenderPipelineDescriptorInternal validateWithDevice:]:2660: failed assertion `No valid pixelFormats set.'[/B]

    [/B]


    How ti fix this issue?
     
  16. mathias_unity633

    mathias_unity633

    Joined:
    Jul 17, 2018
    Posts:
    35
    Can't, asset store version is 2018.2, I'm stuck on 2018.1. And there is nothing else in the editor log than that one message.
     
  17. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Your recording resolution is too high. The H.264 codec doesn't play well with resolutions above 1920x1080. I am working on an update that should fix this error.
     
  18. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    It should let you import to your project anyway. We submitted with 2018.2, but it works with Unity versions as old as 5.3.
     
  19. FlashyGoblin

    FlashyGoblin

    Joined:
    Apr 1, 2017
    Posts:
    23
    I'm receiving the same DllNotFoundException error when running this plugin. This is with the original plugin as well as the newest update. I've tried in all different versions of Unity as well. I'm running macOS Mojave (10.14).

    Any ideas?

    DllNotFoundException: NatCorder
    NatCorderU.Core.Platforms.NatCorderOSX..ctor () (at Assets/NatCorder/Plugins/Managed/Platforms/NatCorderOSX.cs:42)
    NatCorderU.Core.NatCorder..cctor () (at Assets/NatCorder/Plugins/Managed/NatCorder.cs:113)
    Rethrow as TypeInitializationException: An exception was thrown by the type initializer for NatCorderU.Core.NatCorder
    NatCorderU.Examples.GreyWorld.Update () (at Assets/NatCorder/Examples/GreyWorld/GreyWorld.cs:40)


    and...


    Plugins: Couldn't open Assets/NatCorder/Plugins/macOS/NatCorder.bundle/Contents/MacOS/NatCorder, error: dlopen(Assets/NatCorder/Plugins/macOS/NatCorder.bundle/Contents/MacOS/NatCorder, 2): no suitable image found. Did find:
    Assets/NatCorder/Plugins/macOS/NatCorder.bundle/Contents/MacOS/NatCorder: code signature invalid for 'Assets/NatCorder/Plugins/macOS/NatCorder.bundle/Contents/MacOS/NatCorder'

    NatCorderU.Core.NatCorder:.cctor() (at Assets/NatCorder/Plugins/Managed/NatCorder.cs:125)
    NatCorderU.Core.NatCorder:.cctor() (at Assets/NatCorder/Plugins/Managed/NatCorder.cs:113)
    NatCorderU.Examples.GreyWorld:Update() (at Assets/NatCorder/Examples/GreyWorld/GreyWorld.cs:48)
    NatCorderU.Examples.GreyWorld:Update() (at Assets/NatCorder/Examples/GreyWorld/GreyWorld.cs:40)
     
    ina likes this.
  20. FlashyGoblin

    FlashyGoblin

    Joined:
    Apr 1, 2017
    Posts:
    23
    Also, the DllNotFoundException happens when in any build mode. PC/Mac, iOS, and Android.
     
  21. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Can you attach the full Editor log file in a .txt? That'll show the exact reason why the library isn't being loaded.
     
  22. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Can you modify this post and put all this info in an attached .txt file? Posts like this make navigation pretty difficult. Thanks.
     
  23. FlashyGoblin

    FlashyGoblin

    Joined:
    Apr 1, 2017
    Posts:
    23
    Sorry about that. Here it is.
     

    Attached Files:

    • Log.txt
      File size:
      11 KB
      Views:
      249
    Lanre likes this.
  24. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Ah, can you shoot me an email with your invoice number? There's some code signing error going on (not sure why), so I'll send you an updated build (I too just updated to macOS Mojave).
     
  25. FlashyGoblin

    FlashyGoblin

    Joined:
    Apr 1, 2017
    Posts:
    23
    Sent. Thank you!
     
  26. Ignatius

    Ignatius

    Joined:
    Oct 28, 2013
    Posts:
    10
    How to improve framerate, current output is around 14-15fps, video resolution is only 1280x720.
    Can you give an example of setting framerate? Using Replay.StartRecording, as when i input 30 as framerate, the app will crash when StopRecording trigger.
     
  27. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Upgrade to the latest version of NatCorder. We usually improve recording stability in every update.
     
  28. Ignatius

    Ignatius

    Joined:
    Oct 28, 2013
    Posts:
    10
    Just updated to lastest version, the speed still about the same 14-16fps. When I lower down the video resolution to 320 width, the frame rate increase slightly to 19fps, but the result is simply unuse. And the new audio recorder produce breaking video sound. I think this is due to low frame rate. This problem does not occur on 1.1f version.

    I had tested the new example (webcam) it work perfectly fine, framerate is 30-31fps, and the audio is perfectly smooth.
    I also try to simply import the example gameobject to the scene, and the result is still 14-16fps.

    No error promt in editor.

    I use this on AR project, and the scene does use projector function, shader effect (I also tested without the shader effect, the frame rate is around 15-16 fps). The app run smoothly even with post effect, it only lag when recording start.

    I tested on Android Oreo, XiaoMi Note 3, Unity3d 2018.2.1f1.

    Hope this help.
     
  29. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Can you shoot me an email? I'm testing out some optimizations on Android that might help with this.
     
  30. unityCZH

    unityCZH

    Joined:
    Nov 12, 2018
    Posts:
    16
    Hello, there is no use of DLL library on windows_32 platform. Could you please help to solve it
     
  31. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    21
    I user following code but its recording the some port of the screen that to in UpSide Down mirror.How to take camera as input source

    using NatCorderU.Core;
    using NatCorderU.Core.Clocks;
    public class RecordCamera : MonoBehaviour {
    WebCamTexture cameraTexture;
    IClock recordingClock;
    IEnumerator Start () {
    // Start camera
    cameraTexture = new WebCamTexture();
    cameraTexture.Play();
    // Create a clock for generating timestamps
    recordingClock = new RealtimeClock();
    // Start recording
    NatCorder.StartRecording(
    Container.MP4,
    new VideoFormat(cameraTexture.width, cameraTexture.height),
    AudioFormat.None,
    OnVideo
    );
    // Wait for 10 seconds
    yield return new WaitForSeconds(10f);
    // Stop recording
    // The `OnVideo` callback will be invoked with the path to the recorded video
    NatCorder.StopRecording();
    }
    void Update () {
    if (NatCorder.IsRecording && cameraTexture.didUpdateThisFrame) {
    // Acquire an encoder frame from NatCorder
    var frame = NatCorder.AcquireFrame();
    // Blit the current camera preview frame to the encoder frame
    Graphics.Blit(cameraTexture, frame);
    // Commit the frame to NatCorder for encoding
    NatCorder.CommitFrame(frame, clock.CurrentTimestamp);
    }
    }
    void OnVideo (string path) {
    // Do stuff with video
    ...
    }
    }
     

    Attached Files:

  32. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    There is a Windows x86 DLL. Check NatCorder > Plugins > Windows > x86. Make sure you are running Windows 8 and above.
     
  33. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    What platform are you recording on? Also, are you recording a game camera or a WebCamTexture (your uploaded recording seems to show the game, but your code shows a WebCamTexture).
     
  34. mathias_unity633

    mathias_unity633

    Joined:
    Jul 17, 2018
    Posts:
    35
    Can you also send me the build, that would be super appreciated. I'll send you an e-mail with the invoice number. If you're going to update the asset store version today or tomorrow, don't bother sending it :)
     
  35. unityCZH

    unityCZH

    Joined:
    Nov 12, 2018
    Posts:
    16
    My current version is Windows 7.Can you help add Windows 7 support?Because I need to support the Windows 7 version
     
  36. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Sure.
     
  37. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Unfortunately we can't support Windows 7. This issue has been raised before, but the encoding API on Windows 7 (MediaFoundation) always crashes after recording. We have not been able to get around this issue.
     
  38. bastianmeyerbm3

    bastianmeyerbm3

    Joined:
    May 22, 2018
    Posts:
    15
    1. How can i solve that the record button is visible in the recorded video? For the other UI Elements i made a seperated Canvas. But whats with the "record button"? :confused:
    upload_2018-11-13_17-32-12.png


    2. Also i implemented this code in "replaycam.cs":
    Code (CSharp):
    1.  private void StartMicrophone () {
    2.             #if !UNITY_WEBGL || UNITY_EDITOR // No `Microphone` API on WebGL :(
    3.             // If the clip has not been set, set it now
    4.             if (audioSource.clip == null) {
    5.             audioSource.clip = Microphone.Start(null, true, 60, 48000); //default 60, 48000
    6.             iPhoneSpeaker.ForceToSpeaker(); //removes real-time microphone shuttering on IOS
    7.                 while (Microphone.GetPosition(null) <= 0) ;
    8.             }          
    9.             // Play through audio source
    10.             audioSource.timeSamples = Microphone.GetPosition(null);
    11.             audioSource.loop = true;
    12.             audioSource.Play();
    13.             #endif
    14.         }
    15.  
    but i still have the same problem with this shuttering :(

    Could you help me?
     
  39. JamesGartland

    JamesGartland

    Joined:
    Jun 1, 2017
    Posts:
    8
  40. JackmanGomel

    JackmanGomel

    Joined:
    Jun 3, 2015
    Posts:
    12
    UPDATE
    I use RenderTexture with resolution 640*360 and new VideoFormat(640, 360, 30, 1000000) and got 70mb in 20min on Android without sound. Good result

     

    Attached Files:

    Last edited: Nov 14, 2018
    Lanre likes this.
  41. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    21
    Nat Corder Working Fine in Unity Editor and recording video but when i was taking build and run on ios device (ipad) app getting crash and showing. Using Unity 2017.4 and iOS version 9.0.2

    Received memory warning.

    WARNING -> applicationDidReceiveMemoryWarning()
     
    Last edited: Nov 14, 2018
  42. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    21
    i want to record game camera but i didn't found any code tutorial related to that how to do that. Im working on mac
     
  43. mathias_unity633

    mathias_unity633

    Joined:
    Jul 17, 2018
    Posts:
    35
    This did resolve the macOS editor issues, but introduced several different issues, on different devices. Somehow it killed the background camera feed, introduced more stuttering and also showed a preview of the recorded screen in the lower left corner (Android only). I think I'll live with the editor not working instead :D
     
  44. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Put the record button inside a UI canvas that has its rendering mode set to Overlay. This will cause it to become invisible to NatCorder.
    The `iPhoneSpeaker.ForceToSpeaker` doesn't fix Unity's stuttering; it simply prevents the game audio from being rerouted to the calling speaker (something that happens on iOS). Unity's microphone API produces a lot of stuttering. That's why we introduced our own native microphone API, NatMic.
     
  45. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    We decided to move this info the main project. I'm currently working on the NatCorder 1.3f3 update with some of the utilities we added in the NatCorder-Extensions project. Shoot me an email with your invoice and I'll send you the beta build; you can test linear rendering.
     
  46. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Good to know. That's quite a recording duration.
     
  47. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Can you upload the logs from Xcode in a .txt file?
     
  48. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Use a `CameraRecorder`. Look at the code for the ReplayCam example.
     
  49. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,615
    Are you referring to the 1.3b3 build I shared with you? Also, can you be more descriptive? What is the 'background camera feed'? Is this the ReplayCam example? And what platforms does this issue affect?
     
  50. bastianmeyerbm3

    bastianmeyerbm3

    Joined:
    May 22, 2018
    Posts:
    15
    Thank you for your response!! The shuttering issue is fixed with NatMic?