Skip to content

将yuv转bitmap后,是黑白的并且有大面积的绿色和紫色 #3

@leestars

Description

@leestars

int width = mpeg.get(FFMpeg.KEY_WIDTH);
int height = mpeg.get(FFMpeg.KEY_HEIGHT);
data = new byte[widthheight3/2];
mpeg.output(data);
ByteArrayOutputStream out = new ByteArrayOutputStream();
YuvImage yuv = new YuvImage(data, ImageFormat.NV21, width, height, null);
yuv.compressToJpeg(new Rect(0, 0, width, height), 50, out);
byte[] bytes = out.toByteArray();
Bitmap bitmap= BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
mImageView.setImageBitmap(bitmap);

调用output方法所得到的数据是不是就是yuv数据?
@doggycoder

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions