sannies / mp4parser

A Java API to read, write and create MP4 files
Apache License 2.0
2.76k stars 566 forks source link

IllegalStateException in huawei Mate 9 #290

Open TMACys opened 6 years ago

TMACys commented 6 years ago

When I used the huawei phone for video compression, the following code went awry and captured the illegalStateException

encoder = MediaCodec.createEncoderByType(MIME_TYPE); encoder.configure(outputFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); if (Build.VERSION.SDK_INT >= 18) { inputSurface = new InputSurface(encoder.createInputSurface()); inputSurface.makeCurrent(); } encoder.start();// Errors occur in this line

logcat

android.media.MediaCodec$CodecException: start failed 11-14 16:49:00.830 3001-3226/net.ezbim.ebim.enterprise W/System.err: at android.media.MediaCodec.native_start(Native Method) 11-14 16:49:00.830 3001-3226/net.ezbim.ebim.enterprise W/System.err: at android.media.MediaCodec.start(MediaCodec.java:2016) 11-14 16:49:07.287 3001-3226/net.ezbim.ebim.enterprise W/System.err: at android.media.MediaCodec.native_stop(Native Method) 11-14 16:49:07.287 3001-3226/net.ezbim.ebim.enterprise W/System.err: at android.media.MediaCodec.stop(MediaCodec.java:2032)

tulioccalazans commented 6 years ago

I'm having trobles with Mate9 and MediaCodec. I think that is something related to KEY_BIT_RATE or VIDEO SIZE values. Change these values and try again. Maybe you need a special treatment for greater video size.