Android MediaCodec configure error, crash
Asked Answered
M

2

5

I'm trying to use mediaCodec for creating mp4 video from openGl ES surface. I have an eglSurface, and the source surface of that eglSurface is MediaCodec input surface.

I can have different sizes for eglSurface, and when one size (width or height) too big: for example width = 5000 and height = 512, MediaCodec crashed.

this is a crash log

android.media.MediaCodec$CodecException: Error 0xfffffc0e 
at android.media.MediaCodec.native_configure(Native Method) 
at android.media.MediaCodec.configure(MediaCodec.java:588)

....

On some devices (Galaxy s7 edge) it doesn't crashes but after generation videoView doesn't play the video.

For small sizes(for example with screen size) it work correct on all devices

Moorwort answered 29/9, 2016 at 16:45 Comment(0)
R
6

The width of your texture is too big. AFAIK, the maximum texture size is 4096x4096. And it can be lower than that depending on devices.

Check this answer: https://mcmap.net/q/764251/-how-can-i-find-the-maximum-texture-size-for-different-phones

Resurrectionism answered 29/9, 2016 at 17:7 Comment(2)
Thank you. One more question. Does mediaCodec support odd number of width and height?Moorwort
Seems like doesn't support.Marylnmarylou
M
2

It seems like odd width or height isn't supported. To avoid Error 0xfffffc0e on Xiaomi Redme 7 device I have been forced to do this:

DisplayMetrics metrics = getResources().getDisplayMetrics();
int width = (metrics.widthPixels / 2) * 2;   
int height = (metrics.heightPixels / 2) * 2;
Marylnmarylou answered 14/12, 2019 at 3:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.