Parth
Parth

Reputation: 137

Get Raw data from org.bytedeco.javacv.Frame

I want to get raw data from javacv Frame.

I am using FFmpegFrmaeFilter to rotate Android camera preview. So, I am pulling Frame from the FFmpegFrameFilter and then provides converted byte[] to MediaCodec.

But, while doing so, I am getting wrong data(green picture).I am taking raw data from Frame.Image[0].array();

Is there any other way for fetching raw data from Frame which I can feed to Mediacodec.

Upvotes: 0

Views: 1191

Answers (1)

Alex Cohn
Alex Cohn

Reputation: 57163

Green picture most likely means that you pass zeros for chroma components of the image. Android camera usually produces YUV 420 images, where you have width*height array of luminance (Y) followed by U and V, width/2*height/2 each.

FFmpegFrameFilter understands different frame formats, but this depends also on some heuristics that derives the input pixel format from Frame parameters.

MediaCodec can receive frames in flexible YUV 420 format, but it is your responsibility to set up the Image correctly.

Upvotes: 1

Related Questions