Probably you're trying to use wrong encoder. Before starting encoder you should "probe" existing encoders using some kind of that:
HashMap<String, CodecCapabilities> mEncoderInfos;
void initEncoderInfos(){
for(int i = MediaCodecList.getCodecCount() - 1; i >= 0; i--){
MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
if(codecInfo.isEncoder()){
for(String t : codecInfo.getSupportedTypes()){
try{
mEncoderInfos.put(t, codecInfo.getCapabilitiesForType(t));
} catch(IllegalArgumentException e){
e.printStackTrace();
}
}
}
}
}
All info will be collected in mEncoderInfos. And after this you can use most suitable encoder.
In other words: you should not assume that some encoder("video/mp4v-es" in your case) does support some color format(MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV422PackedSemiPlanar in your case).