0

I set ImageFormat.NV21 as the Camera preview format before startPreview.

camParams.setPreviewFormat(ImageFormat.NV21);

I need to convert the NV21 preview data to I420 by libyuv, and then encode the I420 data.

if (ret = ConvertToI420(p_ctx->p_src->p_yuv_data, p_ctx->p_src->size,
                  pDstY, p_ctx->src_width,
                  pDstU, (p_ctx->src_width + 1) >> 1,
                  pDstV, (p_ctx->src_width + 1) >> 1,
                  0, 0,
                  p_ctx->src_width, p_ctx->src_height,
                  p_ctx->dst_width, p_ctx->dst_height,
                  0,
                  FOURCC_NV21)) {

      LOGE("ConvertToI420 error, ret=%d", ret);
}

Here, the related information is:

convert dst_width=480, dst_height=854, src_width=854, src_height=480

The camera orientation of CameraInfo is 90.

The output as following:

enter image description here

How to fix it? What did i miss?

Jerikc XIONG
  • 3,517
  • 5
  • 42
  • 71

0 Answers0