Jerikc XIONG
Jerikc XIONG

Reputation: 3607

How do i know the YUV format from android camera onPreviewFrame?

I want to know the yuv data format from onPreviewFrame. As we know, we can set the parameter.setPreviewFormat(ImageFormat.NV21) before startPreview. After setting that, is the format from onPreviewFrame NV21 ? Is that suitable for all android phone?

Upvotes: 1

Views: 2316

Answers (1)

silvaren
silvaren

Reputation: 730

After setting parameter.setPreviewFormat(ImageFormat.NV21) the format in onPreviewFrame will be NV21 as it is supported in all devices (YV12 is also supported in all devices, according to the documentation ). Also, NV21 is the default if you don't set it.

In case you are not sure which preview format is the current one you can query the camera parameters with parameter.getPreviewFormat() .

Upvotes: 1

Related Questions