Android MediaCodec 配置错误,崩溃

Lev*_*yan 5 android surface opengl-es-2.0 egl android-mediacodec

我正在尝试使用 mediaCodec 从 openGl ES 表面创建 mp4 视频。我有一个eglSurface,该eglSurface 的源表面是MediaCodec 输入表面。

我可以为eglSurface 设置不同的尺寸,当一种尺寸(宽度或高度)太大时:例如宽度= 5000 且高度= 512,MediaCodec 崩溃。

这是崩溃日志

android.media.MediaCodec$CodecException: Error 0xfffffc0e 
at android.media.MediaCodec.native_configure(Native Method) 
at android.media.MediaCodec.configure(MediaCodec.java:588)
Run Code Online (Sandbox Code Playgroud)

....

在某些设备(Galaxy s7 edge)上它不会崩溃,但生成 videoView 后不会播放视频。

对于小尺寸(例如屏幕尺寸),它可以在所有设备上正常工作

nex*_*s5x 6

您的纹理的宽度太大。据我所知,最大纹理尺寸为 4096x4096。根据设备的不同,它可能会低于该值。

检查这个答案: https ://stackoverflow.com/a/4528043/1353758