调用configure时出现Android MediaCodec错误
我正在尝试将JPEG帧转换为MP4视频,但在调用调用configure时出现Android MediaCodec错误,android,arrays,jpeg,mp4,android-mediacodec,Android,Arrays,Jpeg,Mp4,Android Mediacodec,我正在尝试将JPEG帧转换为MP4视频,但在调用MediaCodec对象上的configure时,我在Logcat上显示了此错误/警告: E/Codec2Client: createComponent(c2.android.avc.encoder) -- call failed: NOT_FOUND. 应用程序没有崩溃,我还可以调用MediaCodec对象上的start。。。我已从中检查了MediaFormat的所有必需键 我真的不明白我为什么会有这个错误,谢谢你的帮助 // JPEG enc
MediaCodec
对象上的configure
时,我在Logcat
上显示了此错误/警告:
E/Codec2Client: createComponent(c2.android.avc.encoder) -- call failed: NOT_FOUND.
应用程序没有崩溃,我还可以调用MediaCodec
对象上的start
。。。我已从中检查了MediaFormat的所有必需键
我真的不明白我为什么会有这个错误,谢谢你的帮助
// JPEG encoder only support this colorFormat as Input
// COLOR_FormatCbYCrY a.k.a Organized as 16bit UYVY
int colorFormat = MediaCodecInfo.CodecCapabilities.COLOR_FormatCbYCrY;
MediaFormat videoFormat = MediaFormat.createVideoFormat(MIME_TYPE, mWidth, mHeight);
// Set some properties. Failing to specify some of these can cause the MediaCodec
// configure() call to throw an unhelpful exception.
videoFormat.setInteger(MediaFormat.KEY_WIDTH, mWidth);
videoFormat.setInteger(MediaFormat.KEY_HEIGHT, mHeight);
videoFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, colorFormat);
videoFormat.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE);
videoFormat.setInteger(MediaFormat.KEY_FRAME_RATE, mFrameRate);
videoFormat.setInteger(MediaFormat.KEY_CAPTURE_RATE, mFrameRate);
videoFormat.setInteger(MediaFormat.KEY_DURATION, mDuration_us);
videoFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, IFRAME_INTERVAL);
// Create a MediaCodec for the desired codec, then configure it as an encoder with
// our desired properties.
String codecName = codec.getName();
MediaCodec encoder = MediaCodec.createByCodecName(codecName);
encoder.configure(videoFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
错误与不支持的颜色格式有关