Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    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:
    3,974
    We've migrated to a new distribution model that uses subscriptions. See NatCorder on GitHub.
     
  2. danielesuppo

    danielesuppo

    Joined:
    Oct 20, 2015
    Posts:
    332
    So we, that bought NatCorder time ago (and it was not so cheap), have to pay twice?
     
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    We've moved to subscriptions, so you can either do a monthly or annual plan. What you're paying for is continued access to the latest and greatest (and all the maintenance and fixes that come with it). Otherwise, DM me your invoice number and I'll send you the version of NatCorder that you purchased.
     
  4. SDani

    SDani

    Joined:
    Dec 3, 2016
    Posts:
    2
    I have also purchased this asset on the asset store and never had a chance to use it yet. And now not only is it deprecated, but the author has uploaded an empty package (downloading through asset store downloads 0 files; not sure why Unity even allowed such an upload).

    How do I access what I have purchased?
     
    DragonCoder likes this.
  5. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    PM me with your invoice number and I'll share the last Asset Store build.
     
  6. SDani

    SDani

    Joined:
    Dec 3, 2016
    Posts:
    2
    I've received the asset. Thank you.
     
    Lanre likes this.
  7. fcloss

    fcloss

    Joined:
    Dec 1, 2011
    Posts:
    192
    Hi,

    I've just PMd you to have access to the last Asset Store build too.

    Thanks!
     
    Lanre likes this.
  8. PlasticApps

    PlasticApps

    Joined:
    Mar 4, 2017
    Posts:
    13
    What a surprise! Purchased this plugin long time ago, and now its broken, and i can't even redownload package. GOOD FOR YOU Guys!
     
  9. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Have you tried PM'ing or emailing for support?
     
  10. shiquhudong

    shiquhudong

    Joined:
    May 19, 2017
    Posts:
    26
    InvalidOperationException: NatCorder session token is invalid. Check your NatML access key.
    I've got this error on web GL.
     
    Last edited: Mar 10, 2023
  11. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Let's continue this conversation on the GitHub issue you created.
     
  12. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,057
    Hi,

    So I purchased NatCorder several years ago and was disappointed to discover it had been discontinued on the asset store, especially as I'd not updated it for quite a while so am stuck with an old version. I've sent a DM to @Lanre so hopefully I'll at least get the last version that was released on the asset store.

    Going forward I may well invest in VideoKit Core, as honestly NatCorder was one of the best assets I've used, but I find the details to be unclear.

    Can someone from NatML confirm that I am free to sign up for Core on a monthly basis while building my app, then cancel/pause the subscription and only renew it for a month at a time whenever I need to make new builds.

    So for example say I get VideoKit Core for a couple of months during development and making initial builds, then I cancel it and say 8 months later if I need to update the app I will need to re-subscribe and pay for a month to make a new build?

    It feels a bit weird but would certainly be more acceptable than having to subscribe forever, especially considering the difference in cost from the original NatCorder asset to a year on year subscription.

    Thanks.
     
  13. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Hey, I saw your DM and will respond in a moment. And yes, your thinking is correct. Currently, you'll only need the Core subscription while developing your app.
    If you aren't consistently developing your app, then yes you can go on-and-off. Most studios that use our tech are usually constantly pushing out updates to their apps, so they get longer subscriptions (1 year).
     
    Noisecrime likes this.
  14. FreedLOW

    FreedLOW

    Joined:
    Dec 7, 2019
    Posts:
    15
    Hello, can you help me please, is it works on iOS build and the code is correct?
    The ControlRecording method is link to the UI button and for that i can controll the recording state or i did something wrong?

    Code (CSharp):
    1.  
    2.         public void ControlRecording()
    3.         {
    4.             try
    5.             {
    6.                 isRecord = !isRecord;
    7.              
    8.                 if (isRecord)
    9.                 {
    10.                     var cameraTexture = new WebCamTexture();
    11.                     cameraTexture.Play();
    12.                     var clock = new RealtimeClock();
    13.                     recorder = new MP4Recorder(Screen.width, Screen.height, 60f);
    14.                     _cameraInput = new CameraInput(recorder, clock, Camera.main);
    15.                     StartCoroutine(RecordingVideoRoutine(cameraTexture, clock));
    16.                 }
    17.                 else
    18.                 {
    19.                     StopRecording();
    20.                 }
    21.              
    22.                 onRecording?.Invoke(isRecord);
    23.             }
    24.             catch (Exception exception)
    25.             {
    26.                 Debug.LogError(exception.ToString());
    27.             }
    28.         }
    29.  
    30.         private async void StopRecording()
    31.         {
    32.             Debug.LogError("end recording");
    33.             _cameraInput.Dispose();
    34.             var path = await recorder.FinishWriting();
    35.             Debug.LogError("Here video path: " + path);
    36.         }
    37.  
    38.         private IEnumerator RecordingVideoRoutine(WebCamTexture cameraTexture, RealtimeClock clock)
    39.         {
    40.             Debug.LogError("start recording");
    41.             while (isRecord)
    42.             {
    43.                 recorder.CommitFrame(cameraTexture.GetPixels32(), clock.timestamp);
    44.                 yield return new WaitForEndOfFrame();
    45.             }
    46.         }
     
    Last edited: Apr 24, 2023
  15. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    You seem to be trying to record video frames from both a game camera and a WebCamTexture. You have to choose one. Also, I strongly recommend migrating to VideoKit's `VideoKitRecorder` component instead of writing NatCorder code.
     
  16. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    84
    Is there a reason it went to a subscription model for an asset that runs locally on the device? Sub models are primarily used for online services and features.
     
  17. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    One-time sales don't cover the cost of maintaining the software. Besides, we're also offering ML-powered features now (think captioning) that span both on-device and cloud AI.
     
  18. FreedLOW

    FreedLOW

    Joined:
    Dec 7, 2019
    Posts:
    15
    Hello @Lanre, I use following code to record video with audio:

    Code (CSharp):
    1. private IEnumerator Start()
    2.         {
    3.             camera = Camera.main;
    4.  
    5.             microphoneSource = gameObject.AddComponent<AudioSource>();
    6.             microphoneSource.mute =
    7.                 microphoneSource.loop = true;
    8.             microphoneSource.bypassEffects =
    9.                 microphoneSource.bypassListenerEffects = false;
    10.             microphoneSource.clip = Microphone.Start(null, true, 1, AudioSettings.outputSampleRate);
    11.             yield return new WaitUntil(() => Microphone.GetPosition(null) > 0);
    12.             microphoneSource.Play();
    13.         }
    14.  
    15.         private void OnDestroy()
    16.         {
    17.             microphoneSource.Stop();
    18.             Microphone.End(null);
    19.         }
    20.  
    21.         public void StartRecording()
    22.         {
    23.             var sampleRate = recordMicrophone ? AudioSettings.outputSampleRate : 0;
    24.             var channelCount = recordMicrophone ? (int) AudioSettings.speakerMode : 0;
    25.             var clock = new RealtimeClock();
    26.             recorder = new MP4Recorder(videoWidth, videoHeight, FRAME_RATE, sampleRate, channelCount, audioBitRate: 96_000);
    27.             // Create recording inputs
    28.             cameraInput = new CameraInput(recorder, clock, camera);
    29.             audioInput = recordMicrophone ? new AudioInput(recorder, clock, microphoneSource, true) : null;
    30.             // Unmute microphone
    31.             microphoneSource.mute = audioInput == null;
    32.  
    33.             if (IsRecord) return;
    34.             IsRecord = true;
    35.             OnRecording?.Invoke(IsRecord);
    36.         }
    37.  
    38.         public async void StopRecording()
    39.         {
    40.             IsRecord = false;
    41.             OnRecording?.Invoke(IsRecord);
    42.  
    43.             // Mute microphone
    44.             microphoneSource.mute = true;
    45.             // Stop recording
    46.             audioInput?.Dispose();
    47.             cameraInput.Dispose();
    48.             var path = await recorder.FinishWriting();
    49.  
    50.             previewRecordService.ShowVideoPreview(path);
    51.         }
    on iOS evrything working fine, but on Android it's record without audio, why?
    I added permission to manifest too but it's not help
     
    Last edited: Jul 3, 2023
  19. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    This would be an issue with Unity's `Microphone` API. I recommend switching over to VideoKit, which uses our own custom microphone implementation (purpose-built for video recording).
     
  20. FreedLOW

    FreedLOW

    Joined:
    Dec 7, 2019
    Posts:
    15
    I had only your old plugin, which was bought on asset store, and I fixed this by using NatDevice, but I have a next question, how can I record audio from microphone and from Unity sound at the same time?
     
  21. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    NatDevice does not support mixing Unity audio with mic audio. We'll be adding that to VideoKit sometime later this year.
     
  22. svenneve

    svenneve

    Joined:
    May 14, 2013
    Posts:
    81
    I've sent an email and invoice to sales in the hopes of getting a working unitypackage so we can actually use this bought for asset.
    Any idea how long this usually takes?
     
  23. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Oh! yes I bought it too but the MP4 encoding fails in the version I downloaded. I'd really like a fixed version! Can we send invoice Id to just get a version with that fix?
     
  24. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Just emailed you the NatCorder 1.8.2 build.
     
  25. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Hey, depending on what version you have, you might need to switch over to our VideoKit product for a fix. NatCorder has been deprecated, so NatCorder 1.8.2 is the last version that you can use from the Asset Store without moving over to our new VideoKit subscription product.
     
  26. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    655
    Thx, DM'd.
     
    Lanre likes this.
  27. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Responding now.
     
  28. aholla

    aholla

    Joined:
    May 27, 2014
    Posts:
    81
    Hi,

    I would like to record video and capture audio but i would like the Audio to be muted during the gameplay so the user does not hear it. (If they have muted the app, i still want music in the video they record.)

    There used to bea bool value at teh end of the AudioInput but it is no longer there. Is there an alternative method?

    Code (CSharp):
    1.  
    2.  
    3. _audioInput = new AudioInput(_videoRecorder, clock, _audioSource); // What happened to the bool for mute?
     
  29. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Looks like we removed the `mute` flag. You'll have to manually mute by creating a script which has an `OnAudioFilterRead` function that zeros out the array. Make sure your script runs *after* the `AudioInput`, so that the audio input doesn't get silence.
     
  30. aholla

    aholla

    Joined:
    May 27, 2014
    Posts:
    81
    I'venot used "OnAudioFilterRead" before...

    So something like:
    Code (CSharp):
    1. void OnAudioFilterRead(float[] data, int channels)
    2. {
    3.     foreach(var d in data)
    4.     {
    5.         d = 0;
    6.     }
    7. }

    And then move this to after default time in the script execution order?

    Also, how do I make it mute the specific "AudioSource", I want the the game audio to continue but record a different audiosource in the background?
     
  31. jimmying

    jimmying

    Joined:
    Sep 20, 2017
    Posts:
    108
    Hi, I DMd about getting the last package available on the asset store. Anything else you need besides invoice ID? Thanks
     
    Lanre likes this.
  32. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Yup, that should work!
     
  33. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Hey sorry about the delay, responding now.
     
    jimmying likes this.
  34. FarhezAhmed

    FarhezAhmed

    Joined:
    Dec 15, 2020
    Posts:
    17
    Hi,

    how would i start a record with start button and stop the record with stop button ?
     
  35. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Hey, we have deprecated NatCorder. With VideoKit, you can add a script to call `videoKitRecorder.StartRecording` and `videoKitRecorder.StopRecording`.
     
  36. FarhezAhmed

    FarhezAhmed

    Joined:
    Dec 15, 2020
    Posts:
    17
    where can i get that ?
     
  37. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
  38. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Hey there, I recommend migrating to VideoKit as we don't have any reports of this issue. We have deprecated NatCorder and no longer provide support for it.
     
  39. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Hey there, can you send an email to hi@fxn.ai. We'll have to continue support over email.
     
  40. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    The `StartRecording` and `StopRecording` methods return tasks, so they aren't visible in the Unity dropdown. You'll have to call another script that then calls `await recorder.StartRecording();`
     
  41. bmadtechnology

    bmadtechnology

    Joined:
    Jun 9, 2017
    Posts:
    3
    Hi there, we experienced the same color issue after recording mp4 with Natcorder on some Android devices but not all of them, and no problem on iOS. We found this thread and started to perform tests on VideoKit that we purchase the subscription but the exact same issue remains. Could you please give us support on this issue?
     
  42. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Hey there, just responded to your email.
     
  43. internet8

    internet8

    Joined:
    Nov 8, 2013
    Posts:
    13
    Hello,

    I have purchased NatCorder in 2020. Does it still work with newer PC tech and with Windows 11?
     
  44. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    It should, but if any issues come up, we won't be able to provide support for it as we have deprecated NatCorder.

    We have moved over to VideoKit, an all-in-one media library for Unity.
     
  45. nawin_gamedev

    nawin_gamedev

    Joined:
    Sep 11, 2023
    Posts:
    7
    Can I use Videokit free version for testing??, i have tried to use it but its not working and throwing an exception of "VideoKit plan only allows for limited functionality. Check your plan and upgrade at https://hub.natml.ai" and video is not being saved in any part of storage,could you please guide me through this? and Can I use recorder for AR Camera???(AR core and ARkit)
     
    Last edited: Mar 28, 2024
  46. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Hey, you should be able to record a video on the free plan. Make sure to disable audio recording because the free plan doesn't support audio or microphone streaming.
     
    nawin_gamedev likes this.
  47. nawin_gamedev

    nawin_gamedev

    Joined:
    Sep 11, 2023
    Posts:
    7
    Thanks for your response, Free plan is working fine and Mistake is mine, I have some doubts in subscription :
    1.Is there restriction in no.of builds taken??
    2.Is there any maximum time limit for recording??
    3.Can I use my access key in different systems(For Example: I am using mac for ios builds and some time i will use window PC for VR apps) Can I use same access key and share my subscription across systems or Should I purchase another subscription for my windows PC??
    4.Does the Build live in playstore will work as it is, Even after my subscription end?? or Will it have a effect on user devices??
     
  48. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,974
    Sorry for the late response on this, I just saw it. Answers:
    1. No restriction on number of builds.
    2. No maximum limit on recording time.
    3. Yes, you can use the same access key across different computers.
    4. Yes, a built app will work as is, even if you end your subscription. The only exception is if you use AI-powered features, because we have to pay our AI provider in order for these features to work (so you have to pay us).