0

I converted nv21 frame to i420 frame with libyuv, and then encode the frame into a video file with mediacodec, the video looks strange. I use COLOR_FormatYUV420SemiPlanar and COLOR_FormatYUV420Flexible color format.strange color

So, what color format should i use to encode i420 frame converted by libyuv.

boybeak
  • 417
  • 5
  • 19
  • Most likely, your source frame was not **nv21**. Do you get the image from cameraX API? – Alex Cohn May 11 '21 at 07:00
  • Because this is a SDK project, it requires minSdkVersion 19, so, cameraX is not suitable for this project. I get camera's color format by calling `camera.parameters.previewFormat`, it return 17 - **ImageFormat.NV21** – boybeak May 11 '21 at 07:20
  • The best example of using the old camera API and mediacodec is in [bigflake](https://bigflake.com/mediacodec/CameraToMpegTest.java.txt) – Alex Cohn May 11 '21 at 08:47
  • libyuv has methods to convert i420 to RGB and ARGB so you can try them – easy_breezy Jul 07 '21 at 14:35

0 Answers0