israel-fl / bitmap2video

Generate video from Image resources, Bitmaps or a Canvas. Allows for audio multiplexing.
Apache License 2.0
89 stars 27 forks source link

kotlin.KotlinNullPointerException at com.homesoft.encoder.FrameBuilder.muxAudioFrames (FrameBuilder.kt:215) #20

Open rdcoder33 opened 2 years ago

rdcoder33 commented 2 years ago

My code used to work before but recently I started getting the following error, Please help me find what I did wrong

Code Snippet:

val muxerConfig = MuxerConfig(file, width!!, height!!, "video/avc", 1, 30F, 1500000)

              val muxer = Muxer(this@MainActivity, muxerConfig!!)

              muxer.mux(imageArray)
              muxer.setOnMuxingCompletedListener(object : MuxingCompletionListener {
                  override fun onVideoSuccessful(file: File) {
                      Log.d("video", "Video muxed - file path: ${file.absolutePath}")
                  }

                  override fun onVideoError(error: Throwable) {
                      Log.d("video", "There was an error muxing the video")
                  }
              })

              Thread(Runnable {
                  muxer.mux(imageArray)
              }).start()

Error:

E/FrameEvents( 4642): updateAcquireFence: Did not find frame.
D/CCodecBufferChannel( 4642): [c2.qti.avc.encoder#227] DEBUG: elapsed: n=8 [in=0 pipeline=0 out=4 smoothness=4]
D/PipelineWatcher( 4642): DEBUG: elapsed 0 / 8
17
E/FrameEvents( 4642): updateAcquireFence: Did not find frame.
D/OplusCCodec( 4642): initiateShutdown [203]: (0x6fc1a3afc0) keepComponentAllocated=1
D/OplusCCodec( 4642): initiateShutdown [203]: (0x6fc1a3afc0) keepComponentAllocated=0
I/hw-BpHwBinder( 4642): onLastStrongRef automatically unlinking death recipients
E/MethodChannel#com.example.lottie_test/videoMaker( 4642): Failed to handle method call
E/MethodChannel#com.example.lottie_test/videoMaker( 4642): kotlin.KotlinNullPointerException
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.homesoft.encoder.FrameBuilder.muxAudioFrames(FrameBuilder.kt:215)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.homesoft.encoder.Muxer.mux(Muxer.kt:82)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.homesoft.encoder.Muxer.mux$default(Muxer.kt:60)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.example.lottie_test.MainActivity.configureFlutterEngine$lambda-1(MainActivity.kt:68)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.example.lottie_test.MainActivity.lambda$QOk71ErInm8NhBDi7hWbf--RR0s(Unknown Source:0)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.example.lottie_test.-$$Lambda$MainActivity$QOk71ErInm8NhBDi7hWbf--RR0s.onMethodCall(Unknown Source:2)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at android.os.MessageQueue.next(MessageQueue.java:339)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at android.os.Looper.loop(Looper.java:198)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at android.app.ActivityThread.main(ActivityThread.java:8265)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)
I/Choreographer( 4642): Skipped 328 frames!  The application may be doing too much work on its main thread.
D/OplusCCodec( 4642): ~OplusCCodec [119]: (0x6fc1a3afc0)
I/flutter ( 4642): Failed to Invoke: 'null'.

Full Log:

