private byte[] I420ToNV21(byte[] input, int width, int height) {
byte[] output = new byte[4147200];
int frameSize = width * height;
int qFrameSize = frameSize / 4;
int tempFrameSize = frameSize * 5 / 4;
System.arraycopy(input, 0, output, 0, frameSize);
for(int i = 0; i < qFrameSize; ++i) {
output[frameSize + i * 2] = input[tempFrameSize + i];
output[frameSize + i * 2 + 1] = input[frameSize + i];
}
return output;
}