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. seneka123

    seneka123

    Joined:
    Jun 16, 2013
    Posts:
    30
    And me again!) In my application, I use Vuforia for AR, if you record video from the main camera, everything works great, but as soon as I switch to the front camera, everything appears correctly on the screen, but in the video recording all the normals of the geometry are turned inside out, How to fix it?
    P.S. Sorry for my English!
     
  2. Shane-Pangea

    Shane-Pangea

    Joined:
    Dec 12, 2012
    Posts:
    25
    Is there a way that I can add additional audio to the recorded video after the video has been recorded?
     
  3. CPUDohyeong

    CPUDohyeong

    Joined:
    Mar 5, 2019
    Posts:
    1
    Code (CSharp):
    1. public void StartRecording()
    2.         {
    3.             StartRec();
    4.  
    5.             // Create a recording configuration
    6.             const float DownscaleFactor = 2f / 3;
    7.             var configuration = new Configuration((int)(Screen.width * DownscaleFactor), (int)(Screen.height * DownscaleFactor));
    8.  
    9.             // Start recording with microphone audio
    10.             if (recordMicrophoneAudio)
    11.             {
    12.                 // Start the microphone
    13.                 audioSource.clip = Extensions.Microphone.StartRecording();
    14.                 audioSource.loop = true;
    15.                 audioSource.Play();
    16.                 // Start recording with microphone audio
    17.                 Replay.StartRecording(Camera.main, configuration, OnReplay, audioSource, true);
    18.                 Debug.Log("microphone function");
    19.             }
    20.  
    21.             // Start recording without microphone audio
    22.             else
    23.             {
    24.                 Replay.StartRecording(Camera.main, configuration, OnReplay, audioSource, false);
    25.                 Debug.Log("else function");
    26.             }
    27.  
    28.              
    29.         }
    There is no problem with the quality of the recorded video, but the quality of the audio is very bad. Do you know how to adjust the sound quality?

    Please help me...
     
    Last edited: Apr 24, 2019
  4. boxofgod8521

    boxofgod8521

    Joined:
    Oct 14, 2014
    Posts:
    13
    I have a question.
    How do I get my camera resolution
    I want to use the highest resolution to recorder.
     
  5. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    I'm not at all familiar with this. I have a no clue as to why switching a camera in Vuforia will invert normals. This seems to be a known issue in Vuforia:
    - https://developer.vuforia.com/forum/issues-and-bugs/front-camera-issue-mirror-image
    - https://developer.vuforia.com/forum...has-inverted-normals-uwp-after-using-arcamera
     
  6. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    NatCorder doesn't have any video editing functionality. Anything that has to do with "after the video has been recorded" gets out of scope for NatCorder.
     
  7. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    You are recording from Unity's Microphone API, which is known to produce glitchy audio. We created our own native microphone API, NatMic, because of this.

    PS: Upgrade to the latest version of NatCorder. You are using a very old version.
     
  8. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
  9. adre

    adre

    Joined:
    Mar 28, 2014
    Posts:
    37
    Hi @Lanre,
    when i record using the camera of the device, the video is very very slow, very low fps. Is it normal having these low performances?
     
  10. seneka123

    seneka123

    Joined:
    Jun 16, 2013
    Posts:
    30
    Hello! How to implement microphone recording in video with the help of NatCorder and NatMic?
     
  11. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    Depends on what the framerate of the camera and resolution of the recording is. I would need more information to advise you in any way. What device, what OS version, what is the camera framerate, what is the recording resolution, can you share some recording code?
     
  12. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    See the NatMicCorder Demo.
     
  13. seneka123

    seneka123

    Joined:
    Jun 16, 2013
    Posts:
    30
    Help me!
     

    Attached Files:

  14. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    Your script must implement NatMic's IAudioProcessor interface.
     
  15. seneka123

    seneka123

    Joined:
    Jun 16, 2013
    Posts:
    30
    How can I do it?
     
  16. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
  17. adre

    adre

    Joined:
    Mar 28, 2014
    Posts:
    37
    Solved.
    Basically i was recording with a FixedIntervalClock at 25fps, because i needed 25fps the output. But the app was going at 60fps, so it was basically slowing down the video. Solved just forcing the app at 25fps during the recording and then back to 60.

    Thanks.
     
    Lanre likes this.
  18. anatoogle

    anatoogle

    Joined:
    May 25, 2018
    Posts:
    6
    Hi,
    is it possible to export a jpg image sequence in addition / or instead of the mp4 or GIF?
    I'm using NatCorder on my Android.
     
  19. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    No this is not supported by NatCorder.
     
  20. Mr-Rouf

    Mr-Rouf

    Joined:
    Mar 1, 2015
    Posts:
    10
    Last edited: May 1, 2019
  21. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    Can you try deleting and reimporting NatMic into your project? Also, note that armv7 support will be removed in the next updates of our API's because we will be targeting iOS 11, which formally deprecates armv7. So a longer-term fix here will be to simply not build an armv7 slice.
     
  22. Mr-Rouf

    Mr-Rouf

    Joined:
    Mar 1, 2015
    Posts:
    10
    I re-imported NatMic as you suggested - nothing has changed.
    Next step - I set IOS version to 11, and now it work fine. Thanks.
     
    Lanre likes this.
  23. davidborbis

    davidborbis

    Joined:
    May 2, 2019
    Posts:
    9
    I am interested in purchasing this asset. With this asset is it possible to record an AR session while mirroring the session live to an apple TV/miracast dongle with IOS or android?
     
  24. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    NatCorder functions entirely within Unity Engine. As a result, there is no support for things like mirroring.
     
  25. davidborbis

    davidborbis

    Joined:
    May 2, 2019
    Posts:
    9
    Thanks for the response. I did not word my question properly. I was wondering if it was possible to record through your asset in my application, and still be able to mirror outside of the application with the operating system.

    For example I will mirror my Ipad to my apple tv, then open my unity app. I tried using replay kit with IOS to record my screen within my unity app.
    https://docs.unity3d.com/ScriptReference/Apple.ReplayKit.ReplayKit.html
    When I am mirroring, it becomes unavailable until I stop mirroring, it's like IOS can handle one or the other and not both at the same time.

    With Android, I have tried using a screen recorder app, and then using smart view to connect to a miracast dongle, and then open my unity app. I tried several apps and whenever I get this message from an app “(app name) will start capturing everything that's displayed on your screen” I will get kicked off the miracast device. I tried using this plugin with my unity project so I could just record from my app.
    https://github.com/thanh-nguyen-kim/Unity_Android_Screen_Recorder
    And it gave me that same message with my app that I got with the screen recording apps and kicked me off.

    So I didn’t mean to ask if your asset could mirror, sorry for the confusion. I was just wondering if I could still mirror from my device, and record from my unity app using your asset, or if I would get the same limitations.
     
  26. unity_noMf5kG54sxntg

    unity_noMf5kG54sxntg

    Joined:
    Nov 18, 2018
    Posts:
    4
    Hello.
    I bought NatCorder.

    I could mp4 saved :) (ReplayCam_ok.cs)
    But I want use device microphone and I bought nat mic.
    And I changed from ReplayCam_ok.cs to ReplayCam_bad.cs.
    It doesn't work. I couldn't save.
    What should I do??

    I changed Android Manifest
    Code (CSharp):
    1. "  <uses-feature android:name="android.hardware.microphone" android:required="true" />
    2. "
     

    Attached Files:

  27. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    I would imagine that NatCorder would see the same constraints when mirroring. The hardware encoder likely becomes unavailable when mirroring (it is probably being used to transmit frames for mirroring).
     
    davidborbis likes this.
  28. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    Can you share logs from logcat?
     
  29. unity_noMf5kG54sxntg

    unity_noMf5kG54sxntg

    Joined:
    Nov 18, 2018
    Posts:
    4
    Thanks your replay.
    There is no error log, but i solved :)

    I changed from "public class ReplayCam : IAudioProcessor" to "public class ReplayCam : MonoBehaviour,
    IAudioProcessor" and created new prefab.
     
    Lanre likes this.
  30. davidborbis

    davidborbis

    Joined:
    May 2, 2019
    Posts:
    9
    Thank you for your response.

    I found out over the weekend, with the google app "play games", you can screen record and mirror the game your are playing, so it is possible, and I didn't get pop up message. Does anyone who has made an app with this asset in android know if you get the “(app name) will start capturing everything that's displayed on your screen” alert message from your android when you record video?
     
  31. davidborbis

    davidborbis

    Joined:
    May 2, 2019
    Posts:
    9
    I went ahead and purchased it, and it works! I can mirror and record with IOS. I am excited :D
     
    Lanre likes this.
  32. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    Nope, because NatCorder is technically not a screen recorder; it is a texture recorder that can--in effect--record the screen.
    Sounds great!
     
  33. HappyShip

    HappyShip

    Joined:
    Jun 15, 2017
    Posts:
    7
    I've been trying to record my AR scenario with this, but been running into problems.
    Using the plugin, videos do seem to get saved to my (Android) phone (in the persistent datapath folder), however these .mp4 files seem to have a length of 0 seconds. They cannot be played by a videoplayer, they do not show up in the gallery of the phone, but they do take up memory.

    Am I missing something obvious that i should have done? I'll attach the code I'm using, which is pretty similar to the code used in your ReplayCam example.

    EDIT: It seems like I did miss something obvious; I overlooked that in the example, the AudioSource is assigned in the inspector. Mine was never assigned to, therefor throwing a NullReference and breaking the recording. Woops... :(
     

    Attached Files:

    Last edited: May 7, 2019
  34. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    Sounds good.
     
  35. PYJ11

    PYJ11

    Joined:
    Jan 29, 2019
    Posts:
    7
    Can I use NatCorder to record my voice?
     
  36. PYJ11

    PYJ11

    Joined:
    Jan 29, 2019
    Posts:
    7
    내 음성과 게임 화면을 동시에 녹음 할 수 있습니까?
     
  37. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    NatCorder is a video recorder. It is not a microphone, and does not record only audio (there must be video).
     
  38. PYJ11

    PYJ11

    Joined:
    Jan 29, 2019
    Posts:
    7
    Thanks!bb
     
  39. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,142
  40. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    NatCorder does not support UWP, only Windows 10.
    NatCorder is strictly a video recorder. It does not have any social functionality.
    I'm not familiar with this package, but it looks like a screen recorder. NatCorder is technically a texture recorder, so it is much more versatile and supports more platforms.
     
  41. worstoo

    worstoo

    Joined:
    Nov 10, 2016
    Posts:
    1
    I have purchased natcorder. I have had a few issues getting it working.

    On an older version of natcorder the editor worked fine, but recordings were corrupt and unplayable on iOS & Android. I have upgraded to the latest version of natcorder and now my editor recordings are recording very slowly (1 frame every second or two.) And the resulting videos are sometimes corrupt. The plugin is completely unusable as it is.

    I've re-imported natcorder completely but the results are the same. The greyworld and replay camera examples both exhibit the issue. Likewise, the recording doesn't work on iOS or Android as expected.

    Am I doing something wrong???

    Editor:
    MacBook Pro (15-inch, 2018)
    Mac OS 10.14.4 (18E226)
    Unity 2018.3.14f1 & Unity 2019.1.2f1
     
  42. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    I haven't had any report of an issue like this. You say the ReplayCam and GreyWorld examples exhibit this same behaviour of 1 frame every second or two? Can you upload one such corrupt video? I'd like to analyse it.
     
  43. anatoogle

    anatoogle

    Joined:
    May 25, 2018
    Posts:
    6
    When I use the VideoPlayer in Unity, the recorded Video from NatCorder does not play correctly.
    In the Editor the video appears to jump a few frames. On the Android it will only play a few frames and then stops.
    I created a Debug.Log to inspect what might happen (See Upload Picture).
    It looks like that some frames are getting skipped and some frames are being played several times.
    (sometimes it skip or repeat up to 6 times/frames)
    This problem happens with any Video I create in the Editor or on Android with NatCorder (latest Version).
    Other video files are working without any issue.

    Any idea what might cause my problem?
     

    Attached Files:

  44. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    Email me the recorded video itself. The Unity VideoPlayer adds another layer of possibilities that could be a factor in this issue. I need to isolate it to NatCorder to confirm that it is in fact a NatCorder bug.
     
  45. anatoogle

    anatoogle

    Joined:
    May 25, 2018
    Posts:
    6
    Thanks for your quick response. I just send the Email.
     
    Lanre likes this.
  46. summer_zc

    summer_zc

    Joined:
    Dec 14, 2018
    Posts:
    4
    when I use this asset in android , I found this crash when i play Animation complete to stop NatCorder mp4Recorder, the android thread killed, can you help me?
     

    Attached Files:

  47. nikosurfing

    nikosurfing

    Joined:
    Mar 11, 2014
    Posts:
    43
    Hi, for the latest version i've got warning error:


    Assets\NatCorder\Examples\ReplayCam\CameraPreview.cs(29,39): warning CS0649: Field 'CameraPreview.useFrontCamera' is never assigned to, and will always have its default value false



    Eeven it's not crucial, but i need to delete this warning. How to fix it?
     
  48. nikosurfing

    nikosurfing

    Joined:
    Mar 11, 2014
    Posts:
    43
    @Lanre : Can you write the script example to do this? Please i am not coder/programmer. I need to record from audioListener NOT Microphone.

    EDIT:
    audioRecorder = AudioRecorder.Create(audioListener, recordingClock);

    This code no longer work :(

    UPDATE:
    Finally got it. For someone who want to record from audio listener, not from microphone this is the code:
    audioInput = new AudioInput(videoRecorder, recordingClock, audioListener);
     
    Last edited: May 15, 2019
    Lanre likes this.
  49. glutvort

    glutvort

    Joined:
    Apr 13, 2019
    Posts:
    31
    I need your help. I Use ARCore and i need to record video. I use latest vercion of plugin. My code
    Code (CSharp):
    1.  
    2. _clock = new RealtimeClock();
    3. _mediaRecorder = new MP4Recorder(Screen.width,Screen.height,30,0,1,OnRecording);
    4. _cameraInput =  new CameraInput(_mediaRecorder,_clock,Camera.main);
    5. _audioInput = new AudioInput(_mediaRecorder,_clock,Camera.main.GetComponent<AudioListener>());
    When i start recording my app freezing and dont record. Also my saved video is 480p((
     
    Last edited: May 15, 2019
  50. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,626
    You are using an older version of NatCorder. Upgrade to 1.5.1 on the Asset Store. If the crash remains, upload the logs in a .txt file (instead of taking a screenshot).