D/MPEG4Writer( 4642): PreAllocation enabled
D/Muxer   ( 4642): Generating video
W/AudioCapabilities( 4642): Unsupported mime audio/ffmpeg
W/VideoCapabilities( 4642): Unsupported mime video/ffmpeg
2
W/VideoCapabilities( 4642): Unrecognized profile/level 0/3 for video/mpeg2
2
W/VideoCapabilities( 4642): Unsupported mime image/vnd.android.heic
E/Parcel  ( 4642): Reading a NULL string not supported here.
I/MediaCodec( 4642): CreateCCodec [1132]
D/OplusCCodec( 4642): OplusCCodec [103]: (0x6fc1a3afc0)
I/OplusExtendedFactory( 4642): createCCodec [68]:
D/CCodec  ( 4642): allocate(c2.qti.avc.encoder)
I/Codec2Client( 4642): Available Codec2 services: "default" "software"
I/CCodec  ( 4642): setting up 'default' as default (vendor) store
I/CCodec  ( 4642): Created component [c2.qti.avc.encoder]
D/CCodecConfig( 4642): read media type: video/avc
D/ReflectedParamUpdater( 4642): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater( 4642): ignored struct field coding.gop.values
D/ReflectedParamUpdater( 4642): extent() != 1 for single value type: vendor.qti-ext-enc-info-metadata-cvp.reserved
D/CCodecConfig( 4642): ignoring local param raw.color (0xc2001809) as it is already supported
I/CCodecConfig( 4642): query failed after returning 22 values (BAD_INDEX)
D/CCodecConfig( 4642): c2 config diff is Dict {
D/CCodecConfig( 4642):   c2::u32 algo.bitrate-mode.value = 3
D/CCodecConfig( 4642):   c2::i32 algo.priority.value = 0
D/CCodecConfig( 4642):   c2::float algo.rate.value = 30
D/CCodecConfig( 4642):   c2::u32 algo.secure-mode.value = 0
D/CCodecConfig( 4642):   c2::u32 coded.bitrate.value = 20000000
D/CCodecConfig( 4642):   c2::float coded.frame-rate.value = 30
D/CCodecConfig( 4642):   c2::u32 coded.pl.level = 0
D/CCodecConfig( 4642):   c2::u32 coded.pl.profile = 20484
D/CCodecConfig( 4642):   c2::u32 coded.vui.color.matrix = 255
D/CCodecConfig( 4642):   c2::u32 coded.vui.color.primaries = 0
D/CCodecConfig( 4642):   c2::u32 coded.vui.color.range = 0
D/CCodecConfig( 4642):   c2::u32 coded.vui.color.transfer = 255
D/CCodecConfig( 4642):   c2::u32 coding.intra-refresh.mode = 0
/ColorUtils( 4642): expected specified color aspects (0:0:255:255)
I/MediaCodec( 4642): [c2.qti.avc.encoder] configure, format : AMessage(what = 0x00000000) = {
I/MediaCodec( 4642):   int32_t color-format = 2130708361
I/MediaCodec( 4642):   int32_t i-frame-interval = 10
I/MediaCodec( 4642):   string mime = "video/avc"
I/MediaCodec( 4642):   int32_t width = 720
I/MediaCodec( 4642):   int32_t bitrate = 1500000
I/MediaCodec( 4642):   float frame-rate = 30.000000
I/MediaCodec( 4642):   int32_t height = 600
I/MediaCodec( 4642): }
D/OplusCCodec( 4642): initiateConfigureComponent [130]: (0x6fc1a3afc0)
D/IAtlas  ( 4642): IAtlas::init CallingPid 4642
D/IAtlas  ( 4642): IAtlas::init this 0x6fd02efa80
D/OplusCCodec( 4642): [operator():L183] OplusFeedbackInfo  mFeedbackID:479990099904
D/IAtlas  ( 4642): IAtlas::init CallingPid 4642
D/IAtlas  ( 4642): IAtlas::init this 0x6fd02efaf0
I/BpBinder( 4642): onLastStrongRef automatically unlinking death recipients: <uncached descriptor>
D/CCodec  ( 4642): [c2.qti.avc.encoder] buffers are bound to CCodec for this session
D/CCodec  ( 4642): setGopAndBitrate error = -2147483648
D/CCodecConfig( 4642): no c2 equivalents for color-format
D/CCodecConfig( 4642): no c2 equivalents for flags
D/CCodecConfig( 4642): no c2 equivalents for encoder
D/CCodecConfig( 4642): c2 config diff is   c2::u32 coded.bitrate.value = 1500000
D/CCodecConfig( 4642):   c2::i64 coding.sync-frame-interval.value = 10000000
D/CCodecConfig( 4642):   c2::u32 raw.pixel-format.value = 34
D/CCodecConfig( 4642):   c2::u32 raw.size.height = 600
D/CCodecConfig( 4642):   c2::u32 raw.size.width = 720
W/ColorUtils( 4642): expected specified color aspects (0:0:255:255)
W/Codec2Client( 4642): query -- param skipped: index = 3254781982.
D/CCodec  ( 4642): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  ( 4642):   Rect crop(0, 0, 719, 599)
D/CCodec  ( 4642):   int32_t color-standard = 130816
D/CCodec  ( 4642):   int32_t color-range = 0
D/CCodec  ( 4642):   int32_t color-transfer = 65791
D/CCodec  ( 4642):   int32_t android._dataspace = 12648448
D/CCodec  ( 4642):   int32_t width = 720
MediaCodec( 4642):   int32_t bitrate = 1500000
I/MediaCodec( 4642):   float frame-rate = 30.000000
I/MediaCodec( 4642):   int32_t height = 600
I/MediaCodec( 4642): }
D/OplusCCodec( 4642): initiateConfigureComponent [130]: (0x6fc1a3afc0)
D/IAtlas  ( 4642): IAtlas::init CallingPid 4642
D/IAtlas  ( 4642): IAtlas::init this 0x6fd02efa80
D/OplusCCodec( 4642): [operator():L183] OplusFeedbackInfo  mFeedbackID:479990099904
D/IAtlas  ( 4642): IAtlas::init CallingPid 4642
D/IAtlas  ( 4642): IAtlas::init this 0x6fd02efaf0
I/BpBinder( 4642): onLastStrongRef automatically unlinking death recipients: <uncached descriptor>
D/CCodec  ( 4642): [c2.qti.avc.encoder] buffers are bound to CCodec for this session
D/CCodec  ( 4642): setGopAndBitrate error = -2147483648
D/CCodecConfig( 4642): no c2 equivalents for color-format
D/CCodecConfig( 4642): no c2 equivalents for flags
D/CCodecConfig( 4642): no c2 equivalents for encoder
D/CCodecConfig( 4642): c2 config diff is   c2::u32 coded.bitrate.value = 1500000
D/CCodecConfig( 4642):   c2::i64 coding.sync-frame-interval.value = 10000000
D/CCodecConfig( 4642):   c2::u32 raw.pixel-format.value = 34
D/CCodecConfig( 4642):   c2::u32 raw.size.height = 600
D/CCodecConfig( 4642):   c2::u32 raw.size.width = 720
W/ColorUtils( 4642): expected specified color aspects (0:0:255:255)
W/Codec2Client( 4642): query -- param skipped: index = 3254781982.
D/CCodec  ( 4642): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  ( 4642):   Rect crop(0, 0, 719, 599)
D/CCodec  ( 4642):   int32_t color-standard = 130816
D/CCodec  ( 4642):   int32_t color-range = 0
D/CCodec  ( 4642):   int32_t color-transfer = 65791
D/CCodec  ( 4642):   int32_t android._dataspace = 12648448
D/CCodec  ( 4642):   int32_t width = 720
D/CCodec  ( 4642):   int32_t feature-secure-playback = 0
D/CCodec  ( 4642):   int32_t frame-rate = 30
D/CCodec  ( 4642):   int32_t height = 600
D/CCodec  ( 4642):   int32_t intra-refresh-period = 0
D/CCodec  ( 4642):   string mime = "video/raw"
D/CCodec  ( 4642):   int32_t prepend-sps-pps-to-idr-frames = 0
/CCodec  ( 4642):   int32_t priority = 0
D/CCodec  ( 4642):   Buffer hdr-static-info = {
D/CCodec  ( 4642):     00000000:  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
D/CCodec  ( 4642):     00000010:  00 00 00 00 00 00 00 00  00                       .........
D/CCodec  ( 4642):   }
D/CCodec  ( 4642):   int32_t android._color-format = 2130708361
D/CCodec  ( 4642):   int32_t color-format = 2130708361
D/CCodec  ( 4642): } and output: AMessage(what = 0x00000000) = {
D/CCodec  ( 4642):   int32_t bitrate = 1500000
D/CCodec  ( 4642):   int32_t bitrate-mode = 1
D/CCodec  ( 4642):   Rect crop(0, 0, 719, 599)
D/CCodec  ( 4642):   int32_t width = 720
D/CCodec  ( 4642):   int32_t color-standard = 130816
D/CCodec  ( 4642):   int32_t color-range = 0
D/CCodec  ( 4642):   int32_t color-transfer = 65791
D/CCodec  ( 4642):   int32_t feature-secure-playback = 0
D/CCodec  ( 4642):   int32_t frame-r
D/CCodec  ( 4642): input format changed to AMessage(what = 0x00000000) = {
D/CCodec  ( 4642):   Rect crop(0, 0, 719, 599)
D/CCodec  ( 4642):   int32_t color-standard = 130817
D/CCodec  ( 4642):   int32_t color-range = 2
D/CCodec  ( 4642):   int32_t color-transfer = 65791
D/CCodec  ( 4642):   int32_t android._dataspace = 260
D/CCodec  ( 4642):   int32_t width = 720
D/CCodec  ( 4642):   int32_t feature-secure-playback = 0
D/CCodec  ( 4642):   int32_t frame-rate = 30
D/CCodec  ( 4642):   int32_t height = 600
D/CCodec  ( 4642):   int32_t intra-refresh-period = 0
D/CCodec  ( 4642):   string mime = "video/raw"
D/CCodec  ( 4642):   int32_t prepend-sps-pps-to-idr-frames = 0
D/CCodec  ( 4642):   int32_t priority = 0
D/CCodec  ( 4642):   Buffer hdr-static-info = {
D/CCodec  ( 4642):     00000000:  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  ................
D/CCodec  ( 4642):     00000010:  00 00 00 00 00 00 00 00  00                       .........
D/CCodec  ( 4642):   }
/OplusCCodec( 4642): initiateShutdown [203]: (0x6fc1a3afc0) keepComponentAllocated=1
D/OplusCCodec( 4642): initiateShutdown [203]: (0x6fc1a3afc0) keepComponentAllocated=0
I/hw-BpHwBinder( 4642): onLastStrongRef automatically unlinking death recipients
E/MethodChannel#com.example.lottie_test/videoMaker( 4642): Failed to handle method call
E/MethodChannel#com.example.lottie_test/videoMaker( 4642): kotlin.KotlinNullPointerException
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.homesoft.encoder.FrameBuilder.muxAudioFrames(FrameBuilder.kt:215)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.homesoft.encoder.Muxer.mux(Muxer.kt:82)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.homesoft.encoder.Muxer.mux$default(Muxer.kt:60)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.example.lottie_test.MainActivity.configureFlutterEngine$lambda-1(MainActivity.kt:68)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.example.lottie_test.MainActivity.lambda$QOk71ErInm8NhBDi7hWbf--RR0s(Unknown Source:0)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.example.lottie_test.-$$Lambda$MainActivity$QOk71ErInm8NhBDi7hWbf--RR0s.onMethodCall(Unknown Source:2)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:818)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at android.os.MessageQueue.next(MessageQueue.java:339)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at android.os.Looper.loop(Looper.java:198)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at android.app.ActivityThread.main(ActivityThread.java:8265)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:612)
E/MethodChannel#com.example.lottie_test/videoMaker( 4642):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1006)
I/Choreographer( 4642): Skipped 328 frames!  The application may be doing too much work on its main thread.
D/OplusCCodec( 4642): ~OplusCCodec [119]: (0x6fc1a3afc0)
I/flutter ( 4642): Failed to Invoke: 'null'.
ArthurB-Bio1 commented 1 year ago

I have the same null pointer issue

petered commented 1 year ago

Yep, me too.

jeffreyliu8 commented 9 months ago

same