Search Unity

NatCorder - Video Recording API

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

  1. pjaimin

    pjaimin

    Joined:
    Nov 3, 2018
    Posts:
    13
    Hey @Lanre recorded video from natcorder always starts with a black screen so, whenever I record a video and save it into the gallery, the gallery shows a black thumbnail. I used the same code as shown in Replycam.cs file. Is there anything that prevents the first black frame ?? Help me out here.
     
  2. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    What version of NatCorder are you using?
     
  3. pjaimin

    pjaimin

    Joined:
    Nov 3, 2018
    Posts:
    13
    I'm using version 1.8.2 when i record normal video everything works fine but after adding GLESTextureInput the first of recorded video is always black.
     
  4. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    This has been fixed in NatCorder 1.8.4.
     
  5. selvapandigamedev95

    selvapandigamedev95

    Joined:
    Nov 6, 2019
    Posts:
    2
    Hi @Lanre,
    Hi lanre brother, i have some bug when recording videos the video has been bluring.Here i attached the errors

    2022/07/04 17:04:33.272 28250 28250 Warn View requestLayout() improperly called by com.android.internal.widget.RecyclerView{b33060e VFED..... ......ID 0,0-639,860 #102047e android:id/resolver_list} during layout: running second layout pass
    2022/07/04 17:04:33.295 28250 31444 Verbose MediaMetadataRetriever constructor
    2022/07/04 17:04:33.295 818 7396 Verbose MetadataRetrieverClient MetadataRetrieverClient constructor pid(28250)
    2022/07/04 17:04:33.295 818 7396 Verbose MediaPlayerService Create new media retriever from pid 28250
    2022/07/04 17:04:33.297 26942 29418 Error DatabaseUtils Writing exception to parcel
    2022/07/04 17:04:33.297 26942 29418 Error DatabaseUtils java.lang.SecurityException: Permission Denial: reading androidx.core.content.FileProvider uri content://com.shristee.VisionMayaa.natshare/external/recording_2022_07_04_17_04_20_781.mp4 from pid=28250, uid=1000 requires the provider be exported, or grantUriPermission()
    2022/07/04 17:04:33.297 26942 29418 Error DatabaseUtils at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:841)
    2022/07/04 17:04:33.297 26942 29418 Error DatabaseUtils at android.content.ContentProvider.semEnforceReadPermission(ContentProvider.java:758)
    2022/07/04 17:04:33.297 26942 29418 Error DatabaseUtils at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:684)
    2022/07/04 17:04:33.297 26942 29418 Error DatabaseUtils at android.content.ContentProvider$Transport.enforceFilePermission(ContentProvider.java:674)
    2022/07/04 17:04:33.297 26942 29418 Error DatabaseUtils at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:548)
    2022/07/04 17:04:33.297 26942 29418 Error DatabaseUtils at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:327)
    2022/07/04 17:04:33.297 26942 29418 Error DatabaseUtils at android.os.Binder.execTransactInternal(Binder.java:1190)
    2022/07/04 17:04:33.297 26942 29418 Error DatabaseUtils at android.os.Binder.execTransact(Binder.java:1159)
    2022/07/04 17:04:33.297 28250 31444 Verbose MediaMetadataRetriever setDataSource
     

    Attached Files:

  6. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Can you share an example video with the blurring?
     
  7. selvapandigamedev95

    selvapandigamedev95

    Joined:
    Nov 6, 2019
    Posts:
    2

    Attached Files:

  8. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
  9. guodancoder

    guodancoder

    Joined:
    Dec 14, 2017
    Posts:
    4
    Hi, I use it with ARFoundation. My problem is when I record video of ar camera, ARSessionState will switch to SessionInitializing from SessionTracking. And this problem only shows on first record video.
     
  10. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Hm I haven't come across this issue before. What device does it happen on, and what version of Unity, ARFoundation, and NatCorder are you using? Can you share the full device logs from app start in a `.txt` attachment?
     
  11. gilbertog_

    gilbertog_

    Joined:
    Jul 25, 2022
    Posts:
    3
    Error in the execution of my code. When I build the project in Unity Debug it works correctly, I can record and the videos are saved.
    However, if I export the project to compile it with Android Studio, I have problems when I want to record a video.
    The error occurs just when I create an object with MP4Recorder from NatML.Recorders;


     
  12. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Hey there, can you share the full logs from app start in a .txt attachment?
     
  13. gilbertog_

    gilbertog_

    Joined:
    Jul 25, 2022
    Posts:
    3
    In the end we were able to solve the problem with the information obtained from one of the discord conversation threads. The problem was that we exported the Unity project for android, but when compiling it with Android it was signed with a different package name than the one we had when we exported it.
     
  14. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Sounds good!
     
  15. keyounghyu

    keyounghyu

    Joined:
    Sep 3, 2020
    Posts:
    5
    another issue show up.
    device : Huawei P20 Lite (9.0.0)
    UnityVideoPlayer can't load to mp4Recorder result.
     

    Attached Files:

  16. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    47
  17. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    47
    well we wrote a simple shader that swaps the R and B channels, and used it in a Blit before we commit the frame. This made the trick, but it's a workaround for a bug that looks to be part of Natcorder
     
  18. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Issues like this are likely Unity-specific. I recommend trying the latest version of NatCorder.
     
  19. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    I haven't been able to reproduce this behaviour, and haven't gotten any similar reports (this type of bug would come up pretty quickly, in large volume). Does this happen on a clean project? Can you try upgrading to NatCorder 1.8.7?
     
  20. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Hey all,

    NatCorder 1.8.7 is now available:
    • Doubled recording performance on Windows by leveraging SIMD vectorization.
    • Added full support for linear rendering.
    • Added support for recording animated GIF images with transparency in GIFRecorder.
    • Added support for WAVRecorder on WebGL.
    • Fixed application hanging when finishing ultra high-resolution recording with GLESTextureInput on Android.
    • Fixed failed recording returning null path instead of raising exception.
    Windows recording performance has been more than doubled:
    1.8.6_edit.png

    1.8.7_edit.png

    And we've added support for recording transparent GIF images:

    transparency.gif

    Grab the update from GitHub.
     
  21. LaiPic

    LaiPic

    Joined:
    Aug 22, 2022
    Posts:
    4
    Hi,does NatCorder support mp4 with audio on unity_webgl ?
     
  22. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    On WebGL, the MP4 recorder isn't supported because the major desktop browsers don't support it. Use the WEBM recorder instead, which records with either the VP8 or H.264 AVC video codecs. Recording audio is supported. Check out the docs, and get NatCorder from GitHub.
     
  23. LaiPic

    LaiPic

    Joined:
    Aug 22, 2022
    Posts:
    4
    Thanks!
     
    Lanre likes this.
  24. keep_Silent

    keep_Silent

    Joined:
    Feb 14, 2022
    Posts:
    1
    Hi,Can natorder record camera images on webgl? I don't want to record UI.
     
  25. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Yes, NatCorder allows you to selectively record parts of your game. This can be achieved by using multiple cameras that each see different game objects or UI. If you want to exclude UI from the recording, it's even easier: just set the UI render mode to "Overlay". Grab NatCorder from GitHub.
     
  26. LaiPic

    LaiPic

    Joined:
    Aug 22, 2022
    Posts:
    4
    Is there any example to recorder WEBM with audio on webgl?
    I have tried,but failed...
     
  27. LaiPic

    LaiPic

    Joined:
    Aug 22, 2022
    Posts:
    4
  28. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    This is a Unity Engine limitation, meaning that you can't record Unity's game audio because Unity doesn't provide access to its audio data through `OnAudioFilterRead`. NatCorder itself can record audio on WebGL, like if you record the microphone audio with NatDevice, or if you generate procedural audio.
     
  29. RD3_Elizeu

    RD3_Elizeu

    Joined:
    Jul 2, 2021
    Posts:
    8
    Hello, i'm having an issue when recording CameraInput (with MP4Recorder) on Android. The video colors are more saturated than in the app.

    However, this doesn't happen on every Android device, iOS is fine too.
    I tested on Samsung A10, A31 and S10. On the S10 device the video is perfect, on the other 2 it saturates the colors.

    I'm also using URP in the project, is there any config that i could have done that screwed up the recording? Because i definitely don't remember this happening before importing and setting up URP :(

    The problem also happens when using HEVCRecorder.

    I'm using:
    NatCorder 1.8.9
    Unity 2021.3.7f1
    URP 12.1.7

    Some Project settings that might be relevant:

    Color space - Linear
    Graphics API - OpenGLES3


    EDIT: seems to be the same problem this user had:

     
    Last edited: Sep 27, 2022
  30. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Hey there, this color difference is most likely because of linear rendering. We recently added support for linear rendering to the `GLESTextureInput`, which is the texture input that is used to record when running with OpenGL ES3. For a long time, NatCorder did not officially support linear rendering, and it was because we faced the exact issue you describe: some Android devices don't produce correct colors when rendering with linear color. I'm not aware of any fix for this issue, given that it is device-specific. The only workaround I can think of is to switch to gamma rendering, but this is usually impractical for most projects.
     
  31. RD3_Elizeu

    RD3_Elizeu

    Joined:
    Jul 2, 2021
    Posts:
    8
    Thanks for the answer. I searched the thread and you talked about attaching the GLESTextureInput to the CameraInput but i'm having trouble figuring out how to do that. What is the best way to achieve this?

    Here is the rec code. I just start the CameraInput when pressing a button and dispose it when releasing.

    Code (CSharp):
    1.    void StartRecording_Video()
    2.    {
    3.             videoRecorder = new MP4Recorder(
    4.             w, h, 30,
    5.             AudioSettings.outputSampleRate,
    6.             (int)AudioSettings.speakerMode,
    7.             6_000_000
    8.         );
    9.  
    10.         cameraInput = new CameraInput(videoRecorder, recordingClock, camerasToRecord);
    11.     }
    12.  
    13.     void StopRecording_Video()
    14.     {
    15.         cameraInput.Dispose();
    16.     }
    I tried creating the CameraInput like this but i don't think it's the correct way because nothing really changed in the recorded video

    Code (CSharp):
    1.  
    2. GLESTextureInput textureInput = new GLESTextureInput(videoRecorder);
    3.  
    4. cameraInput = new CameraInput(textureInput, recordingClock, camerasToRecord);
    5.  
     
  32. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    If you're on the latest version of NatCorder, you don't have to explicitly create the `GLESTextureInput` anymore. The ` CameraInput` handles it automatically.
     
    RD3_Elizeu likes this.
  33. Riken_rds

    Riken_rds

    Joined:
    Apr 4, 2017
    Posts:
    49
    hello thanks for providing amazing package.
    i have once issue please check and if possible then help me.
    i am using unity 2021.3.4f1 version with volume profile for post processing once i apply any post processing then in unity and after recording mp4 video look minor different please check attachment image once is unity and once is after recording video
     

    Attached Files:

    • s21.PNG
      s21.PNG
      File size:
      139 KB
      Views:
      119
  34. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Hey there, just to clarify, are you saying that there is a color difference in the recording? What version of NatCorder are you using?
     
  35. Riken_rds

    Riken_rds

    Joined:
    Apr 4, 2017
    Posts:
    49
    version 1.6.6
     
  36. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
  37. Riken_rds

    Riken_rds

    Joined:
    Apr 4, 2017
    Posts:
    49
  38. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    We now distribute our software on GitHub and require a subscription. Check out the setup steps on GitHub.
     
  39. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Hey all, we just published NatCorder 1.9.0 and 1.9.1. First, the biggest change:

    NatCorder can now be tried out for free!

    We added a free trial with limited functionality (see the docs for more details). Here's the full changelog:

    • NatCorder can now be tried without an active NatML MediaKit subscription!
    • Fixed `ObjectDisposedException` when committing frames in `JPEGRecorder`.
    • Refactored `JPGRecorder` to `JPEGRecorder` for correctness.
    • NatCorder now requires iOS 14+.

    Grab NatCorder from GitHub.
     
  40. GutierManu

    GutierManu

    Joined:
    Jun 7, 2020
    Posts:
    8
    Hi, I'm using version 1.8.1. I'm having some issues with the plugin.

    The plugin works perfectly in the editor, but when it comes to builds, it seems it depends on the device. I have tested the same build in 2 devices: a Huawei Mate 20 Lite (successful) and a Xiaomi Redmi Note 11 (failed). According to an in-game debug console, the error I receive in the Xiaomi phone is the following:

    InvalidOperationException: Failed to create MP4Recorder
    NatSuite.Recorders.MP4Recorder.Create (System.Int32 width, System.Int32 height, System.Single frameRate, System.Int32 sampleRate, System.Int32 channelCount, System.Int32 videoBitRate, System.Int32 keyframeInterval, System.Int32 audioBitRate) (at <00000000000000000000000000000000>:0)
    NatSuite.Recorders.MP4Recorder..ctor (System.Int32 width, System.Int32 height, System.Single frameRate, System.Int32 sampleRate, System.Int32 channelCount, System.Int32 videoBitRate, System.Int32 keyframeInterval, System.Int32 audioBitRate) (at <00000000000000000000000000000000>:0)
    NatSuite.Examples.ReplayCam.StartRecording () (at <00000000000000000000000000000000>:0)
    ARManager.OnCapture () (at <00000000000000000000000000000000>:0)
    UnityEngine.Events.UnityEvent.Invoke () (at <00000000000000000000000000000000>:0)
    UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at <00000000000000000000000000000000>:0)
    UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchPress (UnityEngine.EventSystems.PointerEventData pointerEvent, System.Boolean pressed, System.Boolean released) (at <00000000000000000000000000000000>:0)
    UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchEvents () (at <00000000000000000000000000000000>:0)
    UnityEngine.EventSystems.StandaloneInputModule.Process () (at <00000000000000000000000000000000>:0)
    UnityEngine.EventSystems.StandaloneInputModule:process()

    Do you know how this can be solved? My device uses Android 12, let me know if you need more specs about my device or some other information that may help us find a solution
     
  41. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Hey can you share the full logs from app start in a `.txt` attachment? Also, upgrade to NatCorder 1.9.1 to ensure you're not running into any bugs we've fixed.
     
  42. GutierManu

    GutierManu

    Joined:
    Jun 7, 2020
    Posts:
    8
    Apologies for my late reply, I'm not sure if this is what you requested, but here are all the logs I get when starting the app. As for the upgrade, I have notified my team about this possible solution, however, according to what I was told, this might not be a possibility as the business model of the plugin has changed to subscription and, unfortunately, it's not feasible for us.
     

    Attached Files:

    • Log.txt
      File size:
      4.3 KB
      Views:
      147
  43. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Can you share the device logs from logcat? The logs you attached are from Unity.
     
  44. GutierManu

    GutierManu

    Joined:
    Jun 7, 2020
    Posts:
    8
    Thanks for clarifying. It's the first time I deal with logcat and am quite new in app development, so I apologize for any misunderstanding. Here's the logcat from when the app is started (Logcat.txt).

    Also I'm attaching the logcat from when I try to record a video with the device in question, in case it's of any use (Logcat error.txt).
     

    Attached Files:

  45. GutierManu

    GutierManu

    Joined:
    Jun 7, 2020
    Posts:
    8
    I was able to solve the issue! It seems setting the video dimensions to the screen size can break the functionality for some devices. Setting it to a fix value can solve this bug (in my case I was able to make it work with 720p and 1080p portrait).

    In the other hand, if you allow me the suggestion, I think those of us who got NatCorder before the business model changed to subscription should be allowed to continue receiving upgrades. The subscription model is not feasible or accessible to everyone and, frankly, the expectation was set to receive a complete and continuously updated product at the moment of purchasing it. The subscription model actually encourages to look for competitors that can replace this functionality.
    However, this is only my personal opinion, there's no ill intent in my suggestion.

    I appreciate the willingness to help and thank you for reading me!
     
    Lanre and Menion-Leah like this.
  46. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    Sounds good. And regarding upgrades, this is one of the reasons why we switched to subscriptions. Maintaining software is expensive, so giving users free upgrades forever means we're taking on larger costs over time. For just about every product you can imagine, you have to pay for maintenance.
     
  47. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    107
    Will there be a plan for Natcorder-only in the future, though? I'm not against subscriptions, but is there a reason why it's packaged together with the other stuff? I think you may have mentioned programmatically they are somewhat tied together, but from a consumer perspective I feel like I'm paying for unrelated stuff I'm not going to use.
     
    Menion-Leah likes this.
  48. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,973
    We're only bundling NatCorder and NatDevice from now on. You can read more here.
     
  49. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    107
    That's great news, thank you.
     
    Lanre likes this.
  50. ZhouKe

    ZhouKe

    Joined:
    Jun 9, 2017
    Posts:
    1
    I bought natcorder on assetstore ,why I can't upgrade it on assetstore now?