🎞 Hardware-accelerated video transcoding using Android MediaCodec APIs. Supports cropping, concatenation, clipping, audio processing, video speed and much more.
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()
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
How to reproduce:
This is how I configure the transcoder. The code is run in a
Fragment
. Theuri
is theURI
for the .mov file usingIntent(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI)
.Here is a .mov file that can reproduce this exception. https://user-images.githubusercontent.com/6929825/134858181-c9810bda-17dd-4d2a-95de-350221a71e8f.MOV