Java tutorial
//package com.java2s; public class Main { public static byte[] YV12toYUV420Planar(byte[] input, byte[] output, int width, int height) { /* * COLOR_FormatYUV420Planar is I420 which is like YV12, but with U and V reversed. * So we just have to reverse U and V. */ final int frameSize = width * height; final int qFrameSize = frameSize / 4; System.arraycopy(input, 0, output, 0, frameSize); // Y System.arraycopy(input, frameSize + qFrameSize, output, frameSize, qFrameSize); // Cb (U) System.arraycopy(input, frameSize, output, frameSize + qFrameSize, qFrameSize); // Cr (V) return output; } }