Summary of YUV420 (YU12, YV12, NV12 and NV21)

tags: audio and video  YUV420  NV12  ffmpeg

The YUV model defines a color space based on one brightness (Y component) and two chromaticities (UV components). The most common format is YUV420, which is divided into two types: YUV420P and YUV420SP.

YUV420P

YUV420P is the plane plane mode, and the Y, U, and V components are in different planes, that is, the data is stored in 3 arrays in ffmpeg.
It can be subdivided into YU12 and YV12.

YU12

The data distribution of this format is shown in the figure below. Y data is stored in data[0], U data is stored in data[1], and V data is stored in data[2].
Among them, Y, U, and V with the same color are a set of data, such as Y1, Y2, Y3, and Y4 share a set of U1 and V1.

YV12

The data distribution of this format is shown in the figure below. Y data is stored in data[0], V data is stored in data[1], and U data is stored in data[2].

YUV420SP

YUV420SP is a semi-planar mode, that is, Y and UV are divided into two planes, but UV (CbCr) is interleaved instead of divided into three planes. That is, data is stored in 2 arrays in ffmpeg.
It can be subdivided into NV12 and NV21.

NV12

The data distribution of this format is shown in the figure below. Y data is stored in data[0], and U and V data are stored in data[1].

NV21

The data distribution of this format is shown in the figure below. Y data is stored in data[0], and U and V data are stored in data[1].

real data storage

When actually storing data, in order to facilitate calculation, the data is often aligned, so the real data is stored as shown in the figure below.
Take YU12 as an example, other formats are similar.

references:


Intelligent Recommendation

YUV format learning: YUV420P, YV12, NV12, NV21 format Convert to RGB24

The YUV420 has a package, as described above. At the same time, there is a planar format, that is, Y, U, V is separately stored, each component accounts for a place, where Y is width * height, and hal...

Derivation of YUV420 (NV21 or NV12) image rotation at any angle

1. Coordinate rotation: Suppose I want to rotate the angle b along the center of the image M, then I need to move the center of the image M to coincide with the center of the coordinate axis (otherwis...

Image basis: read BMP pictures, convert them to RGB and YU12 (YUV420P) formats, and convert between YU12, NV12, and NV21 at the same time

BMP to RGB RGB to YU12 (YUV420P) YU12 to NV12 YU12 to NV21 NV12 to YU12 NV21 to YU12 Download link of complete project code: Upload later...

#YUV420 NV12

demoAVCaptureSessionNeed to modify the path plus/, adjust the path The obtained h264 isAVCCFormatted, cannot be used by VLC clientsRTSPPlay in mode, but can play locally. So looking for a breakthrough...

NV12 and NV21 to rgb

The above is NV21 to rgb, then how to write NV12 to rgb? Very simple, you can exchange the u and v code....

More Recommendation

CUDA YV12 / NV12 Convert to RGB24

First, YV12 format description Second, NV12 format description   Third, YUV420 format list Fourth, NV12 turn RGB24 Kenergy function implementation Reference: NV12 format turn RGB's CUDA implement...

YV12 to ARGB and NV21 to ARGB in jni

Note that the ">>" and "<<" shift operators have lower priority than addition and subtraction;...

Android video recording of NV21 and NV12

The data data callback from the callback method onPreviewFrame(byte[] data, Camera camera) of the Camera.PreviewCallback interface is NV21 image data, and the Android phone recognizes NV12 image data,...

Graphical YV12 and NV12 and I420 chroma sampling formats

### Date: 2017/5/25 ### Author: Soaringlee I420:YUV420p, the planar format, is stored in three independent arrays in the memory, first the Y array, then the U array, and finally the V array. The physi...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top