Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

NatCorder - Video Recording API

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

  1. MasterControlProgram

    MasterControlProgram

    Joined:
    Apr 18, 2015
    Posts:
    38
    Hi Lanre! Just saw the Natcorder update. First, amazing. This actually seems to address some memory pressure we've been seeing on low-end Android devices. Question - We're targeting devices in the Amazon ecosystem that use Android 22. Is there a reason why this newer version targets 24 API and above? Is there anything we can do to lower the Android requirement to 22 on our end?
     
  2. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    88
    Hi, I found 2 problems using the latest NatCorder

    My setup
    Unity 2020.3.4 LTS
    Natcorder 1.8
    NCPX
    Android IL2CPP, gles2, gles3

    Natrender

    1.On Android device, the first frame was always black.
    the code used for recording
    Code (CSharp):
    1. recorder = new MP4Recorder(width, height, 30, microphone?.sampleRate ?? 0, microphone?.channelCount ?? 0);
    2.         cameraInput = new CameraInput(recorder, clock, camList.ToArray());
    3.         if (Application.platform == RuntimePlatform.Android)
    4.             cameraInput.textureInput = new GLESTextureInput(recorder, multithreading: true);
    5.         else if (Application.platform ==  RuntimePlatform.IPhonePlayer)
    6.             cameraInput.textureInput = new MTLTextureInput(recorder, multithreading: true);
    7.         microphone?.StartRunning((sampleBuffer, timestamp) => recorder.CommitSamples(sampleBuffer, clock.timestamp));
    2.I have tried recording model with stencil buffer shader, but the record video result in black frame.
    this is the log shown in android log cat
    2021/04/20 16:44:54.245 21097 21179 Info Unity Record video
    2021/04/20 16:44:54.245 21097 21179 Info Unity CameraCaptureButton:RecordVideo()
    2021/04/20 16:44:54.245 21097 21179 Info Unity UnityEngine.Events.UnityAction:Invoke()
    2021/04/20 16:44:54.245 21097 21179 Info Unity UnityEngine.Events.UnityEvent:Invoke()
    2021/04/20 16:44:54.245 21097 21179 Info Unity UnityEngine.EventSystems.EventFunction`1:Invoke(T1, BaseEventData)
    2021/04/20 16:44:54.245 21097 21179 Info Unity UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    2021/04/20 16:44:54.245 21097 21179 Info Unity UnityEngine.EventSystems.StandaloneInputModule:processTouchPress(PointerEventData, Boolean, Boolean)
    2021/04/20 16:44:54.245 21097 21179 Info Unity UnityEngine.EventSystems.StandaloneInputModule:processTouchEvents()
    2021/04/20 16:44:54.245 21097 21179 Info Unity UnityEngine.EventSystems.StandaloneInputModule:process()
    2021/04/20 16:44:54.245 21097 21179 Info Unity
    2021/04/20 16:44:54.263 21097 21266 Info AudioTrack isLongTimeZoreData zoer date time 12 Seconds
    2021/04/20 16:44:54.348 21097 21179 Debug MPEG4Writer PreAllocation disabled. fallocate : Operation not supported on transport endpoint, 95
    2021/04/20 16:44:54.352 21097 23112 Info OMXClient IOmx service obtained
    2021/04/20 16:44:54.357 21097 23112 Info ExtendedACodec setupVideoEncoder()
    2021/04/20 16:44:54.357 21097 23112 Warn OMXUtils do not know color format 0x7fa30c06 = 2141391878
    2021/04/20 16:44:54.357 21097 23112 Warn OMXUtils do not know color format 0x7fa30c04 = 2141391876
    2021/04/20 16:44:54.357 21097 23112 Warn OMXUtils do not know color format 0x7fa30c00 = 2141391872
    2021/04/20 16:44:54.357 21097 23112 Warn OMXUtils do not know color format 0x7fa30c09 = 2141391881
    2021/04/20 16:44:54.357 21097 23112 Warn OMXUtils do not know color format 0x7fa30c0a = 2141391882
    2021/04/20 16:44:54.357 21097 23112 Warn OMXUtils do not know color format 0x7fa30c08 = 2141391880
    2021/04/20 16:44:54.358 21097 23112 Warn OMXUtils do not know color format 0x7fa30c07 = 2141391879
    2021/04/20 16:44:54.358 21097 23112 Warn OMXUtils do not know color format 0x7f000789 = 2130708361
    2021/04/20 16:44:54.358 21097 23112 Info ACodec [OMX.qcom.video.encoder.avc] using color format 0x15 in place of 0x7f420888
    2021/04/20 16:44:54.359 21097 23112 Warn AString ctor got NULL, using empty string instead
    2021/04/20 16:44:54.359 21097 23112 Info ACodec setupAVCEncoderParameters with [profile: Baseline] [level: Level1]
    2021/04/20 16:44:54.359 21097 23112 Info ACodec [OMX.qcom.video.encoder.avc] cannot encode HDR static metadata. Ignoring.
    2021/04/20 16:44:54.359 21097 23112 Info ACodec setupVideoEncoder succeeded
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec [OMX.qcom.video.encoder.avc] configure, AMessage : AMessage(what = 'conf', target = 11) = {
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec int32_t color-format = 2135033992
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec int32_t i-frame-interval = 2
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec string mime = "video/avc"
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec int32_t width = 896
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec int32_t bitrate = 10000000
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec float frame-rate = 30.000000
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec int32_t height = 1920
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec int32_t flags = 1
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec int32_t encoder = 1
    2021/04/20 16:44:54.359 21097 23112 Info ExtendedACodec }
    2021/04/20 16:44:54.360 21097 23112 Info ACodec [OMX.qcom.video.encoder.avc] input format is AMessage(what = 0x00000000) = {
    2021/04/20 16:44:54.360 21097 23112 Info ACodec string mime = "video/raw"
    2021/04/20 16:44:54.360 21097 23112 Info ACodec int32_t stride = 896
    2021/04/20 16:44:54.360 21097 23112 Info ACodec int32_t slice-height = 1920
    2021/04/20 16:44:54.360 21097 23112 Info ACodec int32_t color-format = 21
    2021/04/20 16:44:54.360 21097 23112 Info ACodec Buffer *image-data = 0xb400006f8ce5edc0
    2021/04/20 16:44:54.360 21097 23112 Info ACodec int32_t color-range = 0
    2021/04/20 16:44:54.360 21097 23112 Info ACodec int32_t color-standard = 0
    2021/04/20 16:44:54.360 21097 23112 Info ACodec int32_t color-transfer = 0
    2021/04/20 16:44:54.360 21097 23112 Info ACodec int32_t width = 896
    2021/04/20 16:44:54.360 21097 23112 Info ACodec int32_t height = 1920
    2021/04/20 16:44:54.360 21097 23112 Info ACodec }
    2021/04/20 16:44:54.362 21097 23112 Info ACodec [OMX.qcom.video.encoder.avc] output format is AMessage(what = 0x00000000) = {
    2021/04/20 16:44:54.362 21097 23112 Info ACodec int32_t bitrate = 10000000
    2021/04/20 16:44:54.362 21097 23112 Info ACodec int32_t max-bitrate = 10000000
    2021/04/20 16:44:54.362 21097 23112 Info ACodec int32_t frame-rate = 30
    2021/04/20 16:44:54.362 21097 23112 Info ACodec string mime = "video/avc"
    2021/04/20 16:44:54.362 21097 23112 Info ACodec int32_t width = 896
    2021/04/20 16:44:54.362 21097 23112 Info ACodec int32_t height = 1920
    2021/04/20 16:44:54.362 21097 23112 Info ACodec }
    2021/04/20 16:44:54.365 21097 21179 Verbose NatSuite NatCorder: MP4Recorder prepared video encoder with format: {color-format=2135033992, i-frame-interval=2, mime=video/avc, width=896, bitrate=10000000, frame-rate=30.0, height=1920}
    2021/04/20 16:44:54.367 21097 23118 Debug CCodec allocate(c2.android.aac.encoder)
    2021/04/20 16:44:54.368 21097 23118 Info Codec2Client Available Codec2 services: "default" "software"
    2021/04/20 16:44:54.369 21097 23118 Info CCodec setting up 'default' as default (vendor) store
    2021/04/20 16:44:54.371 21097 23118 Info CCodec Created component [c2.android.aac.encoder]
    2021/04/20 16:44:54.371 21097 23118 Debug CCodecConfig read media type: audio/mp4a-latm
    2021/04/20 16:44:54.372 21097 23118 Debug ReflectedParamUpdater extent() != 1 for single value type: algo.buffers.max-count.values
    2021/04/20 16:44:54.372 21097 23118 Debug ReflectedParamUpdater extent() != 1 for single value type: output.subscribed-indices.values
    2021/04/20 16:44:54.372 21097 23118 Debug ReflectedParamUpdater extent() != 1 for single value type: input.buffers.allocator-ids.values
    2021/04/20 16:44:54.372 21097 23118 Debug ReflectedParamUpdater extent() != 1 for single value type: output.buffers.allocator-ids.values
    2021/04/20 16:44:54.373 21097 23118 Debug ReflectedParamUpdater extent() != 1 for single value type: algo.buffers.allocator-ids.values
    2021/04/20 16:44:54.373 21097 23118 Debug ReflectedParamUpdater extent() != 1 for single value type: output.buffers.pool-ids.values
    2021/04/20 16:44:54.373 21097 23118 Debug ReflectedParamUpdater extent() != 1 for single value type: algo.buffers.pool-ids.values
    2021/04/20 16:44:54.373 21097 23118 Info CCodecConfig query failed after returning 9 values (BAD_INDEX)
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig c2 config diff is Dict {
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig c2::u32 coded.bitrate.value = 64000
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig c2::u32 coded.pl.level = 0
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig c2::u32 coded.pl.profile = 8192
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig c2::u32 coding.aac-sbr-mode.value = 3
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig c2::u32 input.buffers.max-size.value = 2048
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig c2::u32 input.delay.value = 0
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig string input.media-type.value = "audio/raw"
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig string output.media-type.value = "audio/mp4a-latm"
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig c2::u32 raw.channel-count.value = 1
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig c2::u32 raw.sample-rate.value = 44100
    2021/04/20 16:44:54.373 21097 23118 Debug CCodecConfig }
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec [c2.android.aac.encoder] buffers are bound to CCodec for this session
    2021/04/20 16:44:54.374 21097 23118 Debug CCodecConfig no c2 equivalents for channel-mask
    2021/04/20 16:44:54.374 21097 23118 Debug CCodecConfig no c2 equivalents for aac-profile
    2021/04/20 16:44:54.374 21097 23118 Debug CCodecConfig no c2 equivalents for flags
    2021/04/20 16:44:54.374 21097 23118 Debug CCodecConfig no c2 equivalents for encoder
    2021/04/20 16:44:54.374 21097 23118 Warn Codec2Client query -- param skipped: index = 1107298332.
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec setup formats input: AMessage(what = 0x00000000) = {
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t aac-sbr-mode = 3
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t channel-count = 1
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t max-input-size = 16384
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec string mime = "audio/raw"
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t sample-rate = 44100
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t channel-mask = 16
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec } and output: AMessage(what = 0x00000000) = {
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t aac-sbr-mode = 3
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t bitrate = 64000
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t channel-count = 1
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t level = 0
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t max-bitrate = 64000
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec string mime = "audio/mp4a-latm"
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t profile = 2
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec int32_t sample-rate = 44100
    2021/04/20 16:44:54.374 21097 23118 Debug CCodec }
    2021/04/20 16:44:54.374 21097 21179 Verbose NatSuite NatCorder: MP4Recorder prepared audio encoder with format: {channel-mask=16, sample-rate=44100, mime=audio/mp4a-latm, channel-count=1, bitrate=64000, aac-profile=2, max-input-size=16384}
    2021/04/20 16:44:54.389 21097 23118 Warn Codec2Client query -- param skipped: index = 1342179345.
    2021/04/20 16:44:54.389 21097 23118 Warn Codec2Client query -- param skipped: index = 2415921170.
    2021/04/20 16:44:54.390 21097 23118 Error FMQ grantorIdx must be less than 3
    2021/04/20 16:44:54.390 21097 23118 Error FMQ grantorIdx must be less than 3
    2021/04/20 16:44:54.390 21097 23118 Debug CCodecBufferChannel [c2.android.aac.encoder#795] Created input block pool with allocatorID 16 => poolID 17 - OK (0)
    2021/04/20 16:44:54.391 21097 23118 Info CCodecBufferChannel [c2.android.aac.encoder#795] Created output block pool with allocatorID 16 => poolID 517 - OK
    2021/04/20 16:44:54.391 21097 23118 Debug CCodecBufferChannel [c2.android.aac.encoder#795] Configured output block pool ids 517 => OK
    2021/04/20 16:44:54.391 21097 23118 Debug CCodecBufferChannel [c2.android.aac.encoder#795] start: updating output delay 0
    2021/04/20 16:44:54.391 21097 23118 Error ion ioctl c0044901 failed with code -1: Inappropriate ioctl for device
    2021/04/20 16:44:54.406 21097 21179 Debug AudioRecord set(): inputSource 1, sampleRate 44100, format 0x1, channelMask 0x10, frameCount 1792, notificationFrames 0, sessionId 0, transferType 0, flags 0, opPackageName com.spacears.space.android uid -1, pid -1
    2021/04/20 16:44:54.413 21097 21179 Debug AudioRecord start(602): sync event 0 trigger session 0, mSessionID=4377
    2021/04/20 16:44:54.424 21097 21179 Debug AudioService broadcastRecorderState:com.spacears.space.android
    2021/04/20 16:44:54.424 21097 21179 Verbose NatSuite NatDevice: AudioDevice 1 started recording with format: 1@44100Hz
    2021/04/20 16:44:54.426 21097 21179 Info Unity Capture Video Screenshot done, start recording....
    2021/04/20 16:44:54.426 21097 21179 Info Unity <DoCaptureThumbnailForVideo>d__28:MoveNext()
    2021/04/20 16:44:54.426 21097 21179 Info Unity UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    2021/04/20 16:44:54.426 21097 21179 Info Unity
    2021/04/20 16:44:54.478 21097 23112 Info ACodec [OMX.qcom.video.encoder.avc] output format is AMessage(what = 0x00000000) = {
    2021/04/20 16:44:54.478 21097 23112 Info ACodec int32_t bitrate = 10000000
    2021/04/20 16:44:54.478 21097 23112 Info ACodec int32_t max-bitrate = 10000000
    2021/04/20 16:44:54.478 21097 23112 Info ACodec int32_t frame-rate = 30
    2021/04/20 16:44:54.478 21097 23112 Info ACodec string mime = "video/avc"
    2021/04/20 16:44:54.478 21097 23112 Info ACodec int32_t width = 896
    2021/04/20 16:44:54.478 21097 23112 Info ACodec int32_t height = 1920
    2021/04/20 16:44:54.478 21097 23112 Info ACodec }
    2021/04/20 16:44:54.484 21097 23123 Error Utils csd0 too small
    2021/04/20 16:44:54.484 21097 23123 Error ExtendedUtils csd0 too small
    2021/04/20 16:44:54.484 21097 23123 Debug MPEG4Writer fpathconf _PC_FILESIZEBITS:64
    2021/04/20 16:44:54.484 21097 23123 Debug MPEG4Writer File size limit set to 4503599627370495 bytes implicitly
    2021/04/20 16:44:54.484 21097 23123 Debug MPEG4Writer MP4WtrCtrlHlpLooper Started
    2021/04/20 16:44:54.484 21097 23123 Info MPEG4Writer limits: 4503599627370495/0 bytes/us, bit rate: -1 bps and the estimated moov size 3192 bytes
    2021/04/20 16:44:54.484 21097 23132 Debug MPEG4Writer kWhatNoIOErrorSoFar
    2021/04/20 16:44:54.487 21097 23133 Info MPEG4Writer setStartTimestampUs: 0
    2021/04/20 16:44:54.487 21097 23133 Info MPEG4Writer Earliest track starting time: 0
    2021/04/20 16:44:54.501 21097 22899 Error native motion_tracking_context.cc:1331 Unable to find measurements corresponding to VIO status at timestamp 25781854800335.
    2021/04/20 16:44:54.536 21097 23118 Error FMQ grantorIdx must be less than 3
    2021/04/20 16:44:54.539 21097 22854 Error FMQ grantorIdx must be less than 3
    2021/04/20 16:44:54.540 21097 23134 Info MPEG4Writer setStartTimestampUs: 103892
    2021/04/20 16:44:55.279 21097 21266 Info AudioTrack isLongTimeZoreData zoer date time 13 Seconds
    2021/04/20 16:44:55.707 21097 22899 Error native motion_tracking_context.cc:1331 Unable to find measurements corresponding to VIO status at timestamp 25783054583928.
    2021/04/20 16:44:56.291 21097 21266 Info AudioTrack isLongTimeZoreData zoer date time 14 Seconds
    2021/04/20 16:44:56.653 21097 22984 Info native motion_analysis_calculator.cc:626 Analyzed frame 801
    2021/04/20 16:44:57.307 21097 21266 Info AudioTrack isLongTimeZoreData zoer date time 15 Seconds
    2021/04/20 16:44:57.667 21097 23119 Debug CCodecBufferChannel [c2.android.aac.encoder#795] DEBUG: elapsed: n=4 [in=0 pipeline=0 out=0 smoothness=4]
    2021/04/20 16:44:57.667 21097 23119 Debug PipelineWatcher DEBUG: elapsed 0 / 4
    2021/04/20 16:44:58.323 21097 21266 Info AudioTrack isLongTimeZoreData zoer date time 16 Seconds
    2021/04/20 16:44:59.339 21097 21266 Info AudioTrack isLongTimeZoreData zoer date time 17 Seconds
    2021/04/20 16:44:59.390 21097 23121 Debug BufferPoolAccessor2.0 bufferpool2 0xb400006fb6609828 : 5(81920 size) total buffers - 4(65536 size) used buffers - 0/5 (recycle/alloc) - 4/240 (fetch/transfer)
    2021/04/20 16:44:59.390 21097 23121 Debug BufferPoolAccessor2.0 evictor expired: 1, evicted: 1
    2021/04/20 16:44:59.986 21097 22984 Info native motion_analysis_calculator.cc:626 Analyzed frame 901
    2021/04/20 16:45:00.281 21097 21179 Error ACameraMetadata getConstEntry: cannot find metadata tag 65578
    2021/04/20 16:45:00.355 21097 21266 Info AudioTrack isLongTimeZoreData zoer date time 18 Seconds
    2021/04/20 16:45:01.000 21097 23119 Debug CCodecBufferChannel [c2.android.aac.encoder#795] DEBUG: elapsed: n=4 [in=0 pipeline=0 out=0 smoothness=4]
    2021/04/20 16:45:01.000 21097 23119 Debug PipelineWatcher DEBUG: elapsed 0 / 4
    2021/04/20 16:45:01.371 21097 21266 Info AudioTrack isLongTimeZoreData zoer date time 19 Seconds
    2021/04/20 16:45:01.700 21097 22899 Error native motion_tracking_context.cc:1331 Unable to find measurements corresponding to VIO status at timestamp 25789053501741.
    2021/04/20 16:45:01.809 21097 23130 Debug AudioRecord stop mSessionID=4377
    2021/04/20 16:45:01.809 21097 23130 Debug AudioRecord stop(602): mActive:1
    2021/04/20 16:45:01.844 21097 23130 Debug AudioService broadcastRecorderState:com.spacears.space.android
    2021/04/20 16:45:01.844 21097 23130 Debug AudioRecord stop mSessionID=4377
    2021/04/20 16:45:01.844 21097 23130 Debug AudioRecord stop(602): mActive:0
    2021/04/20 16:45:01.844 21097 23130 Debug AudioService broadcastRecorderState:com.spacears.space.android
    2021/04/20 16:45:01.844 21097 23130 Debug AudioRecord stop mSessionID=4377
    2021/04/20 16:45:01.844 21097 23130 Debug AudioRecord stop(602): mActive:0
    2021/04/20 16:45:01.844 21097 23130 Debug AudioRecord stop mSessionID=4377
    2021/04/20 16:45:01.844 21097 23130 Debug AudioRecord stop(602): mActive:0
    2021/04/20 16:45:01.844 21097 23130 Verbose NatSuite NatDevice: AudioDevice 1 stopped recording
    2021/04/20 16:45:01.855 21097 23123 Verbose NatSuite NatCorder: MP4Recorder video encoder encountered EOS
    2021/04/20 16:45:01.855 21097 23124 Verbose NatSuite NatCorder: MP4Recorder audio encoder encountered EOS
    2021/04/20 16:45:01.856 21097 23118 Debug CCodecBufferChannel [c2.android.aac.encoder#795] MediaCodec discarded an unknown buffer
    2021/04/20 16:45:01.856 21097 23118 Info chatty uid=10374(com.spacears.space.android) identical 1 line
    2021/04/20 16:45:01.856 21097 23118 Debug CCodecBufferChannel [c2.android.aac.encoder#795] MediaCodec discarded an unknown buffer
    2021/04/20 16:45:01.856 21097 23118 Info hw-BpHwBinder onLastStrongRef automatically unlinking death recipients
    2021/04/20 16:45:01.859 21097 21179 Info Unity Stop record video
    2021/04/20 16:45:01.859 21097 21179 Info Unity CameraCaptureButton:StopRecord()
    2021/04/20 16:45:01.859 21097 21179 Info Unity UnityEngine.Events.UnityAction:Invoke()
    2021/04/20 16:45:01.859 21097 21179 Info Unity UnityEngine.Events.UnityEvent:Invoke()
    2021/04/20 16:45:01.859 21097 21179 Info Unity UnityEngine.EventSystems.EventFunction`1:Invoke(T1, BaseEventData)
    2021/04/20 16:45:01.859 21097 21179 Info Unity UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    2021/04/20 16:45:01.859 21097 21179 Info Unity UnityEngine.EventSystems.StandaloneInputModule:processTouchPress(PointerEventData, Boolean, Boolean)
    2021/04/20 16:45:01.859 21097 21179 Info Unity UnityEngine.EventSystems.StandaloneInputModule:processTouchEvents()
    2021/04/20 16:45:01.859 21097 21179 Info Unity UnityEngine.EventSystems.StandaloneInputModule:process()
    2021/04/20 16:45:01.859 21097 21179 Info Unity
    2021/04/20 16:45:01.872 21097 21179 Info ExoPlayerImpl Init bdc1fce [ExoPlayerLib/2.8.4] [apollo, M2007J3SG, Xiaomi, 30]
    2021/04/20 16:45:01.877 21097 23123 Debug MPEG4Writer reset()
    2021/04/20 16:45:01.877 21097 23123 Debug MPEG4Writer Audio track stopping. Stop source
    2021/04/20 16:45:01.877 21097 23133 Verbose MediaWriter Track event err/info msg:101, trackId:1, type:1000,val:-1011
    2021/04/20 16:45:01.877 21097 23133 Info MPEG4Writer Received total/0-length (220/0) buffers and encoded 220 frames. - Video
    2021/04/20 16:45:01.878 21097 23134 Verbose MediaWriter Track event err/info msg:101, trackId:2, type:1000,val:-1011
    2021/04/20 16:45:01.878 21097 23134 Info MPEG4Writer Received total/0-length (313/0) buffers and encoded 313 frames. - Audio
    2021/04/20 16:45:01.878 21097 23134 Info MPEG4Writer Audio track drift time: 0 us
    2021/04/20 16:45:01.878 21097 23123 Debug MPEG4Writer Audio track source stopping
    2021/04/20 16:45:01.878 21097 23123 Debug MPEG4Writer Audio track source stopped
    2021/04/20 16:45:01.878 21097 23123 Debug MPEG4Writer Audio track stopped. Status:0. Stop source
    2021/04/20 16:45:01.878 21097 23123 Debug MPEG4Writer Video track stopping. Stop source
    2021/04/20 16:45:01.878 21097 23123 Debug MPEG4Writer audio will wait 0ns for video to stop
    2021/04/20 16:45:01.879 21097 23123 Warn MPEG4Writer Timed-out waiting for video track to reach final audio timestamp !
    2021/04/20 16:45:01.880 21097 23123 Debug MPEG4Writer Video track source stopping
    2021/04/20 16:45:01.880 21097 23123 Debug MPEG4Writer Video track source stopped
    2021/04/20 16:45:01.880 21097 23123 Debug MPEG4Writer Video track stopped. Status:0. Stop source
    2021/04/20 16:45:01.880 21097 23123 Debug MPEG4Writer Duration from tracks range is [7333244, 7375738] us
    2021/04/20 16:45:01.880 21097 23131 Debug MPEG4Writer 0 chunks are written in the last batch
    2021/04/20 16:45:01.883 21097 23123 Debug MPEG4Writer WriterThread stopped. Status:0
    2021/04/20 16:45:01.883 21097 23123 Info MPEG4Writer Adjust the moov start time from 0 us -> 0 us
    2021/04/20 16:45:01.885 21097 23123 Info MPEG4Writer The mp4 file will not be streamable.
    2021/04/20 16:45:01.885 21097 23123 Info MPEG4Writer MOOV atom was written to the file
    2021/04/20 16:45:01.885 21097 23123 Debug MPEG4Writer release()
    2021/04/20 16:45:01.896 21097 23123 Debug MPEG4Writer MP4WtrCtrlHlpLooper stopped
    2021/04/20 16:45:01.896 21097 23123 Debug MPEG4Writer Top 5 write durations(microseconds): #1:53 #2:57 #3:67 #4:87 #5:1317
    2021/04/20 16:45:01.896 21097 23123 Debug MPEG4Writer reset()
    2021/04/20 16:45:01.899 21097 23123 Debug MPEG4Writer Video track stopping. Stop source
    2021/04/20 16:45:01.899 21097 23123 Error MPEG4Writer Stop() called but track is not started or stopped
    2021/04/20 16:45:01.899 21097 23123 Debug MPEG4Writer Audio track stopping. Stop source
    2021/04/20 16:45:01.899 21097 23123 Error MPEG4Writer Stop() called but track is not started or stopped
    2021/04/20 16:45:01.913 21097 21179 Info Unity Saved recording to: /storage/emulated/0/Android/data/com.spacears.space.android/files/recording_2021_04_20_16_44_54_342.mp4
    2021/04/20 16:45:01.913 21097 21179 Info Unity <StopRecording>d__26:MoveNext()

    EDIT I just tried Natcorder 1.8 without NCPX and NatRender, the frame is still black
    EDIT2 Here is an example video with black frame

    the result video
     
    Last edited: Apr 21, 2021
  3. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,608
    Hey there. The upgrade to Android 24 is for parity with the other NatSuite Framework components, specifically NatML (upcoming machine learning library) and NatDevice. I believe NatCorder can still run on API level 21+, it just requires complicated build instructions. You have to export the Gradle project with API level 24 from Unity, then in Android Studio, revert the minimum to API level 22 and add a library override for NatCorder (api.natsuite.natcorder).
     
  4. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,608
    An issue has been opened for this, and I'll be looking into it today or tomorrow.
     
  5. MasterControlProgram

    MasterControlProgram

    Joined:
    Apr 18, 2015
    Posts:
    38
    Thanks Lanre! We'll try this out. We actually integrate Unity into a native project vial UAAL. So this might just work for us. Will report back :D
     
  6. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,608
    Sounds good, keep me posted.
     
  7. Krimelz

    Krimelz

    Joined:
    May 5, 2020
    Posts:
    1
    Hi
    can I using unity as a library with NatCorder?
     
    Last edited: Apr 27, 2021
  8. markinovus

    markinovus

    Joined:
    Apr 27, 2021
    Posts:
    4
    Hi,

    We're getting the following error and wondered if you had any pointers as to how to narrow down the cause of this issue.... The build works on most machines but just not on some... Should we put in a proper support request? (via the email address on github?)

    Code (CSharp):
    1. DllNotFoundException: NatCorder
    2. NatCorder.MP4Recorder..ctor (System.Int32 videoWidth, System.Int32 videoHeight, System.Int32 videoFramerate, System.Int32 audioSampleRate, System.Int32 audioChannelCount, System.Action`1[T] recordingCallback, System.String recordingDirectory, System.String recordingFilename, System.Int32 videoBitrate, System.Int32 videoKeyframeInterval) (at <b718adeea08544b9955e811addc8646e>:0)
    3. Inovus.InoScreenRecorder.StartRecording () (at <b718adeea08544b9955e811addc8646e>:0)
    4. Inovus.InoScene.TrackingStartSession () (at <b718adeea08544b9955e811addc8646e>:0)
    5. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    6. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    7. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    8.  
     
  9. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,608
    Hm I've never tried this, but I expect it to work. There shouldn't be any difference in how Unity libraries are loaded.
     
  10. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,608
    It looks like you're using an outdated version of NatCorder. Upgrade to 1.8 on the Asset Store (make sure to delete NatCorder in your project before pulling the new version) and try again. What platform are you running on?
     
  11. tamizhan

    tamizhan

    Joined:
    Feb 23, 2018
    Posts:
    5
    How to save the recorded video from particular album(path).Where to change it.
     
  12. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,608
    You can't set where NatCorder saves the recording, because it always saves to the app's private documents directory. If you want to move it somewhere else, you can use the functions in System.IO. If you'd like to copy the recording to the camera roll, you can use NatShare.
     
    tamizhan likes this.
  13. markinovus

    markinovus

    Joined:
    Apr 27, 2021
    Posts:
    4
    We're running Unity 2019.3.15f1 on PC and macOS. Is there anywhere you can point me towards a release note or readme or anything that shows a fix for this issue as the only think I could see was that a similar error occurred on OSX but that was from a really really long time ago. Thanks
     
  14. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,608
    Here's the changelog. I need to know the full specifications of the system where you saw this error. There was a similar error on Windows that was fixed sometime ago, but wasn't mentioned in the changelog. You'll want to upgrade to the latest version, and on Windows, make sure you install the latest Visual C++ Redistributable.
     
  15. tamizhan

    tamizhan

    Joined:
    Feb 23, 2018
    Posts:
    5
    Thanks
     
    Lanre likes this.
  16. art1997

    art1997

    Joined:
    Apr 7, 2017
    Posts:
    45
    Hi. I have noticed strange issue.
    I have video player, with video(with sound)
    when I start recording before playing video, video will play normally during recording.
    But when i start recording when video is playing, video got paused(or freeze)

    the issue doesn't exist when video has no audio.
    Any idea what can be the reason?
     
  17. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,608
    I'm not sure why this happens. Have you checked the logs for any clues? What device and OS version does this happen on?
     
  18. Icecubez

    Icecubez

    Joined:
    Apr 18, 2018
    Posts:
    2
    I'm having a similar issue.

    Recorded videos with audio are as if in slow-motion, but if I mute the audio in terms of setting samples/channels to 0, the video is smooth.
     
  19. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,608
    Sounds like you found the cause of the issue: the app was set to use Mono audio instead of Stereo.
     
  20. MasterControlProgram

    MasterControlProgram

    Joined:
    Apr 18, 2015
    Posts:
    38
    Just FYI, we use Unity as a Library with Natcorder and it works for us.
     
    Lanre likes this.
  21. microwavesam

    microwavesam

    Joined:
    Jun 17, 2017
    Posts:
    1
    Hi Lanre, I was using the
    NatCorder Performance Extensions for Android.

    I had a quick question on:

    Code (CSharp):
    1. GLESTextureInput(...);
    I have the recording part being generated, and I was wondering if when I choose to stop recording,

    should I Dispose() the
    GLESTextureInput?


    Do I need to Dispose() anything when stopping recording?

    Thank you for a very cool asset.
     
  22. Lanre

    Lanre

    Joined:
    Dec 26, 2013
    Posts:
    3,608
    Hey there, glad to see you're using NCPX. If you attach the `GLESTextureInput` to a `CameraInput`, then you don't need to dispose. The `CameraInput` disposes its texture input when it gets disposed.
     
unityunity