Search Unity

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,682
    A lot of this really depends on how GPU-heavy the app is. Recording adds GPU time, and since NatCorder is designed not to hold up the Unity rendering thread, pending frames quickly pile up (which is what leads to running out of memory). We are still looking for ways to improve this without blocking the Unity rendering thread (so as to keep your app's framerate fluid smooth). We have a pending update that should further improve this.
     
    dustin_red likes this.
  2. Pelican_7

    Pelican_7

    Joined:
    Nov 25, 2014
    Posts:
    184
    Does anyone know how to capture the entire screen's contents (i.e. multiple cameras) with NatCorder?

    For example, my game has a world camera plus a camera per UI Canvas. I'd like to just capture the entire screen – the game with all UI – similar to how Everyplay captures worked.

    Thanks!
    andy.
     
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    Hi Andy. If you have a number of different cameras, then you will have to manually render every one of them to the encoder frames, using the NatCorder API as opposed to the Replay API:
    Code (CSharp):
    1. void Update () {
    2.     if (NatCorder.IsRecording) {
    3.         var frame = NatCorder.AcquireFrame();
    4.         foreach (var camera in cameras) {
    5.             camera.targetTexture = frame;
    6.             camera.Render();
    7.         }
    8.         NatCorder.CommitFrame(frame);
    9.     }
    10. }
     
    polytropoi likes this.
  4. Pelican_7

    Pelican_7

    Joined:
    Nov 25, 2014
    Posts:
    184
    Sweet, thanks Lanre.
     
    Lanre likes this.
  5. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    27
    Hey Lanre.

    Quick question. Do you know if there is a way to erase the first frame of the captured video. The first frame is always coming out black. This is an issue because when sharing the video the thumbnail comes out black as well.

    Any ideas for a quick fix.

    Thanks!
     
  6. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    What device and OS version did you record on? I am not familiar with this issue. A quick fix would be requesting the thumbnail at one or two frames in (I presume you are using NatShare).
     
  7. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    27
    Running on an iPhoneX and iOS 11.3. The first frame is black then the rest of the video works fine. I've attached a screenshot as reference.

    Yes, I'm using NatShare which is great by the way.

    Would GetThumbnail update the actual thumbnail of the video or does it just return the Texture2D?

    Thanks again for the help.
     

    Attached Files:

  8. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    Okay I see; I'll look into this. GetThumbnail only returns a Texture2D; it doesn't set the actual thumbnail of the video (there isn't any way to do this to the best of my knowledge).
     
  9. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    27
    I might just remove the first few frames with the NatCorder instead of Replay. That should do the trick to skip the first few black frames.
     
  10. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    I am not sure that this will make a difference as nothing in the Replay API could cause black frames. Let me know how it goes.
     
  11. alan_motionlab

    alan_motionlab

    Joined:
    Nov 27, 2014
    Posts:
    90
    Hi - I've been testing on device now, and I've come across an issue that I'm not sure how to fix exactly.

    So our game is in Portrait through out, but when I do a replay, I change to Landscape as it looks much more cinematic.

    I was initially just using the built in config, but I then decided I wanted the max res to be 1920x1080, so used code like this to ensure the config is set to the right size without stretching and to maintain its aspect ratio, I work out an amount to scale the size by.

    Code (csharp):
    1.  
    2.                     int width = Screen.width;
    3.                     int height = Screen.height;
    4.  
    5.                     if (width > height)
    6.                     {
    7.                         if (width > 1920)
    8.                         {
    9.                             float scale = 1920f/width;
    10.                             height = Mathf.RoundToInt(height*scale);
    11.                             width = 1920;
    12.                         }
    13.                     }
    14.                     else
    15.                     {
    16.                         if (height > 1920)
    17.                         {
    18.                             float scale = 1920f/height;
    19.                             width = Mathf.RoundToInt(width*scale);
    20.                             height = 1920;
    21.                         }
    22.                     }
    23.  
    24.                     Configuration config = new Configuration(width, height);
    25.                     Replay.StartRecording(Camera.main, config, OnReplay, Camera.main.GetComponent<AudioListener>());
    26.  
    1 frame before this, I set the Screen.orientation to be LandscapeLeft, as I was getting a graphical glitch at the start of the video.

    But, when I get to the end and use the ShareAPI to save it to my camera roll, the video is the right aspect ratio, but hasn't been rotated.

    Am I doing something wrong with the setting of the config? Is there an easier way of limiting the size to be screen height and width up to a size?

    Thanks
     
  12. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    27
    Hey Lanre.

    Still no luck with this black thumbnail issue on the video. I've tried a clean new project Unity v2018.1.0f2 with NatCorder 1.2f1 and NatShare. Running the ReplayCam scene. When the recording finishes I just share this recording and the first few frames are black which when sharing makes the thumbnail black. Running the App on iPhoneX iOS v11.3

    Let me know if you have any ideas to workaround this issue. Really appreciate the help.

    elhongo.
     
  13. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    27
    Also tested on an iPad Pro and same issue.
     
  14. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    I am not sure what you mean here. Can you share screenshots? It's hard to understand without a visualization.
     
  15. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    Can you email me the video itself? The first frame should never be black, especially on iOS.
     
  16. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    27
    Just sent over an email with an attached video. Really appreciate the great support.
     
    Lanre likes this.
  17. alan_motionlab

    alan_motionlab

    Joined:
    Nov 27, 2014
    Posts:
    90
    It like it still in Portrait.

    Image-1.jpg
     
  18. zf19890324

    zf19890324

    Joined:
    Mar 19, 2018
    Posts:
    2
    We just use the Replay Api to record the game scene. We collect many online bugs like this:

    Caused by java.lang.IllegalStateException
    at android.media.MediaCodec.signalEndOfInputStream(MediaCodec.java)
    at com.yusufolokoba.natcorder.Encoder.drainEncoder(a:78)
    at com.yusufolokoba.natcorder.Encoder.run(a:115)
    at java.lang.Thread.run(Thread.java:818)

    Let me know if you have any ideas to workaround this issue. Really appreciate the help.
     
  19. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    103
    Hi, I just bought ur plugin but everytime I finish a recording running provided examples, the editor crashes after 10 seconds. (hitting stop doesn't help)
    The recording is ok though.
    Unity 2018.01f2 or 2017.1.1p4 - Windows7

    Sometimes after recording finishes it also fire a null reference exception

    EDIT: the crash happens on builded windows exe too
    Unity Editor [version: Unity 2017.1.1p4_4b0ddcd3f6ad]
    Unity.exe caused an Access Violation (0xc0000005)
    in module Unity.exe at 0033:00000000.
    Error occurred at 2018-05-24_153104.
    C:\Program Files\Unity5new\Unity\Editor\Unity.exe, run by Fra.
    51% memory in use.
    16327 MB physical memory [7982 MB free].
    24325 MB paging file [14512 MB free].
    8388608 MB user address space [8386278 MB free].
    Write to location 00000000 caused an access violation.
    Context:
    RDI: 0x4168c740 RSI: 0x0000000d RAX: 0xfa4806e6
    RBX: 0x0000000d RCX: 0x4181a040 RDX: 0x00000000
    RIP: 0x00000000 RBP: 0x00000000 SegCs: 0x00000033
    EFlags: 0x00010202 RSP: 0x4265fa68 SegSs: 0x0000002b
    R8: 0xfa446f70 R9: 0x00000000 R10: 0xfffe0000
    R11: 0xfffffff8 R12: 0x00000000 R13: 0x00000000
    R14: 0x00000000 R15: 0x00000000
    Bytes at CS:EIP:
    ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
    Stack:
    0x4265fa68: fe9f11d6 000007fe 0000004e 00000000 ........N.......
    0x4265fa78: 34a7fb4b 00000000 30bd6900 00000000 K..4.....i.0....
    0x4265fa88: de4a44d0 000007fe 00000000 00000000 .DJ.............
    0x4265fa98: ff05a54f 000007fe 4168c740 00000000 O.......@.hA....
    0x4265faa8: 00000001 00000000 00000000 00000000 ................
    0x4265fab8: 0000004d 00000000 00000000 00000000 M...............
    0x4265fac8: fa41861d 000007fe 41747150 00000000 ..A.....PqtA....
    0x4265fad8: 00000001 00000000 3eb04de0 00000000 .........M.>....
    0x4265fae8: 00000000 00000000 41747150 00000000 ........PqtA....
    0x4265faf8: fa419a9c 000007fe 00000001 00000000 ..A.............
    0x4265fb08: 00000000 00000000 00000000 00000000 ................
    0x4265fb18: 00000000 00000000 00000000 00000000 ................
    0x4265fb28: fa419995 000007fe 00000000 00000000 ..A.............
    0x4265fb38: 00000000 00000000 00000000 00000000 ................
    0x4265fb48: 3eb04de0 00000000 3eb04de0 00000000 .M.>.....M.>....
    0x4265fb58: e1b5c5f7 000007fe 00000000 00000000 ................
    0x4265fb68: 3eb04de0 00000000 00000000 00000000 .M.>............
    0x4265fb78: 00000000 000007fe 3eb04de0 00000000 .........M.>....
    0x4265fb88: e1b5c7af 000007fe 00000000 00000000 ................
    0x4265fb98: 00000000 00000000 00000000 00000000 ................
    0x4265fba8: 00000000 00000000 ffffffff 00000000 ................
    0x4265fbb8: 00000000 00000000 00000000 00000000 ................
    0x4265fbc8: e1b58f17 000007fe 3ebd6fb0 00000000 .........o.>....
    0x4265fbd8: 0000004d 00000000 0000004f 00000000 M.......O.......
    0x4265fbe8: 555c3a43 73726573 ffffffff 696e555c C:\Users....\Uni
    0x4265fbf8: 00000000 65766972 00000000 00000000 ....rive........
    0x4265fc08: 00000000 00000000 00000000 00000000 ................
    0x4265fc18: 00000000 00000000 00000000 00000000 ................
    0x4265fc28: e1b590c3 000007fe 00000000 00000000 ................
    0x4265fc38: 3eb04de0 00000000 3ebd6fb0 00000000 .M.>.....o.>....
    0x4265fc48: 00000000 00000000 318f2210 00000000 .........".1....
    0x4265fc58: fa4275e6 000007fe 318f2210 00000000 .uB......".1....
    0x4265fc68: 1931d4f0 00000000 00000000 00000000 ..1.............
    0x4265fc78: ffffffff 000007fe 00000001 00000000 ................
    0x4265fc88: fa42a944 000007fe 00000000 00000000 D.B.............
    0x4265fc98: fa4336d3 000007fe 00000000 00000000 .6C.............
    0x4265fca8: 00000000 00000000 417620f0 00000000 ......... vA....
    0x4265fcb8: fa40eee7 000007fe 00000000 00000000 ..@.............
    0x4265fcc8: 00000000 00000000 318f2210 00000000 .........".1....
    0x4265fcd8: 00000000 00000000 4181c4d0 00000000 ...........A....
    0x4265fce8: fa431b65 000007fe 4181c4d0 00000000 e.C........A....
    0x4265fcf8: 00000000 00000000 4161a2a0 00000000 ..........aA....
    0x4265fd08: 00000000 00000000 4265fe98 00000000 ..........eB....
    0x4265fd18: 4265fd28 00000000 00000004 00000000 (.eB............
    0x4265fd28: 00000000 00000000 00000000 00000000 ................
    0x4265fd38: 00000000 00000000 00000000 00000000 ................
    0x4265fd48: 00000000 00000000 4265fd30 00000000 ........0.eB....
    0x4265fd58: 00000000 00000000 00000000 00000000 ................
    0x4265fd68: 4265fd48 00000000 00000000 00000000 H.eB............
    0x4265fd78: 00000000 00000000 4265fd60 00000000 ........`.eB....
    0x4265fd88: 00000000 00000000 00000000 00000000 ................
    0x4265fd98: 4265fd78 00000000 00000000 00000000 x.eB............
    0x4265fda8: 00000000 00000000 4265fd90 00000000 ..........eB....
    0x4265fdb8: 00000000 00000000 00000000 00000000 ................
    0x4265fdc8: 4265fda8 00000000 00000000 00000000 ..eB............
    0x4265fdd8: 00000000 00000000 4265fdc0 00000000 ..........eB....
    0x4265fde8: 00000000 00000000 00000000 00000000 ................
    0x4265fdf8: 4265fdd8 00000000 00000000 00000000 ..eB............
    0x4265fe08: 00000000 00000000 4265fdf0 00000000 ..........eB....
    0x4265fe18: 00000000 00000000 00000000 00000000 ................
    0x4265fe28: 4265fe08 00000000 00000000 00000000 ..eB............
    0x4265fe38: 00000000 00000000 4265fe20 00000000 ........ .eB....
    0x4265fe48: 00000000 00000000 00000000 00000000 ................
    0x4265fe58: 4265fe38 00000000 00000000 00000000 8.eB............
    0x4265fe68: 00000000 00000000 4265fe50 00000000 ........P.eB....
    0x4265fe78: 00000000 00000000 00000000 00000000 ................
    0x4265fe88: 4265fe68 00000000 00000000 00000000 h.eB............
    0x4265fe98: fe6a1302 000007fe 4265fe80 00000000 ..j.......eB....
    0x4265fea8: fe731a80 000007fe 00000000 00000000 ..s.............
    0x4265feb8: 00000000 00000000 00000000 00000000 ................
    0x4265fec8: 00000000 00000000 00000000 00000000 ................
    0x4265fed8: 00000000 00000000 00000000 00000000 ................
    0x4265fee8: 00000000 00000000 00000000 00000000 ................
    0x4265fef8: fe6a415f 000007fe 318f2210 00000000 _Aj......".1....
    0x4265ff08: 011dd4e0 00000000 00000000 00000000 ................
    0x4265ff18: 00000000 00000000 00000000 00000000 ................
    0x4265ff28: fe6a6ebd 000007fe fe731ea0 000007fe .nj.......s.....
    0x4265ff38: 011dd4e0 00000000 00000000 00000000 ................
    0x4265ff48: 00000000 00000000 00000000 00000000 ................
    0x4265ff58: 770a59cd 00000000 00000000 00000000 .Y.w............
    0x4265ff68: 00000000 00000000 00000000 00000000 ................
    0x4265ff78: 00000000 00000000 00000000 00000000 ................
    0x4265ff88: 7730383d 00000000 00000000 00000000 =80w............
    0x4265ff98: 00000000 00000000 00000000 00000000 ................
    0x4265ffa8: 00000000 00000000 7712bac0 00000000 ...........w....
    0x4265ffb8: 7712bac0 00000000 4265ebf0 00000000 ...w......eB....
    0x4265ffc8: 00000000 00000000 00000000 00000000 ................
    0x4265ffd8: 00000000 00000000 00000000 00000000 ................
    0x4265ffe8: 00000000 00000000 00000000 00000000 ................
    0x4265fff8: 00000000 00000000 ........
    Module 1
    C:\Program Files\Unity5new\Unity\Editor\OpenRL_pthread.dll
    Image Base: 0x80000000 Image Size: 0x0000f000
    File Size: 42496 File Time: 2017-09-23_163654
    Version:
    Company: Open Source Software community LGPL
    Product: POSIX Threads for Windows LPGL
    FileDesc: MS C 32 bit
    FileVer: 2.9.0.0
    ProdVer: 2.9.0.0
    Module 2
    C:\Program Files\Unity5new\Unity\Editor\OpenRL.dll
    Image Base: 0x80000000 Image Size: 0x00c30000
    File Size: 12654592 File Time: 2017-09-23_163654
    Version:
    Company: Imagination Technologies, Inc.
    Product: OpenRL™
    FileDesc: OpenRL™ Library
    FileVer: 1.5.100.0
    ProdVer: 1.5.100.0
    Module 3
    C:\Windows\system32\xinput1_3.dll
    Image Base: 0x00400000 Image Size: 0x0001e000
    File Size: 107368 File Time: 2007-04-04_195422
    Version:
    Company: Microsoft Corporation
    Product: Microsoft® DirectX for Windows®
    FileDesc: Microsoft Common Controller API
    FileVer: 9.18.944.0
    ProdVer: 9.18.944.0
    Module 4
    C:\Program Files\Common Files\Pegasus Imaging\pvmjpgx40.dll
    Image Base: 0x80000000 Image Size: 0x00131000
    File Size: 1229256 File Time: 2011-07-14_155658
    Version:
    Company: Accusoft Pegasus
    Product: PICVideo Codec Suite
    FileDesc: PICVideo M-JPEG 4 codec 64-bit
    FileVer: 4.0.9.0
    ProdVer: 4.0.9.0
    Module 5
    C:\Program Files\Debugging Tools for Windows (x64)\dbghelp.dll
    Image Base: 0x527b0000 Image Size: 0x00169000
    File Size: 1369936 File Time: 2009-02-25_193202
    Version:
    Company: Microsoft Corporation
    Product: Debugging Tools for Windows(R)
    FileDesc: Windows Image Helper
    FileVer: 6.11.1.404
    ProdVer: 6.11.1.404
    Module 6
    C:\Program Files\Debugging Tools for Windows (x64)\symsrv.dll
    Image Base: 0x55270000 Image Size: 0x0004c000
    File Size: 143712 File Time: 2009-02-25_193148
    Version:
    Company: Microsoft Corporation
    Product: Debugging Tools for Windows(R)
    FileDesc: Symbol Server
    FileVer: 6.11.1.404
    ProdVer: 6.11.1.404
    Module 7
    C:\Windows\system32\odbcint.dll
    Image Base: 0x552c0000 Image Size: 0x00038000
    File Size: 229376 File Time: 2009-07-14_033156
    Version:
    Company: Microsoft Corporation
    Product: Microsoft® Windows® Operating System
    FileDesc: ODBC Resources
    FileVer: 6.1.7600.16385
    ProdVer: 6.1.7600.16385
    Module 8
    C:\Program Files\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL
    Image Base: 0x6c080000 Image Size: 0x0002e000
    File Size: 168304 File Time: 2009-08-18_124802
    Version:
    Company: Microsoft Corporation
    Product: Microsoft® Windows Live ID
    FileDesc: Microsoft® Windows Live ID Namespace Provider
    FileVer: 6.500.3165.0
    ProdVer: 6.500.3165.0
    Module 9
    C:\Program Files\Bonjour\mdnsNSP.dll
    Image Base: 0x6c0b0000 Image Size: 0x00026000
    File Size: 133392 File Time: 2015-08-12_170342
    Version:
    Company: Apple Inc.
    Product: Bonjour
    FileDesc: Bonjour Namespace Provider
    FileVer: 3.1.0.1
    ProdVer: 3.1.0.1
    Module 10
    C:\Windows\system32\MSVCR100.dll
    Image Base: 0x725f0000 Image Size: 0x000d2000
    File Size: 829264 File Time: 2011-06-11_021538
    Version:
    Company: Microsoft Corporation
    Product: Microsoft® Visual Studio® 2010
    FileDesc: Microsoft® C Runtime Library
    FileVer: 10.0.40219.325
    ProdVer: 10.0.40219.325
    Module 11
    C:\Windows\system32\MSVCP100.dll
    Image Base: 0x726d0000 Image Size: 0x00098000
    File Size: 608080 File Time: 2011-06-11_021538
    Version:
    Company: Microsoft Corporation
    Product: Microsoft® Visual Studio® 2010
    FileDesc: Microsoft® C Runtime Library
    FileVer: 10.0.40219.325
    ProdVer: 10.0.40219.325
    Module 12
    C:\Windows\system32\ksuser.dll
    Image Base: 0x74d30000 Image Size: 0x00006000
    File Size: 5120 File Time: 2015-12-08_210732
    Version:
    Company: Microsoft Corporation
    Product: Microsoft® Windows® Operating System
    FileDesc: User CSA Library
    FileVer: 6.1.7601.19091
    ProdVer: 6.1.7601.19091
    Module 13
    C:\Windows\system32\kernel32.dll
    Image Base: 0x77090000 Image Size: 0x0011f000
    File Size: 1163264 File Time: 2018-04-23_020042
    Version:
    Company: Microsoft Corporation
    Product: Sistema operativo Microsoft® Windows®
    FileDesc: DLL client di Windows NT BASE API
    FileVer: 6.1.7601.24117
    ProdVer: 6.1.7601.24117
    Module 14
    C:\Windows\system32\USER32.dll
    Image Base: 0x771b0000 Image Size: 0x000fa000
    File Size: 1009152 File Time: 2016-11-10_183242
    Version:
    Company: Microsoft Corporation
    Product: Sistema operativo Microsoft® Windows®
    FileDesc: Multi-User Windows USER API Client DLL
    FileVer: 6.1.7601.23594
    ProdVer: 6.1.7601.23594
    Module 15
    C:\Windows\SYSTEM32\ntdll.dll
    Image Base: 0x772b0000 Image Size: 0x0019f000
    File Size: 1665336 File Time: 2018-04-23_020714
    Version:
    Company: Microsoft Corporation
    Product: Sistema operativo Microsoft® Windows®
    FileDesc: DLL del livello NT
    FileVer: 6.1.7601.24117
    ProdVer: 6.1.7601.24117
    Module 16
    C:\Windows\system32\normaliz.DLL
    Image Base: 0x77450000 Image Size: 0x00003000
    File Size: 2560 File Time: 2009-07-14_033142
    Version:
    Company: Microsoft Corporation
    Product: Microsoft® Windows® Operating System
    FileDesc: Unicode Normalization DLL
    FileVer: 6.1.7600.16385
    ProdVer: 6.1.7600.16385
    Module 17
    C:\Windows\system32\PSAPI.DLL
    Image Base: 0x77460000 Image Size: 0x00007000
    File Size: 9216 File Time: 2009-07-14_034154
    Version:
    Company: Microsoft Corporation
    Product: Microsoft® Windows® Operating System
    FileDesc: Process Status Helper
    FileVer: 6.1.7600.16385
    ProdVer: 6.1.7600.16385
    == [end of error.log] ==
    upload_2018-5-24_15-40-39.png
    upload_2018-5-24_12-33-24.png
     
    Last edited: May 24, 2018
  20. erikwp

    erikwp

    Joined:
    Jan 16, 2018
    Posts:
    13
    Hi I'm trying out Natcorder for the first time and getting choppy distorted video output on IOS 11.3. I tried lowering the resolution but its the same - any idea whats causing this issue? I have multithreaded rendering turned on in player settings.
    EDIT: I should mention I am using Vuforia also.
    Thx
    See linked video: https://we.tl/uQkS92WMMg
    UPDATE: I downloaded the newest version (1.2f2) and it fixed the video tearing issue.
     
    Last edited: May 24, 2018
    Lanre likes this.
  21. elhongo

    elhongo

    Joined:
    Aug 13, 2015
    Posts:
    27
    The new version 1.2f2 also fixes the first black frame issue as well. If anyone else was having this issue.
     
    Lanre likes this.
  22. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    In this picture it looks like Screen.width and Screen.height are still in portrait. Check this (you might have to manually swap them) and try again.
     
  23. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    What version of Android is this device using? Issues like this occur when you record for a very short time (like a fraction of a second). The new update, version 1.2f2, fixes crashes caused by this behaviour.
     
  24. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    The crash from the exe doesn't mention NatCorder. I am working on a fix for the null ref, and I am looking into the editor crash.
     
  25. zf19890324

    zf19890324

    Joined:
    Mar 19, 2018
    Posts:
    2
    Thanks for your reply! This bug exist mostly comes from Sony in Android 5.1.1 and 7.1.1. As you mentioned I update to the version 1.2f2. But that bug still exists.I print the unity log below when the crash happens:

    05-25 14:29:44.551 8639-8639/ D/IS_UNITY: true
    05-25 14:29:44.565 8639-8639/ D/IS_UNITY: true
    05-25 14:29:44.580 8639-8639/ D/IS_UNITY: true
    05-25 14:29:46.807 8639-8742/ D/Unity: NatCorder: Preparing video encoder with format: {height=480, width=270, bitrate=5909759, mime=video/avc, frame-rate=20, i-frame-interval=3, color-format=2130708361}
    05-25 14:29:46.977 8639-10648/ D/Unity: NatCam Rendering: Created ES3 GLRenderContext
    05-25 14:29:47.022 8639-10635/ D/Unity: NatCorder: Recorder added track 0 with format: {height=480, width=270, csd-1=java.nio.ByteArrayBuffer[position=0,limit=8,capacity=8], what=1869968451, mime=video/avc, csd-0=java.nio.ByteArrayBuffer[position=0,limit=17,capacity=17]}
    05-25 14:29:47.026 8639-10635/ D/Unity: NatCorder: Recorder started recording

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
    05-25 14:29:51.056 8639-10635/ D/Unity: NatCorder: Video encoder detected EOS marker
    05-25 14:29:51.058 8639-10635/ D/Unity: NatCorder: Video encoder stopping
    05-25 14:29:51.061 8639-10648/ D/Unity: NatCam Rendering: Released GLRenderContext
    05-25 14:29:51.077 8639-10635/ D/Unity: NatCorder: Released recorder
    05-25 14:29:52.804 8639-8742/ I/Unity: Analytics.SRE: winpage,show,

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
    05-25 14:30:34.126 8639-8639/ D/IS_UNITY: true
    05-25 14:30:34.140 8639-8639/ D/IS_UNITY: true
    05-25 14:30:34.154 8639-8639/ D/IS_UNITY: true
    05-25 14:30:35.325 8639-8742/ D/Unity: NatCorder: Preparing video encoder with format: {height=480, width=270, bitrate=5909759, mime=video/avc, frame-rate=20, i-frame-interval=3, color-format=2130708361}
    05-25 14:30:35.543 8639-11847/ D/Unity: NatCam Rendering: Created ES3 GLRenderContext
    05-25 14:30:35.605 8639-11837/ D/Unity: NatCorder: Recorder added track 0 with format: {height=480, width=270, csd-1=java.nio.ByteArrayBuffer[position=0,limit=8,capacity=8], what=1869968451, mime=video/avc, csd-0=java.nio.ByteArrayBuffer[position=0,limit=17,capacity=17]}
    05-25 14:30:35.607 8639-11837/ D/Unity: NatCorder: Recorder started recording
    05-25 14:30:40.216 8639-8742/ I/Unity: Analytics.SRE: level_finish,3,76

    (Filename: ./Runtime/Export/Debug.bindings.h Line: 43)
    05-25 14:30:40.233 8639-11847/ D/Unity: NatCam Rendering: Released GLRenderContext
    05-25 14:30:40.239 8639-11837/ D/Unity: NatCorder: Video encoder detected EOS marker
    05-25 14:30:40.248 8639-11837/ E/AndroidRuntime: FATAL EXCEPTION: NatCorder Video Encoding Thread
    Process: PID: 8639
    java.lang.Error: FATAL EXCEPTION [NatCorder Video Encoding Thread]
    Unity version : 2018.1.0f2
    Device model : Sony C6902
    Device fingerprint: Sony/C6902/C6902:5.1.1/14.6.A.1.236/2031203603:user/release-keys

    Caused by: java.lang.IllegalStateException
    at android.media.MediaCodec.signalEndOfInputStream(Native Method)
    at com.yusufolokoba.natcorder.Encoder.drainEncoder(Encoder.java:78)
    at com.yusufolokoba.natcorder.Encoder.run(Encoder.java:115)
    at java.lang.Thread.run(Thread.java:818)

    It happens when the second record ends, the two records takes about 7-8s each. This bug can be reproduced in our test device stably. Besides the above bug, we have collected two bugs below(we have not reproduce them in our device):

    Caused by java.lang.IllegalStateException
    at android.media.MediaCodec.getBuffers(MediaCodec.java)
    at android.media.MediaCodec.getOutputBuffers(MediaCodec.java:551)
    at com.yusufolokoba.natcorder.Encoder.drainEncoder(a:79)
    at com.yusufolokoba.natcorder.Encoder.run(a:120)
    at java.lang.Thread.run(Thread.java:841)
    This bug mostly exists from HUAWEI in Android 4.4.2

    Caused by java.lang.IllegalStateException
    at android.media.MediaCodec.native_dequeueOutputBuffer(MediaCodec.java)
    at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2406)
    at com.yusufolokoba.natcorder.Encoder.drainEncoder(a:82)
    at com.yusufolokoba.natcorder.Encoder.run(a:120)
    at java.lang.Thread.run(Thread.java:833)
    This bug mostly exists from HUAWEI in Android 6.0 and 5.0.1

    Caused by java.lang.IllegalStateException: Failed to stop the muxer
    at android.media.MediaMuxer.nativeStop(MediaMuxer.java)
    at android.media.MediaMuxer.stop(MediaMuxer.java:245)
    at com.yusufolokoba.natcorder.Recorder.finishEncoder(a:74)
    at com.yusufolokoba.natcorder.Encoder.run(a:117)
    at java.lang.Thread.run(Thread.java:760)


    These bugs stuck us these days, Let me know if you have any ideas to workaround this issue. Really appreciate the help.
     
  26. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    I'll need to see the full (unfiltered) logs from app start to crash. They usually contain the exact reason why the functions throw an exception. Please email them to me in .txt files.
     
  27. Eric_Bates

    Eric_Bates

    Joined:
    Jan 14, 2014
    Posts:
    120
    Hi,
    Just checking in after updating. Im getting an assembly missing error when I try to use NatCorderU.Extensions. Has this changed?

    Thanks!
     
  28. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    That namespace has been removed. Delete and reimport NatCorder to make sure you don't have stale sources. If you are using the Sharing API, then download NatShare instead.
     
  29. Eric_Bates

    Eric_Bates

    Joined:
    Jan 14, 2014
    Posts:
    120
    ah, I wasnt aware that sharing had been moved to it's own package in the latest update. Cool, this is an easy fix:)
    Thanks @Lanre!!
     
    Lanre likes this.
  30. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    103
    Hi @Lanre , did u manage to reproduce the crash issue on ur machine?Is it related to operating system or hardware?Is there a workaround for this? ...I'm stuck, I really need that fix :(
    thx
     
  31. fssdev

    fssdev

    Joined:
    Jan 16, 2017
    Posts:
    49
    Hello, every once in a while when I'm starting a new recording on iOS I get this error:

    Code (CSharp):
    1. 2018-05-30 08:54:11.801800-0700 GameMobile[2097:9092128] NatCorder Logging: Prepared video track at resolution 1920x1080@30Hz with average bitrate 5909759 and keyframe interval 3s
    2. ArgumentException: An item with the same key has already been added. Key: 0
    3.   at System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) [0x00000] in <00000000000000000000000000000000>:0
    4.   at NatCorderU.Core.Platforms.NatCorderiOS.CommitFrame (NatCorderU.Core.Frame frame) [0x00000] in <00000000000000000000000000000000>:0
    5.   at MobileCameraScript.Update () [0x00000] in <00000000000000000000000000000000>:0
    6.   at Newtonsoft.Json.IArrayPool`1[T].Rent (System.Int32 minimumLength) [0x00000] in <00000000000000000000000000000000>:0
    7.   at Newtonsoft.Json.IArrayPool`1[T].Rent (System.Int32 minimumLength) [0x00000] in <00000000000000000000000000000000>:0
    8.   at Newtonsoft.Json.IArrayPool`1[T].Rent (System.Int32 minimumLength) [0x00000] in <00000000000000000000000000000000>:0
    9. Newtonsoft.Json.IArrayPool`1:Rent(Int32)
    10. Newtonsoft.Json.IArrayPool`1:Rent(Int32)
    11. Newtonsoft.Json.IArrayPool`1:Rent(Int32)
    I'm not sure whats happening in that library, but this only happens on the iOS side. The android side with the same code hasn't run into this problem.
    Every 30 seconds, I'm stopping the video, waiting 0.1 seconds, and starting a new recording.
    Any ideas what that could be? Maybe there's a way to flush the buffers(dictionaries) before starting another recording?

    Thanks
     
    Last edited: May 30, 2018
  32. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    Are you referring to the crash in the editor? If so, then try deleting and reimporting NatCorder. I am not able to reproduce the crash. Also, I have pushed a fix for the null reference exception.
     
  33. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    You need to wait for the VideoCallback from the previous recording to complete before starting a new recording. The exception you are getting is a different issue though. Are you using Metal or OpenGL ES? Can you share your MobileCameraScript source? You can email me this information.
     
  34. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    103
    Hi, I've tried with latest version and reimporting the project, but still the same. What can I do?Do u use any windows dll that I can try to replace/update?
     
  35. sinjimonkey

    sinjimonkey

    Joined:
    Jul 31, 2013
    Posts:
    42
    We are experiencing a crash when we start recording on iOS (but not on android) I don't have access to the device so I can't give you any kind of error log (and my boss isn't too tech savvy so unless any kind of error log is easy to get to I won't be able to get it from her)

    The way it crashes seems to me to be the same way the device closes if you fail to set a required permission flag. Is it possible that the script I use to write to the .info file is conflicting with yours? If so, what keys do I need to add to my code?

    My version of NatCorder was updated last Friday when I built that Review copy for her - which she didn't test until Tuesday. If a new build has been put up to resolve this issue we have not yet implemented it.

    EDIT: I see Dutin_Red has a suggestion on the previous page that looks like it might be related. I'm going to try that.
     
    Last edited: May 31, 2018
  36. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    You mentioned that the editor crashes after about 10 seconds. Do you mean that it crashes while recording? Or does it crash when you stop recording?
     
  37. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    You would need a way to get the logs from her test device to know for sure what's going on. Without it, there isn't much that can be done in the way of debugging.
     
  38. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    103
    The video generated is perfect, but once I stop recording and after 10 seconds, the editor (and exe) crashes.
    Please note that it crashes even if the editor is STOPPED and app is not running.

    EDIT: of course I've tried more than 1 webcam
     
    Last edited: May 31, 2018
  39. sinjimonkey

    sinjimonkey

    Joined:
    Jul 31, 2013
    Posts:
    42
    Where would those logs be in any event? I don't even know. How would one normally access them?

    All the suggestions I'm seeing online are XCode related or have a unity call. The former doesn't make sense because this is a TestFlight app she is running (not connected to XCode at that point) and the latter doesn't make sense because you can't call a script to output a log after a crash.
     
  40. sinjimonkey

    sinjimonkey

    Joined:
    Jul 31, 2013
    Posts:
    42
    I just checked the iTunes build info and iTunes isn't recording it as a crash - which makes me lean even more in the direction of a forced-quit due to a missing permission.

    What permission keys does NatCorder need in a .info file?
     
  41. fabiotgarcia

    fabiotgarcia

    Joined:
    Apr 28, 2017
    Posts:
    32
    Hi there!
    Recording on my iPhone 5C crash all the time. Its working fine on iPhone 6s.
    This is the message XCode get:
    Message from debugger: Terminated due to memory issue
    Is there any way to fix this?
    In attachment is the log file
    .


    Hi Fabio. Please post on the NatCorder forum thread since this is a NatCorder issue, or email me directly since we have discussed over email. Older devices that do not support Metal and that have limited RAM size struggle with recording, especially when running other services like Vuforia that consume a lot of GPU frame time. What I recommend as a workaround is reducing the resolution of your recording.

    Thanks Lanre!
     
    Lanre likes this.
  42. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    Are you able to reproduce this in a blank project? What version of Windows are you using (with the subversions)? Does the video callback get called?
     
  43. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    NatCorder doesn't need any permissions. Connect her device to Xcode and try to reproduce the crash, then send me the logs.
     
  44. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    103
    I've just created a whole new project on Unity 2017 and 2018 with NatCorder only. (Logs attached)
    What callback are u refering to?
     

    Attached Files:

  45. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    Can you reattach the logs as a .zip file or just a plain txt? I don't have a RAR archiver. I'm referring to the VideoCallback that gets passed in to StartRecording. Does that get invoked before the Editor crashes?
     
  46. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    103
    Yes, everything seems to work normally and you can even continue working with the editor after pushing stop, but after 10-15 seconds it crashes.
    Please see the logs attached
     

    Attached Files:

  47. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    The logs indicate that you are running on Windows 7. NatCorder requires a minimum of Windows 8 (will be updated to Windows 10 to guarantee maximum stability).
     
  48. Flag74

    Flag74

    Joined:
    May 31, 2017
    Posts:
    103
    Didn't see any minimum requirement about Windows in the docs and on asset store...you should add it. What Win8 feature are you using?
     
  49. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    2,682
    I will go ahead and add it. The Media Foundation implementation gets updated in new Windows releases; it isn't because of a missing feature.
     
  50. j_souhail

    j_souhail

    Joined:
    May 21, 2018
    Posts:
    4
    Hi Again,
    I tried implementing NATCorder and it is working very nicely.
    The only issue is that on IOS the ReplayCam when i replay the recorded video, the sound is very low.
    On android it is working with no issues. just on IOS.

    Thanks