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,616
    Yes, NatCorder supports ARCore, ARKit, and Vuforia.
     
  2. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    Make sure you are not recording at a resolution higher than 1920x1080. And yes, you can record every second frame, which will effectively halve the framerate of your video.
     
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    I don't have any familiarity with FMOD. Doesn't Unity itself use FMOD? AudioRecorder works with the audio data that Unity provides in OnAudioFilterRead. If FMOD interferes with this, then AudioRecorder won't work. You would have to find a way to send mixed PCM data from FMOD to NatCorder's CommitSamples function.
     
  4. kunimura

    kunimura

    Joined:
    Jan 22, 2015
    Posts:
    3
    Hello,

    I bought NatCorder a week go, I could test recording Audio/Voice, AR video, 3DCG, … etc. It’s working great. Thank you so much for a great asset.

    1 thing, I have no idea how to record everything on the screen.

    For example,

    In this screenshot, I could only record the 3CDG content. Those buttons (Start, Stop) were not recorded.
    1537351145174.JPEG


    I am using Vuforia Camera.


    Could you advise how I can record everything on the screen? Any sample or reference would be very much appreciated.

    Thanks
     
    Last edited: Sep 19, 2018
  5. unity_r4mSHKj0yZb-4g

    unity_r4mSHKj0yZb-4g

    Joined:
    Sep 11, 2017
    Posts:
    9
    You can't record "Screen Space - Overlay" canvases, you'd need to use a "Screen Space - Camera" canvas if you want to record UI.
    it's in the README notes.
     
    SweatyChair, Lanre and kunimura like this.
  6. kunimura

    kunimura

    Joined:
    Jan 22, 2015
    Posts:
    3
    Thank you so much for the information!
    I will try changing canvas to screen space camera.
     
    Lanre likes this.
  7. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    Thanks @unity_r4mSHKj0yZb-4g. You can't record Overlay canvases.
     
  8. a-dogg

    a-dogg

    Joined:
    Jun 18, 2008
    Posts:
    22
    Hey Lanre!

    We purchased natCorder to allow a user at run time to capture out a timeline sequence to an mp4. Testing seems to work so far, but the output suggests that your frame capture is happening before our post effects stack is being applied. Anything obvious we can do there other than digging into your code? If the latter, where should we be looking?

    View attachment 305887

    You can see here the video doesn't have our color correction applied.
     
  9. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    I can't see the image you attached. NatCorder's CameraRecorder uses the OnRenderImage function. Are you using Unity's Post Processing stack?
     
  10. unity_r4mSHKj0yZb-4g

    unity_r4mSHKj0yZb-4g

    Joined:
    Sep 11, 2017
    Posts:
    9
    Hi, I just wanted to know if you have any update on why it's crashing? it now began happening on the iPhone SE too... you can just tell when it's gonna crash cause it gets super slow, not committing the frames with 0 pointers avoids it crashing but the performance just goes down the gutter and after the first 0 pointer appears a bunch more start appearing too.

    I thing the devices do have in common is that both of them have iOS 11.3.1 (15E302). but I don't have any other device other than the 7+ and SE to test it on.
     
  11. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    What is your recording resolution and framerate? And can you try using OpenGL ES instead of Metal? Does it still crash? If the app is getting slower after the first 0 texture, does the app memory increase drastically? I suspect that this is related to memory.
     
  12. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    829
    s this possible: Video Recording but omit recording the camera button?
     
  13. unity_r4mSHKj0yZb-4g

    unity_r4mSHKj0yZb-4g

    Joined:
    Sep 11, 2017
    Posts:
    9
    So the resolution I'm currently using is the screen resolution or 1080p if the screen res is any higher, after reducing the frames recorded to the Nth one the performance increased significantly however I'm still getting null pointers on this frames (the 0s) and after I get the first a lot more keep coming, to avoid crashing I'm not committing those frames but with the number of zeros I'm getting I can no longer guarantee that the framerate of the video will be 30 when recording every Nthframe = 2. Sadly I'm forced to use Metal.

    Would it be advisable to modify the plugin to make it handle it's own render texture pool in case RenderTexture.GetTemporary fails to provide one?
     
  14. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    You can put the UI you don't want to render in an overlay canvas, since NatCorder can't 'see' overlay canvases.
     
  15. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    I'll try reaching out to Unity on this issue.
    Unity's RenderTexture.GetTemporary already promises this, which is why we use it. We will consider moving to our own pool, but I'm not 100% sure that this will remedy the issue at hand. For some reason, it seems that Unity is failing to allocate color buffers for RenderTextures.
     
    unity_r4mSHKj0yZb-4g likes this.
  16. tcmeric

    tcmeric

    Joined:
    Dec 21, 2016
    Posts:
    181
    You can also put the recording button on another layer. Then set the recording camera to cull that layer. (If you are using more than one camera).
     
    Lanre likes this.
  17. mathias_unity633

    mathias_unity633

    Joined:
    Jul 17, 2018
    Posts:
    35
    I think I found the issue: tl;dr 'Camera.main' doesn't exist. I guess the other guy found the same issue. Leaving my stupidity here in case someone else finds it :)
    Is there any special setup necessary for Android? It doesn't crash, but it doesn't record properly. The videos are zero bytes. It works on iOS. I get this from logcat:

    Code (CSharp):
    1. 09-20 17:55:15.384 16422 16749 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=1036}
    2. 09-20 17:55:15.384 16422 16749 I MediaCodec: name: video/avc
    3. 09-20 17:55:15.388 16422 17867 I OMXClient: Treble IOmx obtained
    4. 09-20 17:55:15.388   972  2080 I OMXMaster: makeComponentInstance(OMX.qcom.video.encoder.avc) in omx@1.0-service process
    5. 09-20 17:55:15.397   972  2080 I OMX-VENC: Video encode perflock acquired,handle=148304
    6. 09-20 17:55:15.398   972  2080 E libc    : Access denied finding property "vendor.vidc.enc.log.in"
    7. 09-20 17:55:15.398   972  2080 E libc    : Access denied finding property "vendor.vidc.enc.log.out"
    8. 09-20 17:55:15.386   972   972 W HwBinder:972_4: type=1400 audit(0.0:190043): avc: denied { open } for path="/dev/__properties__/u:object_r:oem_prop:s0" dev="tmpfs" ino=23602 scontext=u:r:mediacodec:s0 tcontext=u:object_r:oem_prop:s0 tclass=file permissive=0
    9. 09-20 17:55:15.405   972  2080 I OMX-VENC: Component_init : OMX.qcom.video.encoder.avc : return = 0x0
    10. 09-20 17:55:15.408 16422 16749 I MediaCodec: configure format is :{color-format=2130708361, i-frame-interval=3, mime=video/avc, width=540, bitrate=5909759, frame-rate=30, height=1036}
    11. 09-20 17:55:15.409   972  2080 E OMX-VENC: Enable/Disable allocate-native-handle allowed only in secure session
    12. 09-20 17:55:15.409   972  2080 E OMXNodeInstance: setParameter(0xf23bd5c4:qcom.encoder.avc, OMX.google.android.index.allocateNativeHandle(0x7f00005d): Output:1 en=0) ERROR: UnsupportedSetting(0x80001019)
    13. 09-20 17:55:15.409   972  2080 E OMX-VENC: set_parameter: metamode is valid for input port only
    14. 09-20 17:55:15.409   972  2080 W OMXNodeInstance: [0xf23bd5c4:qcom.encoder.avc] component does not support metadata mode; using fallback
    15. 09-20 17:55:15.409 16422 17867 I ExtendedACodec: setupVideoEncoder()
    16. 09-20 17:55:15.409 16422 17867 W OMXUtils: do not know color format 0x7fa30c06 = 2141391878
    17. 09-20 17:55:15.409 16422 17867 W OMXUtils: do not know color format 0x7fa30c04 = 2141391876
    18. 09-20 17:55:15.409 16422 17867 W OMXUtils: do not know color format 0x7fa30c00 = 2141391872
    19. 09-20 17:55:15.410 16422 17867 W OMXUtils: do not know color format 0x7fa30c09 = 2141391881
    20. 09-20 17:55:15.410 16422 17867 W OMXUtils: do not know color format 0x7fa30c0a = 2141391882
    21. 09-20 17:55:15.411 16422 17867 W OMXUtils: do not know color format 0x7fa30c08 = 2141391880
    22. 09-20 17:55:15.411 16422 17867 W OMXUtils: do not know color format 0x7fa30c07 = 2141391879
    23. 09-20 17:55:15.411 16422 17867 W OMXUtils: do not know color format 0x7f000789 = 2130708361
    24. 09-20 17:55:15.412   972  2080 E OMX-VENC: venc_dev: Unsupported eColorFormat 0x7f000789
    25. 09-20 17:55:15.415 16422 17867 I ACodec  : setupAVCEncoderParameters: Open /proc/16422/comm succeed
    26. 09-20 17:55:15.415 16422 17867 I ACodec  : setupAVCEncoderParameters: Get package name: ar.ThreeDBearAR
    27. 09-20 17:55:15.415 16422 17867 I ACodec  : setupAVCEncoderParameters with [profile: Baseline] [level: Level1]
    28. 09-20 17:55:15.415 16422 17867 I ACodec  : setupAVCEncoderParameters: AVC codec setting: 540 x 1036 bitrate: 5909759, P-frame: 89, B-frame: 0, fps: 30.000000
    29. 09-20 17:55:15.415 16422 17867 I ExtendedACodec: setBframe:iFramesInterval 3.000000, frameRate:30
    30. 09-20 17:55:15.416   972  2080 E OMX-VENC: Failed to update the profile_level
    31. 09-20 17:55:15.416 16422 17867 I ACodec  : [OMX.qcom.video.encoder.avc] cannot encode HDR static metadata. Ignoring.
    32. 09-20 17:55:15.416 16422 17867 I ACodec  : setupVideoEncoder succeeded
    I'm on 2018.1.2f1, Android 8.1.0 on a OnePlus 6, compiled with IL2CPP. Just tested, same results compiling with Mono. Additionally, tested on Samsung Galaxy S7 Edge on Android 8.0.0, same results.

    Looks like someone else had the issue?

    Must have either fixed it silently or given up. Also I can share the files it records, but they're literally just empty files. Full log: https://pastebin.com/hQ4tCTb6

    Also here's a snippet of the code, omitted irrelevant stuff:


    Code (CSharp):
    1. public class VideoRecordingManager : MonoBehaviour
    2. {
    3.     void Start()
    4.     {
    5.         _recorder = CameraRecorder.Create(Camera.main);
    6.         _captureButton.OnHoldBeginEvent.AddListener(() =>
    7.         {
    8.             BeginRecording();
    9.         });
    10.         _captureButton.TimeHeld.Subscribe(time =>
    11.         {
    12.             if (time > MaxCaptureDurationSeconds)
    13.             {
    14.                 StopRecording();
    15.             }
    16.             var progress = time / MaxCaptureDurationSeconds;
    17.             _captureProgressImage.fillAmount = progress;
    18.             _captureProgressHorizontalImage.anchorMax = new Vector2(progress, 1);
    19.         });
    20.         _captureButton.OnPointerUpEvent.AddListener(() =>
    21.         {
    22.             StopRecording();
    23.         });
    24.     }
    25.  
    26.     private void BeginRecording()
    27.     {
    28.         ...
    29.         _isRecording = true;
    30.         NatCorder.StartRecording(Container.MP4, new VideoFormat(Screen.width / 2, Screen.height / 2, 30, VideoFormat.Screen.bitrate, 150), AudioFormat.None, OnVideoFinish);
    31.         ...
    32.     }
    33.  
    34.     private void StopRecording()
    35.     {
    36.         ...
    37.         if (_isRecording)
    38.         {
    39.             NatCorder.StopRecording();
    40.             ...
    41.             _isRecording = false;
    42.         }
    43.     }
    44. }
     
    Last edited: Sep 24, 2018
  18. SweatyChair

    SweatyChair

    Joined:
    Feb 15, 2016
    Posts:
    118
    The plugin is great and working in macOS, but it crashed in Editor in Windows 7...

    I think you've replied in one of the reply saying it needs Win8+, but I just wanna make sure...

    That's nothing we can do? This may be serious since there still 38% people with Win7....


    Windows 7 SP1
    Unity 2018.2.9f1
     
  19. mathias_unity633

    mathias_unity633

    Joined:
    Jul 17, 2018
    Posts:
    35
    You could always just use platform dependent compilation statements to avoid running NatCorder in the Editor, if you are comfortable enough with it working on whichever device you're targeting.
     
    Lanre likes this.
  20. infinity135

    infinity135

    Joined:
    Feb 5, 2018
    Posts:
    17
    Hi, I am using 2 different cameras. One for showing canvas and one for models. So how can I record both of them
     
  21. asae-

    asae-

    Joined:
    Aug 30, 2017
    Posts:
    1
    Hello,
    Is it possible to record a video for a specific/limited duration? (e.g: short clips with 10 secs) How?
    For recording, is it also possible to have the record video functionality has a single push/hold button? (While user push and hold it records, on release video will be exported)

    Cheers,
     
  22. unity_r4mSHKj0yZb-4g

    unity_r4mSHKj0yZb-4g

    Joined:
    Sep 11, 2017
    Posts:
    9
    This doesn't have anything to do with the plugin itself but with how and when you call the plugin instead, for the first one you can always keep track of how much time you've been recording and then just call NatCorder.StopRecording() or you could even use a Coroutine to stop it like this:
    Code (CSharp):
    1.  
    2. public void StartRecording () {
    3.         if (NatCorder.IsRecording) {
    4.             return;
    5.         }
    6.  
    7.         float recordingTime = 10.0f;
    8.         VideoFormat videoFormat = new VideoFormat (screenWidth, screenHeight);
    9.         NatCorder.StartRecording (Container.MP4, videoFormat, AudioFormat.None, OnVideo);
    10.         StartCoroutine (ExecuteActionAfterTime (StopRecording, recordingTime));
    11. }
    12.  
    13. private IEnumerator ExecuteActionAfterTime (System.Action action, float delay) {
    14.         yield return new WaitForSeconds (delay);
    15.         action ();
    16.        
    17. }
    18.  
    19. public void StopRecording () {
    20.         if (!NatCorder.IsRecording) {
    21.             return;
    22.         }
    23.         NatCorder.StopRecording ();
    24. }
    25.  
    As for the second one you can simply use this: https://docs.unity3d.com/ScriptReference/EventSystems.IPointerDownHandler.html to detect when the user starts and ends the click, basically if OnPointerDown was called the user started holding the button until OnPointerUp is called.
     
    Lanre likes this.
  23. SweatyChair

    SweatyChair

    Joined:
    Feb 15, 2016
    Posts:
    118
    Alright, I found that it crashed if I use .NET 4.x Equivalent, in a fresh project with the plugin only. Both Editor or standalone build.

    It crashed on record complete, the video file is already saved and found in explorer.

    Is the language used in the plugin not complimenting.NET 4.x?



    Log:
    Code (CSharp):
    1. Crash!!!
    2. SymInit: Symbol-SearchPath: '.;C:\Users\User_2\Documents\Testing Project\Builds;C:\Users\User_2\Documents\Testing Project\Builds;C:\Windows;C:\Windows\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 534, UserName: 'User_2'
    3. OS-Version: 6.1.0
    4. C:\Users\User_2\Documents\Testing Project\Builds\Testing Project.exe:Testing Project.exe (000000013FEB0000), size: 671744 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2018.2.9.1858
    5. C:\Windows\SYSTEM32\ntdll.dll:ntdll.dll (00000000776D0000), size: 1740800 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.18229
    6. C:\Program Files\AVAST Software\Avast\x64\aswhooka.dll:aswhooka.dll (000007FEF4B00000), size: 212992 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 18.6.4.442
    7. C:\Windows\system32\kernel32.dll:kernel32.dll (00000000775B0000), size: 1175552 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.18229
    8. C:\Windows\system32\KERNELBASE.dll:KERNELBASE.dll (000007FEFD450000), size: 438272 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.18229
    9. C:\Users\User_2\Documents\Testing Project\Builds\UnityPlayer.dll:UnityPlayer.dll (000007FEC2150000), size: 23756800 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2018.2.9.1858
    10. C:\Windows\system32\HID.DLL:HID.DLL (000007FEFBE80000), size: 45056 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    11. C:\Windows\system32\msvcrt.dll:msvcrt.dll (000007FEFF2B0000), size: 651264 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 7.0.7601.17744
    12. C:\Windows\system32\WindowsCodecs.dll:WindowsCodecs.dll (000007FEFB0E0000), size: 1445888 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16492
    13. C:\Windows\system32\ole32.dll:ole32.dll (000007FEFDB40000), size: 2109440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    14. C:\Windows\system32\GDI32.dll:GDI32.dll (000007FEFF450000), size: 421888 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    15. C:\Windows\system32\USER32.dll:USER32.dll (00000000774B0000), size: 1024000 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    16. C:\Windows\system32\LPK.dll:LPK.dll (000007FEFEDB0000), size: 57344 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    17. C:\Windows\system32\USP10.dll:USP10.dll (000007FEFF4C0000), size: 823296 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 1.626.7601.18009
    18. C:\Windows\system32\RPCRT4.dll:RPCRT4.dll (000007FEFF8B0000), size: 1232896 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.18205
    19. C:\Windows\system32\ADVAPI32.dll:ADVAPI32.dll (000007FEFF350000), size: 897024 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    20. C:\Windows\SYSTEM32\sechost.dll:sechost.dll (000007FEFF430000), size: 126976 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    21. C:\Windows\system32\CRYPT32.dll:CRYPT32.dll (000007FEFD4E0000), size: 1490944 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.18205
    22. C:\Windows\system32\MSASN1.dll:MSASN1.dll (000007FEFD3B0000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    23. C:\Windows\system32\VERSION.dll:VERSION.dll (000007FEFC7F0000), size: 49152 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    24. C:\Windows\system32\SHLWAPI.dll:SHLWAPI.dll (000007FEFEF40000), size: 462848 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    25. C:\Windows\system32\SETUPAPI.dll:SETUPAPI.dll (000007FEFF6D0000), size: 1929216 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    26. C:\Windows\system32\CFGMGR32.dll:CFGMGR32.dll (000007FEFD660000), size: 221184 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    27. C:\Windows\system32\OLEAUT32.dll:OLEAUT32.dll (000007FEFEFC0000), size: 880640 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17676
    28. C:\Windows\system32\DEVOBJ.dll:DEVOBJ.dll (000007FEFD4C0000), size: 106496 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    29. C:\Windows\system32\SHELL32.dll:SHELL32.dll (000007FEFE020000), size: 14188544 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.18222
    30. C:\Windows\system32\OPENGL32.dll:OPENGL32.dll (000007FEDFBD0000), size: 1167360 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    31. C:\Windows\system32\GLU32.dll:GLU32.dll (000007FEEE720000), size: 184320 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    32. C:\Windows\system32\DDRAW.dll:DDRAW.dll (000007FEDF820000), size: 987136 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    33. C:\Windows\system32\DCIMAN32.dll:DCIMAN32.dll (000007FEF41F0000), size: 32768 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    34. C:\Windows\system32\dwmapi.dll:dwmapi.dll (000007FEFBE60000), size: 98304 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    35. C:\Windows\system32\WINMM.dll:WINMM.dll (000007FEFAE90000), size: 241664 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    36. C:\Windows\system32\WS2_32.dll:WS2_32.dll (000007FEFF0B0000), size: 315392 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    37. C:\Windows\system32\NSI.dll:NSI.dll (000007FEFF0A0000), size: 32768 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    38. C:\Windows\system32\IMM32.dll:IMM32.dll (000007FEFF590000), size: 188416 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    39. C:\Windows\system32\MSCTF.dll:MSCTF.dll (000007FEFF5C0000), size: 1085440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    40. C:\Windows\system32\WINHTTP.dll:WINHTTP.dll (000007FEF7170000), size: 462848 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    41. C:\Windows\system32\webio.dll:webio.dll (000007FEF7100000), size: 409600 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17725
    42. C:\Windows\system32\api-ms-win-core-synch-l1-2-0.DLL:api-ms-win-core-synch-l1-2-0.DLL (000007FEFC610000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    43. C:\Windows\system32\apphelp.dll:apphelp.dll (000007FEFD1F0000), size: 356352 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    44. C:\Windows\system32\profapi.dll:profapi.dll (000007FEFD3C0000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    45. C:\Users\User_2\Documents\Testing Project\Builds\MonoBleedingEdge\EmbedRuntime\mono-2.0-bdwgc.dll:mono-2.0-bdwgc.dll (000007FECB460000), size: 5996544 (result: 0), SymType: '-deferred-', PDB: ''
    46. C:\Windows\system32\MSWSOCK.dll:MSWSOCK.dll (000007FEFCB50000), size: 348160 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    47. C:\Windows\system32\PSAPI.DLL:PSAPI.DLL (00000000778A0000), size: 28672 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    48. C:\Windows\system32\CRYPTBASE.dll:CRYPTBASE.dll (000007FEFD250000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    49. C:\Windows\System32\wship6.dll:wship6.dll (000007FEFCB40000), size: 28672 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    50. C:\Windows\system32\uxtheme.dll:uxtheme.dll (000007FEFC140000), size: 352256 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    51. C:\Windows\system32\d3d11.dll:d3d11.dll (000007FEF3710000), size: 1921024 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16570
    52. C:\Windows\system32\dxgi.dll:dxgi.dll (000007FEF3900000), size: 380928 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.2.9200.16492
    53. C:\Windows\system32\DXGIDebug.dll:DXGIDebug.dll (000007FEF33B0000), size: 155648 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 9.30.9600.17336
    54. C:\Windows\system32\WINTRUST.dll:WINTRUST.dll (000007FEFD3E0000), size: 237568 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.18205
    55. C:\Windows\system32\nvwgf2umx.dll:nvwgf2umx.dll (000007FEEFF80000), size: 23429120 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 24.21.13.9836
    56. C:\Windows\system32\bcrypt.dll:bcrypt.dll (000007FEFCCE0000), size: 139264 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    57. C:\Windows\system32\imagehlp.dll:imagehlp.dll (000007FEFF290000), size: 102400 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17787
    58. C:\Windows\system32\CRYPTSP.dll:CRYPTSP.dll (000007FEFCDA0000), size: 94208 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    59. C:\Windows\system32\rsaenh.dll:rsaenh.dll (000007FEFC890000), size: 290816 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    60. C:\Windows\system32\ncrypt.dll:ncrypt.dll (000007FEFCD10000), size: 315392 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.18007
    61. C:\Windows\system32\bcryptprimitives.dll:bcryptprimitives.dll (000007FEFC7A0000), size: 311296 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    62. C:\Windows\system32\CLBCatQ.DLL:CLBCatQ.DLL (000007FEFEEA0000), size: 626688 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 2001.12.8530.16385
    63. C:\Windows\system32\wbem\wbemprox.dll:wbemprox.dll (000007FEF5FC0000), size: 61440 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    64. C:\Windows\system32\wbemcomn.dll:wbemcomn.dll (000007FEF64B0000), size: 548864 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    65. C:\Windows\system32\RpcRtRemote.dll:RpcRtRemote.dll (000007FEFD300000), size: 81920 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    66. C:\Windows\system32\wbem\wbemsvc.dll:wbemsvc.dll (000007FEF5FA0000), size: 81920 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    67. C:\Windows\system32\wbem\fastprox.dll:fastprox.dll (000007FEF61A0000), size: 925696 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    68. C:\Windows\system32\NTDSAPI.dll:NTDSAPI.dll (000007FEF6040000), size: 159744 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    69. C:\Windows\System32\MMDevApi.dll:MMDevApi.dll (000007FEFB630000), size: 307200 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    70. C:\Windows\System32\PROPSYS.dll:PROPSYS.dll (000007FEFB3D0000), size: 1228800 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 7.0.7601.17514
    71. C:\Windows\system32\AUDIOSES.DLL:AUDIOSES.DLL (000007FEFAC00000), size: 323584 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    72. C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_fa396087175ac9ac\comctl32.dll:comctl32.dll (000007FEFB760000), size: 2048000 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.10.7601.17514
    73. C:\Windows\system32\xinput9_1_0.dll:xinput9_1_0.dll (000007FEEE710000), size: 49152 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    74. C:\Windows\system32\IPHLPAPI.DLL:IPHLPAPI.DLL (000007FEF9610000), size: 159744 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    75. C:\Windows\system32\WINNSI.DLL:WINNSI.DLL (000007FEF9600000), size: 45056 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    76. C:\Windows\system32\dhcpcsvc.DLL:dhcpcsvc.DLL (000007FEF8AF0000), size: 98304 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    77. C:\Windows\system32\dhcpcsvc6.DLL:dhcpcsvc6.DLL (000007FEF8AD0000), size: 69632 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17970
    78. C:\Windows\system32\SspiCli.dll:SspiCli.dll (000007FEFD180000), size: 151552 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17725
    79. C:\Windows\system32\credssp.dll:credssp.dll (000007FEFC800000), size: 40960 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    80. C:\Windows\System32\wshtcpip.dll:wshtcpip.dll (000007FEFC260000), size: 28672 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    81. C:\Windows\system32\DNSAPI.dll:DNSAPI.dll (000007FEFC980000), size: 372736 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17570
    82. C:\Windows\system32\rasadhlp.dll:rasadhlp.dll (000007FEF5790000), size: 32768 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    83. C:\Windows\System32\fwpuclnt.dll:fwpuclnt.dll (000007FEF8B20000), size: 339968 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    84. C:\Users\User_2\Documents\Testing Project\Builds\Testing Project_Data\Plugins\NatCorder.dll:NatCorder.dll (000007FEE0D40000), size: 40960 (result: 0), SymType: '-deferred-', PDB: ''
    85. C:\Windows\system32\MFPlat.DLL:MFPlat.DLL (000007FEE1460000), size: 442368 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 12.0.7600.16385
    86. C:\Windows\system32\AVRT.dll:AVRT.dll (000007FEFB370000), size: 36864 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    87. C:\Windows\system32\MSVCP140.dll:MSVCP140.dll (000007FEDFCF0000), size: 634880 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 14.15.26706.0
    88. C:\Windows\system32\VCRUNTIME140.dll:VCRUNTIME140.dll (000007FEF42E0000), size: 90112 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 14.15.26706.0
    89. C:\Windows\system32\api-ms-win-crt-runtime-l1-1-0.dll:api-ms-win-crt-runtime-l1-1-0.dll (000007FEFB3C0000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    90. C:\Windows\system32\ucrtbase.DLL:ucrtbase.DLL (000007FEE0950000), size: 991232 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    91. C:\Windows\system32\api-ms-win-core-timezone-l1-1-0.dll:api-ms-win-core-timezone-l1-1-0.dll (000007FEFA8E0000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    92. C:\Windows\system32\api-ms-win-core-file-l2-1-0.dll:api-ms-win-core-file-l2-1-0.dll (000007FEF4350000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    93. C:\Windows\system32\api-ms-win-core-localization-l1-2-0.dll:api-ms-win-core-localization-l1-2-0.dll (000007FEF42D0000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    94. C:\Windows\system32\api-ms-win-core-processthreads-l1-1-1.dll:api-ms-win-core-processthreads-l1-1-1.dll (000007FEF42B0000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    95. C:\Windows\system32\api-ms-win-core-file-l1-2-0.dll:api-ms-win-core-file-l1-2-0.dll (000007FEF42A0000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    96. C:\Windows\system32\api-ms-win-crt-string-l1-1-0.dll:api-ms-win-crt-string-l1-1-0.dll (000007FEF4290000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    97. C:\Windows\system32\api-ms-win-crt-heap-l1-1-0.dll:api-ms-win-crt-heap-l1-1-0.dll (000007FEF4280000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    98. C:\Windows\system32\api-ms-win-crt-stdio-l1-1-0.dll:api-ms-win-crt-stdio-l1-1-0.dll (000007FEF4270000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    99. C:\Windows\system32\api-ms-win-crt-convert-l1-1-0.dll:api-ms-win-crt-convert-l1-1-0.dll (000007FEF4260000), size: 16384 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    100. C:\Windows\system32\api-ms-win-crt-locale-l1-1-0.dll:api-ms-win-crt-locale-l1-1-0.dll (000007FEF4200000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    101. C:\Windows\system32\api-ms-win-crt-math-l1-1-0.dll:api-ms-win-crt-math-l1-1-0.dll (000007FEF4230000), size: 20480 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    102. C:\Windows\system32\api-ms-win-crt-time-l1-1-0.dll:api-ms-win-crt-time-l1-1-0.dll (000007FEF4240000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    103. C:\Windows\system32\api-ms-win-crt-filesystem-l1-1-0.dll:api-ms-win-crt-filesystem-l1-1-0.dll (000007FEF4220000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    104. C:\Windows\system32\api-ms-win-crt-environment-l1-1-0.dll:api-ms-win-crt-environment-l1-1-0.dll (000007FEF4250000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    105. C:\Windows\system32\api-ms-win-crt-utility-l1-1-0.dll:api-ms-win-crt-utility-l1-1-0.dll (000007FEF4210000), size: 12288 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 10.0.10240.16390
    106. C:\Windows\system32\MFReadWrite.dll:MFReadWrite.dll (000007FEDE560000), size: 270336 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 12.0.7601.17514
    107. C:\Windows\System32\mfh264enc.dll:mfh264enc.dll (000007FEDE500000), size: 344064 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    108. C:\Windows\System32\colorcnv.dll:colorcnv.dll (000007FEDE4C0000), size: 221184 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    109. C:\Windows\System32\msdmo.dll:msdmo.dll (000007FEEE670000), size: 53248 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.6.7601.17514
    110. C:\Windows\system32\MF.dll:MF.dll (000007FEDC3E0000), size: 4132864 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 12.0.7601.17514
    111. C:\Windows\system32\ATL.DLL:ATL.DLL (000007FEFAED0000), size: 102400 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 3.5.2284.0
    112. C:\Windows\system32\ksuser.dll:ksuser.dll (0000000074FB0000), size: 24576 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7600.16385
    113. C:\Windows\system32\dbghelp.dll:dbghelp.dll (000007FEF2890000), size: 1200128 (result: 0), SymType: '-deferred-', PDB: '', fileVersion: 6.1.7601.17514
    114.  
    115. ========== OUTPUTTING STACK TRACE ==================
    116.  
    117. 0x000007FEDE568FB6 (MFReadWrite) DllGetClassObject
    118. 0x000007FEDE5811CA (MFReadWrite) DllGetClassObject
    119. 0x000007FEE148736A (MFPlat) MFTRegisterLocalByCLSID
    120. 0x000007FEE148740C (MFPlat) MFTRegisterLocalByCLSID
    121. 0x000007FEE146EE37 (MFPlat) LFGetGlobalPool
    122. 0x000007FEE1491A3D (MFPlat) MFllMulDiv
    123. 0x000007FEFF2B415F (msvcrt) srand
    124. 0x000007FEFF2B6EBD (msvcrt) ftime64_s
    125. 0x00000000775C652D (kernel32) BaseThreadInitThunk
    126. 0x00000000776FC541 (ntdll) RtlUserThreadStart
    127.  
    128. ========== END OF STACKTRACE ===========
    129.  
    130. A crash has been intercepted by the crash handler. For call stack and other details, see the latest crash report generated in:
    131. * C:/Users/User_2/AppData/Local/Temp/Sweaty Chair Studio/Testing Project/Crashes
    132.  
    It appears to me that seems to be memory issue, because it involves my other programs running in Windows too. I've also tried turn off antivirus.

    P.S. In mac it's fine but not Windows. I have to use .NET 4.x because some plugins required that in my project...
     
    Last edited: Sep 25, 2018
    Lanre likes this.
  24. tcmeric

    tcmeric

    Joined:
    Dec 21, 2016
    Posts:
    181
    I am using Win 7, 64 bit. Unity LTS 2017.4. No crashing in the editor for me.
     
  25. Akame

    Akame

    Joined:
    Jun 11, 2013
    Posts:
    7
    Lanre, following up on this issue, what is actually happening is NatCorder seems to apply a green tint to our recorded video. Here is a picture of the base game view:

    Game View Link


    And here is a quick recording made with NatCorder:

    Video Link

    I've tried recording both with and without the Unity post processing stack, but the result is the same green tint.
     
  26. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    You should only create the CameraRecorder after calling StartRecording, and Dispose it right before calling StopRecording. Recorders are lightweight objects whose lifetimes should never span beyond the duration of a given recording.
     
  27. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    NatCorder doesn't support Win 7. We are convinced that it is because of some implementation change made between Win 7 and Win 8; we just can't find what it is in Microsoft's docs. The crash seems to only occur once StopRecording is called, as you have observed.
     
  28. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    NatCorder doesn't provide a Recorder for multiple cameras out of the box. This is because use cases for multiple cameras typically vary a lot. You'd have to implement a Recorder tailored to your specific use case. Here's some starter code.
     
  29. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    To my knowledge, the crash happens in the destructor of the MediaFoundation IMFSinkWriter. I highly doubt that it has anything to do with using .NET 4.x. Win7 is really finicky.
     
  30. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    It works for you on Windows 7?? What is your Windows build number? That's very very surprising.
     
  31. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    Hm this is weird. Can you send me a repro? Also, are you using Linear or Gamma rendering? NatCorder currently only supports Gamma.
     
  32. a-dogg

    a-dogg

    Joined:
    Jun 18, 2008
    Posts:
    22
    We switched to gamma to resolve the green. You should probably mention you don't support Linear on your store page... our issue now is that we're trying to create on the fly video exports as a supplemental media element following up the linear color space VR experience with a user, and the color and lighting will be quite different.
     
    Lanre likes this.
  33. SweatyChair

    SweatyChair

    Joined:
    Feb 15, 2016
    Posts:
    118
    Okie, I have 2 PC, both Win 7, one semi-working and one doesn't.

    Both are tested using fresh project, import the plugin, play the ReplayCam scene in Editor or Build:

    PC1:
    Win7 Pro SP1
    i5-7500 3.4Ghz
    8GB RAM
    GeForce GTX 1050

    .NET 3.5:
    Editor:
    No crash, but always only 1kb video file created and cannot be played
    Build:
    Crash on Start Record

    .NET 4.x:
    Editor:
    Crash on Stop Record
    Build:
    Crash on Start Record

    -----------------------------------------------------------------------------------------------

    PC2:
    Win7 Pro SP1
    i7 4790 3.6Ghz
    8GB RAM
    Intel HD Graphics 4600

    .NET 3.5:
    Editor:
    Working :)
    Build:
    Working :)

    .NET 4.x:
    Editor:
    Crash on Stop Record
    Build:
    Crash on Start Record
     
    Last edited: Oct 5, 2018
  34. Privateer

    Privateer

    Joined:
    Jun 5, 2016
    Posts:
    16
    Is there a way to do some transformations on the video as or after it is being saved? Like, if I want to rotate it?
     
  35. Maarten_AryzonTeam

    Maarten_AryzonTeam

    Joined:
    Sep 29, 2016
    Posts:
    12
    Hi, I have an iOS question. Sometimes after pressing record the app crashes after two seconds due to memory issues. This happens with heavier 3D models while viewing them in AR with ARKit. Once I press the record button the frame rate drops and after a couple of seconds it crashes. The app has a target framerate of 60. I don't have influence on the size of model the user is viewing. I know this is pushing the limits of the phone but I want to prevent a crash. Any pointers as to how?

    This is what I do:

    Code (CSharp):
    1.  
    2. int height = 1920;
    3. int width = (int)((float)height * Screen.width / (float)Screen.height);
    4. var framerate = 60;
    5. VideoFormat videoFormat = new VideoFormat((int)width, height, framerate);
    6.  
    7. NatCorder.StartRecording(Container.MP4, videoFormat, AudioFormat.None, HandleFinishRecordingCallback);
    8. if (arkitCamera.gameObject.activeInHierarchy) {
    9.     arkitRecorder = CameraRecorder.Create(arkitCamera);
    10.     filmingArkit = true;
    11. }
    12.  
     
  36. abhayaagrawal

    abhayaagrawal

    Joined:
    Sep 30, 2016
    Posts:
    7
    I am getting following error while tap and hold record button in iOS. It is effecting app performance. please suggest what can be done.

    **AudioSampleProvider buffer overflow. 4096 sample frames discarded.
    (Filename: /Users/builduser/buildslave/unity/build/Modules/Audio/Public/AudioSampleProvider.cpp Line: 224)

    2018-09-28 17:08:05.276701+0530 arlivelylabels[2649:881224] [avas] AVAudioSession.mm:1142:-[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session.**



    This is our purchase detail:
    Order number: 13469080441800
    Invoice No. IN010200329289
     
  37. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    Thanks for posting this. Recording on Win7 is too unstable.
     
  38. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    You can use shaders to transform the video while it is being recorded. Look at the GreyWorld example for using a custom shader for recording. You can also use a custom shader+material with a CameraRecorder for the same effect (CameraRecorder.recordingMaterial).
     
  39. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    I have a few things to touch on:
    - Is your app portrait or landscape? Because if it is landscape, then your resolution calculation will result in a video height of 1920 and a video height larger than 1920. This becomes problematic because the H.264 codec struggles with anything beyond 1920x1080.
    - You are conditionally creating a CameraRecorder. This is dangerous because if you start recording without actually recording a single frame, it results in undefined behaviour (previous versions of NatCorder will simply crash once you called StopRecording).
    - To prevent memory crashes, consider reducing your recording resolution and framerate. I'd recommend reducing the framerate first if 60FPS isn't a solid requirement. You can record at 30FPS by setting this in the VideoFormat and then setting the CameraRecorder to skip every frame (CameraRecorder.recordEveryNthFrame = 2).
     
  40. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    There are two things to look out for here. First off, what is your application's framerate. The framerate that gets passed in to VideoFormat is not the actual framerate of the video, it is just a hint for what the encoder should expect. What determines the actual video framerate is the spacing between the timestamps for committed frames (in other words, how often your recording camera is rendering). So if your app is rendering at 60FPS, your effective video framerate will be about 60FPS (which overwhelms a lot of devices, especially on non-standard resolutions). If your app is rendering at 60FPS, then set `CameraRecorder.recordEveryNthFrame` to 2, so that the CameraRecorder will only record every other frame (hence creating a 30FPS recording).

    The second thing is on recording at non-standard resolutions. Your recording resolution is 720x1558. Resolutions like this require the encoder to add padding to every pixel row as these processors require a certain byte alignment. I recommend recording at either 1280x720 (or 720x1280, order doesn't matter) or 1920x1080 for high resolution recording.
     
  41. sgt3v

    sgt3v

    Joined:
    Feb 19, 2017
    Posts:
    17
    Hi Lanre,

    Is it somehow possible to take a snapshot of the hq camera feed using NatCorder, intead of using Unity's screenshot capture?
     
  42. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    NatCorder doesn't do screenshots; use Unity's ScreenCapture functions.
     
  43. shin_unity197

    shin_unity197

    Joined:
    Oct 30, 2017
    Posts:
    18
    Hi,
    On the Android... Whenever I record a video, stop it, and then start a new video (the number of times I repeat this is inconsistent, but eventually happens) my app crashes. Do I need to do additional checks before I can record? At the moment I'm checking if the Natcorder.IsRecording == true.

    Code (CSharp):
    1. Caused by java.lang.IllegalStateException: Failed to stop the muxer
    2.        at android.media.MediaMuxer.nativeStop(MediaMuxer.java)
    3.        at android.media.MediaMuxer.stop(MediaMuxer.java:447)
    4.        at com.yusufolokoba.natcorder.mp4.MP4Recorder.encoderFinished(MP4Recorder.java:103)
    5.        at com.yusufolokoba.natcorder.mp4.Encoder.run(Encoder.java:127)
    6.        at java.lang.Thread.run(Thread.java:764)
     
  44. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,616
    Can you attach the full logs from logcat in a .txt? That will contain the actual reason for the crash.
     
  45. ThomQ

    ThomQ

    Joined:
    Nov 23, 2010
    Posts:
    303
    We're been using another screen recording plugin for our mobile AR project, with mixed results. NATcorder looks promising, but is there a demo .apk available so we could test the performance?
     
  46. shin_unity197

    shin_unity197

    Joined:
    Oct 30, 2017
    Posts:
    18
    @Lanre
    I've attached my logcat file
     

    Attached Files:

  47. TomLightweave

    TomLightweave

    Joined:
    Mar 2, 2017
    Posts:
    2
    Like a couple others here, I'm experiencing output files of 0B on Android. Functionality is perfect in editor. The suggestion I saw in this thread was to ensure the CameraRecorder was setup after StartRecording was called, and disposed before StopRecording was called. This doesn't appear to have helped in my case.
    Code (CSharp):
    1. CameraRecorder recorder;
    2.  
    3.     public bool IsRecording()
    4.     {
    5.         return NatCorder.IsRecording;
    6.     }
    7.  
    8.     public void StopRecording()
    9.     {
    10.         recorder.Dispose();
    11.         NatCorder.StopRecording();
    12.     }
    13.  
    14.     public void StartRecording()
    15.     {
    16.         NatCorder.StartRecording(Container.MP4, new VideoFormat(Screen.width/2, Screen.height/2, 24, (int)(960 * 540 * 11.4f),3), AudioFormat.Unity, OnRecording);
    17.         recorder = CameraRecorder.Create(TrackingManager.Instance.GetCurrentARCamera());
    18.     }
    19.  
    20.     private void OnRecording(string path)
    21.     {
    22.         Debug.Log("<color=yellow>Recorded video at: " + path + "</color>");
    23.     }
    Issue is replicated on both an LG G6 and a Google Pixel. Recording as a gif works fine on device, just mp4 failing leading me to believe it is a codec/encoder issue. As expected, the logcat seems to be returning encoder errors, however it seems to be trying to use H.264 encoding which from what I understand is quite the standard and should definitely be supported on devices such as these. This logcat below is the snippet that begins from StartRecording.

    Edit: I seem have to have since resolved this. It seems that if I declare the Unity audio format but then don't actually record audio to pass it, it doesn't work. I suppose that should have been an excpected result. I resolved it by looking for an AudioListener in the scene (because in my app there may or may not be one instantiated it the time). If one exists, I create an AudioRecorder with it and set the audio format to Unity, otherwise I'll leave it as AudioFormat.None.
     

    Attached Files:

    Last edited: Oct 5, 2018
    Lanre likes this.
  48. Privateer

    Privateer

    Joined:
    Jun 5, 2016
    Posts:
    16
    I'm not sure what there is relevant to my question. Can you be more specific?
     
  49. Maarten_AryzonTeam

    Maarten_AryzonTeam

    Joined:
    Sep 29, 2016
    Posts:
    12
    Thanks for the reply, I can see there will be issues when the app is landscape or the conditionally creating a CameraRecorder I'll take that into consideration. I didn't know H.264 codec struggles with anything larger than 1920x1080, however I'm staying within that.

    I'm listening for low memory warnings and stop recording when this occurs. With my experience in Unity these don't always get called so I also added a settings menu where the user can change their recording settings so if the app does crash they can change the recording settings. Since it works most of the times I'm leaving it like this unless we see too many crashes.
     
    Lanre likes this.
  50. abhayaagrawal

    abhayaagrawal

    Joined:
    Sep 30, 2016
    Posts:
    7
    I have followed these many approaches to fix video recording:

    - I disabled audio recording then everything was working fine.

    - I enabled only game audio and disables microphone that time I got same buffer overloading issue.

    - Changed microphone recording frequency to 48000 to 24000 still I’m getting the same issue.(Buffer overloading and frame skipping).

    - I have notice that, device is taking more CPU usage and camera is struck for few milliseconds when tap and hold record button.

    - I have changed the recording frame rate and video resolution as mentioned in the forum. But, we are getting the same issue.


    Video and audio are pause while taking screen record. The conclusion is we are getting problem with audio recording.

    Also app is crashing o iPhone6 but not in other iPhone

    Check Video here.

    I am getting error . Please find Screenshot.


    Please suggest what to do.
     

    Attached Files:

    Last edited: Oct 5, 2018