Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bitrate missing in MediaFormat (Nexus 5 - Android 6.0.1)Β #15

Closed
@carlosmonzon

Description

@carlosmonzon

Hi πŸ‘‹ ,

I've got this exception while testing with a Nexus 5 (Android 6.0.1)

E/Transcoder: Fatal error while transcoding, this might be invalid format or bug in engine or Android. java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference at android.media.MediaFormat.getInteger(MediaFormat.java:591) at com.otaliastudios.transcoder.strategy.DefaultAudioStrategy.getAverageInputBitRate(DefaultAudioStrategy.java:66) at com.otaliastudios.transcoder.strategy.DefaultAudioStrategy.createOutputFormat(DefaultAudioStrategy.java:39) at com.otaliastudios.transcoder.engine.Engine.computeTrackStatus(Engine.java:128) at com.otaliastudios.transcoder.engine.Engine.transcode(Engine.java:309) at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:121) at com.otaliastudios.transcoder.Transcoder$1.call(Transcoder.java:111) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)

I had the chance to debug it and I found that the mediaformat map doesn't have any bitrate key, which is causing the issue. I tested with another device and everything is good. Can we have a default bitrate in this case?

mediaformat map:

"max-input-size" -> {Integer@4429} 355
"aac-profile" -> {Integer@4431} 2
"mime" -> "audio/mp4a-latm"
"durationUs" -> {Long@4435} 43733333
"csd-0" -> {ByteArrayBuffer@4437} "java.nio.ByteArrayBuffer[position=0,limit=2,capacity=2]"
"channel-count" -> {Integer@4439} 1
"sample-rate" -> {Integer@4441} 48000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions