i420 转 nv21
private static byte[] I420ToNv21(byte[] i420bytes, int width, int height) { byte[] nv21bytes = new byte[i420bytes.length]; int y_len = width * height; int uv_len = y_len / 4; System.arraycopy(i420bytes, 0, nv21bytes, 0, y_len); for (int i =0; i < uv_len; i++) { byte u = i420bytes[y_len + i]; byte v = i420bytes[y_len + uv_len + i]; nv21bytes[y_len + i*2] = v; nv21bytes[y_len + i*2 +1] = u; } return nv21bytes; }