Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: build fail and when fixed, also creation of the video fails #12

Open
AndroidDeveloperLB opened this issue Nov 5, 2020 · 1 comment

Comments

@AndroidDeveloperLB
Copy link

AAPT: error: resource style/Theme.MaterialComponents.DayNight (aka com.israelfl.bitmap2video:style/Theme.MaterialComponents.DayNight) not found.
error: failed linking references.

image

Adding this fixes it:

    implementation 'com.google.android.material:material:1.3.0-alpha03'

But then when running, and choosing the button "make it!", I get a crash with this exceptioN:

2020-11-06 00:28:13.788 13354-13400/com.israelfl.bitmap2video E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
    Process: com.israelfl.bitmap2video, PID: 13354
    java.lang.RuntimeException: format changed twice
        at com.homesoft.encoder.FrameBuilder.drainCodec(FrameBuilder.kt:170)
        at com.homesoft.encoder.FrameBuilder.postCanvasFrame(FrameBuilder.kt:134)
        at com.homesoft.encoder.FrameBuilder.drawBitmapAndPostCanvas(FrameBuilder.kt:125)
        at com.homesoft.encoder.FrameBuilder.createFrame(FrameBuilder.kt:102)
        at com.homesoft.encoder.Muxer.mux(Muxer.kt:75)
        at com.homesoft.encoder.Muxer.muxAsync(Muxer.kt:93)
        at com.homesoft.bitmap2video.MainActivity$createVideoAsync$1.invokeSuspend(MainActivity.kt:142)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

Or this:

2020-11-06 00:27:47.318 13006-13039/com.israelfl.bitmap2video E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-1
    Process: com.israelfl.bitmap2video, PID: 13006
    java.lang.IllegalStateException: Failed to add the track to the muxer
        at android.media.MediaMuxer.nativeAddTrack(Native Method)
        at android.media.MediaMuxer.addTrack(MediaMuxer.java:660)
        at com.homesoft.encoder.Mp4FrameMuxer.start(Mp4FrameMuxer.kt:52)
        at com.homesoft.encoder.FrameBuilder.drainCodec(FrameBuilder.kt:176)
        at com.homesoft.encoder.FrameBuilder.postCanvasFrame(FrameBuilder.kt:134)
        at com.homesoft.encoder.FrameBuilder.drawBitmapAndPostCanvas(FrameBuilder.kt:125)
        at com.homesoft.encoder.FrameBuilder.createFrame(FrameBuilder.kt:102)
        at com.homesoft.encoder.Muxer.mux(Muxer.kt:75)
        at com.homesoft.encoder.Muxer.muxAsync(Muxer.kt:93)
        at com.homesoft.bitmap2video.MainActivity$createVideoAsync$1.invokeSuspend(MainActivity.kt:142)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:738)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)
@abritopach
Copy link

Hi @AndroidDeveloperLB

The problem is that both methods are being called to generate the video in this part of the code

// Basic implementation
   private fun basicVideoCreation() {
       videoFile = getVideoFile(this@MainActivity, "test.mp4")
       videoFile?.run {
           muxerConfig = MuxerConfig(this, 600, 600, mimeType, 3, 1F, 1500000)
           val muxer = Muxer(this@MainActivity, muxerConfig!!)

           createVideo(muxer) // using callbacks
           // or
           createVideoAsync(muxer) // using co-routines
       }
   }

If you comment on one of the two calls it will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants