Search Unity

NatCorder - Video Recording API

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

  1. samhoudmedia

    samhoudmedia

    Joined:
    Oct 29, 2018
    Posts:
    1
    Hey, I am having exactly same issue described above. I've sent you an email with invoice number as well.
     
    Lanre likes this.
  2. Achoo

    Achoo

    Joined:
    Jun 4, 2015
    Posts:
    8
    hi @Lanre , Natcorder in Unity 2018.3.1f1 doesn't call the callback in the start recording function. It stops calling after 3-5 times. is Natcorder supported in Unity 2018.3.1f1?

    Hope the log helps


    01-18 14:47:21.616 32641-32660/com.test.testD/Unity: NatCorder: Preparing video encoder with format: {frame-rate=30, bitrate=5909760, height=1280, mime=video/avc, color-format=2130708361, i-frame-interval=3, width=720}
    01-18 14:47:21.636 364-937/? E/QC_CORE: OMXCORE: mNumOfNormalThread++, current is 4
    OMXCORE: mNumOfInstance++, current is 4
    01-18 14:47:21.636 364-25974/? E/OMX-VENC-720p: set_parameter: metamode is valid for input port only
    01-18 14:47:21.636 364-25974/? E/OMXNodeInstance: OMX_SetParameter() failed for StoreMetaDataInBuffers: 0x8000101a
    01-18 14:47:21.646 32641-4751/com.test.testE/ACodec: [OMX.qcom.video.encoder.avc] storeMetaDataInBuffers (output) failed w/ err -2147483648
    01-18 14:47:21.646 364-7012/? E/OMX-VENC-720p: WARNING: Unsupported Color format [2130708361]
    C2D init is successful
    01-18 14:47:21.646 364-938/? E/OMX-VENC-720p: WARNING: Unsupported Color format [2130708361]
    01-18 14:47:21.646 536-4694/? E/mm-camera: mct_pipeline_process_set:command=800000e
    mct_pipeline_send_ctrl_events: Send Set Parm events
    01-18 14:47:21.656 536-4694/? E/mm-camera: mct_pipeline_process_set:command=800000e
    mct_pipeline_send_ctrl_events: Send Set Parm events
    01-18 14:47:21.716 536-4694/? E/mm-camera: mct_pipeline_process_set:command=800000e
    mct_pipeline_send_ctrl_events: Send Set Parm events
    01-18 14:47:21.736 1660-1675/? E/MP-Decision: Update arg 1
    01-18 14:47:21.756 32641-4755/com.test.test D/Unity: NatCam Rendering: Created ES3 GLRenderContext
     
    Last edited: Jan 18, 2019
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    I don't quite understand what is going on here. Are you saying that the save callback doesn't get called after recording (and successfully being called) 3-5 times? Or are you saying that the save callback isn't getting called when you call StartRecording? The save callback isn't supposed to be called when you call StartRecording.
     
  4. shin_unity197

    shin_unity197

    Joined:
    Oct 30, 2017
    Posts:
    18
    Hi, @Lanre
    I'm getting a DllNotFoundException: Natcorder error for MacOSX only. It works fine on windows, iOS, and Android. From a previous comment, I heard this is due to the new Mac OS update. Do you know when you will be making an update to Natcorder to fix this issue?
     
  5. gshape

    gshape

    Joined:
    Aug 8, 2012
    Posts:
    94
    Hi Lanre, I am facing same issue like OFFICIAL_bryanw, I have sent an email a while ago and hope you can help. Thank you.
     
    Lanre likes this.
  6. rattlesnake

    rattlesnake

    Joined:
    Jul 18, 2013
    Posts:
    138
    Hello Lanre !
    In my current project I use the old natCam 1.6f2 wich contains also the "previous" natcorder.
    Videos recorded are playing very well with the unity VideoPlayerAPI.

    However when I record a video with natCorder 1.3f2 + natMic, the video is lagging like crazy when using the unity VideoPlayerAPI. The sound is playing ok but the video is stuck at almost the first frame.
    (The recorded video is however playing nice with vlc or "Handheld.PlayFullScreenMovie()".)

    My settings are in both cases the same :
    framerate = 30
    bitrate = 3681240
    keyframeInterval = 3
    Size : 720X1280
    Phone : Oneplus5

    Maybe with natCorder the codec is not the same or something ? (I'm not a pro at all).
    Do you know this issue ?
    i really need to use the VideoPlayerAPI.

    Edit :
    I analysed two videos (recorded from both cases) with a little soft wich allows to see all deep infos (MediaInfo) :

    And I spotted a strange thing. Videos exported with natCorder have a max Images/s very hight. Maybe this confused the video player from Unity ?

    Thanks a lot,
    Seb
     
    Last edited: Jan 20, 2019
  7. softmind-hiukim

    softmind-hiukim

    Joined:
    Jan 20, 2019
    Posts:
    1
    Did you fix this? I'm having the same problem.
     
  8. Achoo

    Achoo

    Joined:
    Jun 4, 2015
    Posts:
    8
    yup save callback doesn't get called after recording (and successfully being called) 3-5 times. it happens in Unity 2018.3.1f1 and crashes in previous version

    the bug in the log
    Code (CSharp):
    1. 01-21 10:20:49.495 8105-9105/? E/AndroidRuntime: FATAL EXCEPTION: NatCorder Video Encoding Thread
    2.     Process: com.test.test, PID: 8105
    3.     java.lang.Error: FATAL EXCEPTION [NatCorder Video Encoding Thread]
    4.     Unity version     : 2018.2.1f1
    5.     Device model      : samsung SM-T535
    6.     Device fingerprint: samsung/matisseltexx/matisselte:5.0.2/LRX22G/T535XXU1BOG1:user/release-keys
    7.  
    8.     Caused by: java.lang.IllegalStateException: Failed to stop the muxer
    9.         at android.media.MediaMuxer.nativeStop(Native Method)
    10.         at android.media.MediaMuxer.stop(MediaMuxer.java:225)
    11.         at com.yusufolokoba.natcorder.mp4.MP4Recorder.encoderFinished(MP4Recorder.java:110)
    12.         at com.yusufolokoba.natcorder.mp4.Encoder.run(Encoder.java:132)
    13.         at java.lang.Thread.run(Thread.java:818)
    when there is no callback, the video recording track is not added at all
    Code (csharp):
    1.  
    2.  D/Unity: NatCorder: Preparing video encoder with format: {height=768, width=1024, bitrate=5909760, mime=video/avc, frame-rate=30, i-frame-interval=3, color-format=2130708361}
    3.  D/Unity: NatCorder: Preparing audio encoder with format: {bitrate=64000, aac-profile=2, mime=audio/mp4a-latm, channel-count=2, channel-mask=12, sample-rate=24000}
    4.  D/Unity: NatCam Rendering: Created ES3 GLRenderContext
    5.  NatCorder: MP4 recorder added track 0 with format: {mime=audio/mp4a-latm, what=1869968451, csd-0=java.nio.ByteArrayBuffer[position=0,limit=2,capacity=2], channel-count=2, sample-rate=24000}
    6.  NatCorder: Audio encoder detected EOS marker
    7.  NatCorder: Audio encoder stopping
    8.  
     
    Last edited: Jan 21, 2019
  9. lowfrq

    lowfrq

    Joined:
    Nov 14, 2018
    Posts:
    3
    Hello, @Lanre !
    Thx for nice product!
    I'm using NatCorder for recording game replace without camera or mic.
    Is there some way to make OS not to ask allow access to camera and mic, bc app don't need it?
     
  10. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    The update should be on the Asset Store one of these days.
     
  11. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    Given that the video plays properly with VLC and Handheld.PlayFullscreenMovie, it doesn't sound like the issue is coming from NatCorder itself.
    I'm not familiar with this metric. What is images/s maximum? It sounds somewhat related to keyframes. Also, your bitrate looks low. Don't set the bitrate in VideoFormat if you're not sure what to set it to.
     
  12. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    AR is heavy on the CPU and GPU, so frames can get backed up in memory. If your app is running at 60FPS, then you'll want to encode every other frame (to effectively record at 30FPS). If you're using a CameraRecorder, set the CameraRecorder.recordEveryNthFrame property to 2.
     
  13. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    This should only happen when no video frames are being committed, but I'm sure you are actually committing video frames. In any case, this will be implicitly fixed in the update. We've moved to MediaCodec's async workflow.
     
  14. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    I think the permission is being requested because of the examples. You can delete the examples folder in NatCorder.
     
  15. Greybackaf

    Greybackaf

    Joined:
    Jan 21, 2019
    Posts:
    1
    Hello Lanre, I'm very excited about what I've been reading about NatCorder. I'm developing an AR app with Vuforia, are they compatible? I have only one AR Camera (Vuforia) in the Scene, and when detects the image targets play videos. I want to add a record button that records the screen, with video and audio, and when stop recording, it can be saved to the device, and share to social media. Can i do it with NatCorder?
    Also, wanna ask, do you have a trial version? I would like to getting it running before buying it. Thanks a lot.
     
  16. Achoo

    Achoo

    Joined:
    Jun 4, 2015
    Posts:
    8
    Yup, frames are being commited. when can the update be expected so can be integrated in our project?

    Also, i logged the frame which gets commited. It prints a value like "TempBuffer 35 1024x768 "

    the number value after tempbuffer keeps incrementing in the case recording fails, otherwise the number gets reused. (hopefully this will be easy to identify the reason for recording to fail)

    if fail,
    Code (csharp):
    1.  
    2. TempBuffer 30 1024x768
    3. TempBuffer 31 1024x768
    4. TempBuffer 32 1024x768
    5. TempBuffer 33 1024x768
    6. TempBuffer 34 1024x768
    7. TempBuffer 35 1024x768
    if success
    Code (csharp):
    1.  
    2. TempBuffer 6 1024x768
    3. TempBuffer 5 1024x768
    4. TempBuffer 6 1024x768
    5. TempBuffer 6 1024x768
    6. TempBuffer 5 1024x768
    7. TempBuffer 6 1024x768
     
    Last edited: Jan 21, 2019
  17. rattlesnake

    rattlesnake

    Joined:
    Jul 18, 2013
    Posts:
    138
    Edit :
    I finally found someting after hours and hours.
    In order to add some infos, I'm not using a CameraRecorder but instead I'm recording the stream from natCam directly using an "OnFrame()". And this "OnFrame()" is doing something wrong when creating the video because the player is not playing it well.
    BUT when I use an "Update()" instead then it's working perfectly because the Unity videoPlayer is able to read it !

    Code (CSharp):
    1. //Causing a video freeze when playing with Unity VideoPlayer API
    2. void OnFrame()
    3. {
    4.     if (NatCorderU.Core.NatCorder.IsRecording)
    5.     {
    6.         var frame = NatCorderU.Core.NatCorder.AcquireFrame();
    7.         Graphics.Blit(NatCam.Preview, frame);
    8.         NatCorderU.Core.NatCorder.CommitFrame(frame, recordingClock.CurrentTimestamp);
    9.     }
    10. }
    11.  
    12. //Working OK when playing with Unity VideoPlayer API
    13. void Update()
    14. {
    15.     if (NatCorderU.Core.NatCorder.IsRecording)
    16.     {
    17.         var frame = NatCorderU.Core.NatCorder.AcquireFrame();
    18.         Graphics.Blit(NatCam.Preview, frame);
    19.         NatCorderU.Core.NatCorder.CommitFrame(frame, recordingClock.CurrentTimestamp);
    20.     }
    21. }
    My questions is :
    - Why OnFrame() isn't doing a good job ?
    - Is it bad to use the update function instead ?[/QUOTE]
     
    Last edited: Jan 22, 2019
  18. adrian-clark

    adrian-clark

    Joined:
    Aug 9, 2018
    Posts:
    3
    Hi @Lanre , I am also having issues with the DllNotFound issue on MacOS Mojave. I sent you an email with my Unity purchase ID yesterday, if you're able to send me an updated version of the MacOS Bundle that would be great, it's the last piece I need to complete this project I'm working on. Cheers
     
  19. unityCZH

    unityCZH

    Joined:
    Nov 12, 2018
    Posts:
    16
    I used all the resolutions in the project, and all the resolutions caused the application to crash (memory crash).What's the solution??



    2019-01-24 11:38:53.566522+0800 picturebook[22130:1407440] NatMic: Microphone started recording with format: 1@24000Hz
    2019-01-24 11:38:53.567132+0800 picturebook[22130:1406468] NatCorder: Prepared MP4 video encoder at resolution 720x540@30Hz with average bitrate 5909759 and keyframe interval 3s
    2019-01-24 11:38:53.593479+0800 picturebook[22130:1406468] NatCorder: Prepared MP4 audio encoder for 1 channels at 24000Hz
    2019-01-24 11:38:53.594518+0800 picturebook[22130:1406468] NatCorder: MP4 recorder started recording
    -> applicationWillResignActive()
    2019-01-24 11:38:54.981160+0800 picturebook[22130:1406468] [Common] _BSMachError: port eae3; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
    -> applicationDidBecomeActive()
    2019-01-24 11:39:03.822002+0800 picturebook[22130:1406665] PBItemCollectionServicer connection disconnected.
    WARNING -> applicationDidReceiveMemoryWarning()
    2019-01-24 11:39:20.734205+0800 picturebook[22130:1406826] [default] LaunchServices: disconnect event (interruption) received for service com.apple.lsd.advertisingidentifiers
    2019-01-24 11:39:20.797575+0800 picturebook[22130:1406826] [default] LaunchServices: disconnect event (invalidation) received for service com.apple.lsd.advertisingidentifiers
    2019-01-24 11:39:20.806522+0800 picturebook[22130:1407452] [default] LaunchServices: disconnect event (interruption) received for service com.apple.lsd.mapdb
    2019-01-24 11:39:20.872104+0800 picturebook[22130:1407452] [default] LaunchServices: disconnect event (invalidation) received for service com.apple.lsd.mapdb
    Message from debugger: Terminated due to memory issue
     
  20. KLS14

    KLS14

    Joined:
    Apr 17, 2017
    Posts:
    1
    Hey @Lanre! I emailed you with my invoice number asking about the new version of the NatCorder asset that supports LWRP (I need this to test out recording for my project). Would you be able to send this to me at your earliest convenience?

    I was also wondering if you had a projected date for when this update for LWRP would be available on the Unity Asset Store for download by customers? Thank you for your time and help, I really appreciate it!
     
  21. unityCZH

    unityCZH

    Joined:
    Nov 12, 2018
    Posts:
    16
    When I put the CameraRecorder. RecordEveryNthFrame = 2 to reduce the number of frames sent, so as to avoid the memory corruption.The callback function was not executed when recording stopped on IOS device today. Meanwhile, XCode prompts the following information.Please help to solve it

    2019-01-25 14:29:58.316102+0800 picturebook[4241:182359] NatCorder: Prepared MP4 video encoder at resolution 1080x498@30Hz with average bitrate 5909759 and keyframe interval 3s
    2019-01-25 14:29:58.316417+0800 picturebook[4241:182359] NatCorder: Prepared MP4 audio encoder for 1 channels at 24000Hz
    2019-01-25 14:29:58.316440+0800 picturebook[4241:182359] NatCorder: MP4 recorder started recording
    2019-01-25 14:29:58.344318+0800 picturebook[4241:186041] NatMic: Microphone started recording with format: 1@24000Hz
    2019-01-25 14:30:08.969174+0800 picturebook[4241:182359] NatMic: Microphone stopped recording
    2019-01-25 14:30:08.970843+0800 picturebook[4241:182867] NatCorder: MP4 Encoder detected EOS marker
    2019-01-25 14:30:08.970864+0800 picturebook[4241:182867] NatCorder: MP4 recorder finishing
     
  22. ersh

    ersh

    Joined:
    Nov 22, 2015
    Posts:
    4
    Hello. Can I make screenshots (with save on mobile camera roll and share) with this assets (and NatShare)? If yes, how I can looking for it. Maybe demo or manual?
     
  23. Rivomist

    Rivomist

    Joined:
    Oct 1, 2016
    Posts:
    7
    Hi, we have a complex usage of your products (Natmic+Natcorder+Natshare) in our project, and all this stuff works perfectly in most cases. But samsung s9 owners report following errors when trying to save video (srdebugger screenshots):
    1st error:
    https://drive.google.com/file/d/1tUfkAOXU6OW-yZoL53J-pwkIKeh0ptv9/view?usp=sharing
    https://drive.google.com/file/d/1V0adRF-fC19bza0LDtNkVZhJUcU45WLc/view?usp=sharing
    https://drive.google.com/file/d/1aW4580zMCkjKfE8QkySmjM776XaGOOTX/view?usp=sharing
    2nd error:
    https://drive.google.com/file/d/18L7B_kWdOhoL3gN1FbNvhV8TIN78-3P0/view?usp=sharing
    https://drive.google.com/file/d/1d3DS-FTym0hHz3Dso8P66SWoEPVvh59Y/view?usp=sharing

    Unfortunately, we have no S9 to test it by ourself, and we cant make logcat. Do u have any solutions in mind? Thanks!
    Code we used for recording:
    Code (CSharp):
    1. public void StartRecording()
    2.         {
    3.             StartCoroutine(GrabScreenshot());
    4.             // Start the microphone
    5.             var microphoneFormat = Format.Default;
    6.             NatMic.StartRecording(microphoneFormat, OnSampleBuffer);
    7.             // Start recording
    8.             recordingClock = new RealtimeClock();
    9.             var audioFormat = new AudioFormat(microphoneFormat.sampleRate, microphoneFormat.channelCount);
    10.                 NatCorder.StartRecording(Container.MP4, new VideoFormat(Screen.width / 2, Screen.height / 2, 15, 5909760, 3), audioFormat, OnRecording);
    11.             // Create a camera recorder for the main cam
    12.             cameraRecorder = CameraRecorder.Create(recordingCamera, recordingClock);
    13.         }
    14.  
    15. public void StopRecording()
    16.         {
    17.             // Stop the microphone
    18.             NatMic.StopRecording();
    19.             // Stop recording
    20.             cameraRecorder.Dispose();
    21.             NatCorder.StopRecording();
    22.             FullPhoto();
    23.         }
    24. private void OnSampleBuffer(AudioEvent audioEvent, float[] sampleBuffer, long timestamp, Format format)
    25.         {
    26.             // Send sample buffers directly to NatCorder for recording
    27.             if (audioEvent == AudioEvent.OnSampleBuffer && NatCorder.IsRecording)
    28.                 NatCorder.CommitSamples(sampleBuffer, recordingClock.CurrentTimestamp);
    29.         }
    30. private void OnRecording(string path)
    31.         {
    32.             currPath = path;
    33.         }
    34. public void CamSave()
    35.         {
    36.             Debug.Log("current recording path is: " + currPath);
    37.             NatShareU.NatShare.SaveToCameraRoll(currPath);
    38. #if UNITY_ANDROID
    39.             File.Delete(currPath);
    40. #endif
    41.             panelPhoto.SetActive(false);
    42.         }
     
  24. shin_unity197

    shin_unity197

    Joined:
    Oct 30, 2017
    Posts:
    18
    Hi Lanre,
    I was wondering if we can do a feature request. Will it be possible to implement a feature where when a frame has been committed using CameraRecorder it triggers an event?
     
    Lanre likes this.
  25. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    21
    Hi,
    My App getting crash while sharing video (after recording) in iOS device. its showing memory issue
    My Unity version is 2017.4.2
     

    Attached Files:

  26. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    Yes, in fact a lot of developers use NatCorder with ARCore, ARKit, and Vuforia.
    To perform sharing, you'll also need NatShare. But this is all possible.
    Unfortunately we don't. It's all code, so there isn't an easy way for us to make a stripped-down, trial version.
     
  27. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    If you don't want to wait for AS review, email me. We've had some hiccups in the past.
    I don't expect this to remain an issue in the update, but if it does let me know.
     
  28. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    [/QUOTE]
    This completely blows my mind. There should be absolutely no relation between where Blit is called, and whether Unity's VideoPlayer can play the file. The reason why I recommend against calling Blit in Update is that if you are blitting from a texture that is going to be written on, then the Blit itself will cause visual artifacts (like on Metal, it will be black). This apparently doesn't affect NatCam's preview texture.
     
  29. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    I think I responded a few days ago; sorry for the delay.
     
  30. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    What device are you recording on, and how much memory is your app using when not recording?
    I saw your email on this; I've responded.
     
  31. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    Hi there. I think I've responded to your email.
     
  32. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    Hey there. NatCorder doesn't take screenshots; it only records videos or animated GIF images.
     
  33. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    Your code looks good. The first error has been fixed in the update, and the second error is as a result of the first error.
     
  34. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    I'm curious as to why you want this event. This really depends on what platform you are recording on. I'm gonna speak based on the NatCorder 1.4.0 update (1.3 is a bit different on iOS). Starting from 1.4.0, all platforms except Android encode a video frame by sending pixel data to the native backend for encoding. So in the CommitFrame code (NatCorderOSX.cs), you will see that there is a `NatCorderBridge.EncodeFrame` call. Immediately after that, the RenderTexture is released. Here, you can modify the code to invoke an event.

    On Android, things are slightly different because we send the texture itself to the native backend for encoding (and not the texture's pixel data). Once the texture has been encoded, we send a notification back to C# (the onEncode function in NatCorderAndroid.cs). Here's where we release the RenderTexture, and that's where you can add your event.
     
  35. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    Your recording resolution is extremely high (2048x1536). I recommend decreasing it to 1600x900 or 1920x1080. Also, update your version of NatCorder because you are using 1.2.
     
  36. Arjun-Gupte

    Arjun-Gupte

    Joined:
    May 31, 2013
    Posts:
    21
    Hi,
    Can we Record audio from mic along with video recording using NatCorder?.
    If yes let me know how to do that.
     
  37. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    Yes you can. The ReplayCam example does this with Unity's Microphone API. And here is an example project using our own microphone API, NatMic.
     
  38. Rivomist

    Rivomist

    Joined:
    Oct 1, 2016
    Posts:
    7
    We have no available updates for any of your assets, this update isn't released yet? If so how long should we wait?
     
  39. shin_unity197

    shin_unity197

    Joined:
    Oct 30, 2017
    Posts:
    18
    Hi Lanre,

    To answer your previous question, it was to collect the current state of the scene per frame while recording. Thank you for guiding me to the correct path.

    On a separate note there seems to be a bloat in memory whenever I record. I'm currently using the Natcorder 1.4 you provided me with Unity 2018.3.0f2 on an iPhone 6s using ARKit. My memory starts at 450mb and then shoots to 1.3 gb when recording and it eventually crashes. The following code snippet is what I'm using to start Natcorder. This issue if I recalled was occurring even on Natcorder 1.3.


    Code (CSharp):
    1.                 m_recordMicrophoneAudio &= m_container == Container.MP4;
    2.                 // Create recording configurations // Clamp video width to 720
    3.                 var width = 720;
    4.                 var height = 1280;
    5.                 var framerate = 30;
    6.                 var videoFormat = new VideoFormat(width, (int)height, framerate);
    7.            
    8.                 var microphoneFormat = Format.DefaultForMixing;
    9.                 AudioListener audioListener = Camera.main.GetComponent<AudioListener>();
    10.  
    11.                 NatMic.StartRecording(audioListener, microphoneFormat, OnSampleBuffer);
    12.                 var audioFormat = m_recordMicrophoneAudio ? new AudioFormat(microphoneFormat.sampleRate, microphoneFormat.channelCount): AudioFormat.None;
    13.                 m_recordingClock = new RealtimeClock();
    14.  
    15.                 // Start recording
    16.                 NatCorder.StartRecording(m_container, videoFormat, audioFormat, OnReplay);
    17.                 m_videoRecorder = CameraRecorder.Create(Camera.main, videoFormat, m_recordingClock);
     
  40. PYJ11

    PYJ11

    Joined:
    Jan 29, 2019
    Posts:
    7
    I don't know how to use it. I'd like to know an example, which is not detailed in the document.

    Start shooting
    NatCorder.StartRecording (Container.MP4, VideoFormat).Screen, AudioFormat.None, callback);

    End of filming
    NatCorder.StopRecording ();

    There are no examples of where to specify the storage path, how to record with a specific camera.

    If you recorded the above content, 0KB of files will be saved.

    I'd like to know more about usage or examples.
     
  41. BaseOfCoding

    BaseOfCoding

    Joined:
    Jul 27, 2018
    Posts:
    5
    I also had such an experience.
    I watched the memory rise sharply after recording about 3-5 times.
    My solution was to reduce the size of the width.
    It was the increase of memory because it recorded as much as the size of the device panel.
    So please reduce the size once.
    In the StartRecoding function
     
  42. PYJ11

    PYJ11

    Joined:
    Jan 29, 2019
    Posts:
    7
    Can users specify their own storage path?

    If the user can specify a storage path, what should they do?
     
  43. PYJ11

    PYJ11

    Joined:
    Jan 29, 2019
    Posts:
    7
    Thank you!!! ... and...

    Can users specify their own storage path?

    If the user can specify a storage path, what should they do?
     
  44. PYJ11

    PYJ11

    Joined:
    Jan 29, 2019
    Posts:
    7
    Editor succcess, but Android Fail....
     
  45. Skjalg

    Skjalg

    Joined:
    May 25, 2009
    Posts:
    150
    I recently bought the asset as well. I'm impressed with the small API, but it could be a little bit better with another example scene that shows how to record gameplay and not just a web camera.

    So I created one, its in a similar style to the two other examples that come with the asset.
    The "gameplay" is just a cube moving around randomly on screen. You press the recordbutton just like the other two scenes and when you release the video is then loaded into a Video Player component and played in a RawImage. Its attached to this post as GameCam.zip. Feel free to download it and put it into your natcorder/examples folder. @Lanre you also have my permission to bundle it with your asset.

    I also second the request to be able to set the storage path
     

    Attached Files:

    Menion-Leah likes this.
  46. Skjalg

    Skjalg

    Joined:
    May 25, 2009
    Posts:
    150
    I am getting a bug on Windows 10 where the recording comes out very blue. It happens when I use OpenGLCore as Graphics API under player settings.
    upload_2019-2-2_12-26-7.png

    The video should look like this:
    Unity_2019-02-02_12-21-26.png
    But ends up looking like this:
    vlc_2019-02-02_12-22-14.png

    I am also experiencing huge lags when using my example code (see post before this) when recording anything longer than a few seconds. The code is really simple so shouldn't be hard to track down. It seems the problem is with NatCorderBridge.EncodeFrame that for some reason just suddenly starts using 1 second per frame.
     
    Last edited: Feb 2, 2019
  47. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    If you don't want to wait, email me for a build.
     
  48. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    The iPhone 6 and 6s have particularly bad recording performance, which leads to a backlog of frames in memory (which results in a crash after some time). Your options are to either disable recording on these devices or reduce recording resolution on them.
     
  49. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    Here's a checklist of sorts:
    1. Read through the README.md. Everything is explained there.
    2. Check out the ReplayCam and GreyWorld example code. They follow directly from the explanations in the README.
    There is no way to specify the recording path. This is done on purpose. If you want to place the recorded file somewhere specific, use the System.IO File.Move function to do so (in the recording callback).
    The README explains this.
    This is because you aren't committing frames to be recorded. Again, look through the README for more info.
     
  50. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,456
    Thanks for taking the time to make this example, but there really is no practical difference between this and ReplayCam (a side by side comparison of the code should reveal this). The thing is that to NatCorder, there isn't any difference between recording gameplay and recording a web camera. All you're really recording is either a game camera or a texture. If I modified the ReplayCam example to use a cube instead of a UI RawImage with a webcam texture, then voila I'd have the example you just created. As a result, including your example becomes redundant.
    This is not exposed for good reason. We've had tons of requests for this in the past, but the problem is that most times developers aren't aware of the implications of certain file paths on certain platforms. For example, a common goal is to place the recorded video in the camera roll. On a platform like iOS, there isn't some folder that media files get put in to appear in the camera roll. This applies on Android and WebGL also. If you want your file to be somewhere after recording, move it there using the System.IO.File.Move function.