deepmedia / Transcoder

🎞 Hardware-accelerated video transcoding using Android MediaCodec APIs. Supports cropping, concatenation, clipping, audio processing, video speed and much more.
https://opensource.deepmedia.io/transcoder
Apache License 2.0
783 stars 166 forks source link

IllegalArgumentException: Failed requirement when transcoding a .mov file in version 0.10.4 #153

Closed lancer1268 closed 2 months ago

lancer1268 commented 3 years ago

An exception occurs when transcoding a .mov video on my Pixel 4a with Android 10. This exception occurs in version 0.10.4. However, the transcoder runs successfully using version 0.9.1. This might be related to issue #144.

Logcat

E/TranscodeEngine: Unexpected error while transcoding.
    java.lang.IllegalArgumentException: Failed requirement.
        at com.otaliastudios.transcoder.internal.audio.ChunkQueue.enqueue(chunks.kt:28)
        at com.otaliastudios.transcoder.internal.audio.AudioEngine.enqueue(AudioEngine.kt:59)
        at com.otaliastudios.transcoder.internal.audio.AudioEngine.enqueue(AudioEngine.kt:21)
        at com.otaliastudios.transcoder.internal.pipeline.QueuedStep.step(steps.kt:40)
        at com.otaliastudios.transcoder.internal.pipeline.Pipeline.executeStep(Pipeline.kt:51)
        at com.otaliastudios.transcoder.internal.pipeline.Pipeline.execute(Pipeline.kt:28)
        at com.otaliastudios.transcoder.internal.Segment.advance(Segment.kt:18)
        at com.otaliastudios.transcoder.internal.transcode.DefaultTranscodeEngine.transcode(DefaultTranscodeEngine.kt:114)
        at com.otaliastudios.transcoder.internal.transcode.TranscodeEngine$Companion.transcode(TranscodeEngine.kt:48)
        at com.otaliastudios.transcoder.internal.transcode.TranscodeEngine.transcode(Unknown Source:2)
        at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:102)
        at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:99)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)

How to reproduce:

This is how I configure the transcoder. The code is run in a Fragment. The uri is the URI for the .mov file using Intent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI).

val outputFile = File.createTempFile("transcode_", ".mp4", requireContext().cacheDir)
Transcoder.into(outputFile.path)
    .addDataSource(requireContext(), uri)
    .setListener(object : TranscoderListener {
        override fun onTranscodeProgress(progress: Double) = Unit
        override fun onTranscodeCompleted(successCode: Int) = Unit
        override fun onTranscodeCanceled() = Unit
        override fun onTranscodeFailed(exception: Throwable) = Unit
    })
    .transcode()

Here is a .mov file that can reproduce this exception. https://user-images.githubusercontent.com/6929825/134858181-c9810bda-17dd-4d2a-95de-350221a71e8f.MOV

jumperson commented 2 years ago

I am also getting the same issue. I fixed by #158.

huanguolin commented 2 years ago

same issue.

binlebin commented 2 years ago

I have the same issue, anyone can help?

natario1 commented 2 months ago

Should be fixed in latest versions.