IYUV and I420
This format is the most popular YUV420 format. They comprise an NxN Y plane followed by (N/2)x(N/2) U and V planes. Full marks to Intel for registering the same format twice and full marks to Microsoft for not picking up on this and rejecting the second registration.
Horizontal Vertical Y Sample Period 1 1 U Sample Period 2 2 V Sample Period 2 2
Positive biHeight implies top-down image (top line first)
NV12
YUV 4:2:0 image with a plane of 8 bit Y samples followed by an interleaved U/V plane containing 8 bit 2x2 subsampled colour difference samples. It is called as XDM_YUV_420SP by TI XDM.
Horizontal | Vertical | |
Y Sample Period | 1 | 1 |
V (Cr) Sample Period | 2 | 2 |
U (Cb) Sample Period | 2 | 2 |
Microsoft defines this format as follows:
"A format in which all Y samples are found first in memory as an array of unsigned char with an even number of lines (possibly with a larger stride for memory alignment), followed immediately by an array of unsigned char containing interleaved Cb and Cr samples (such that if addressed as a little-endian WORD type, Cb would be in the LSBs and Cr would be in the MSBs) with the same total stride as the Y samples. This is the preferred 4:2:0 pixel format."
For conversion from yuv420 IYUV/I420 to yuv420 NV12 to make NV12 test clip, ffmpeg can be used as a IYUV2NV12 converter:
3 comments:
Hi,
Thanks for this post!
I've tried to use the ffmpeg convert to nv12,
I used carphone qcif sample:
http://trace.eas.asu.edu/yuv/
But the result seems wrong with any yuv player I've used (i remembered to change the setting for qcif 176x144, and NV12 but it did not help).
Is there something wrong with ffmpeg convert ?
Thanks,
Ran
this is the conversion command I've used:
ffmpeg -pix_fmt yuv420p -s 176x144 -i carphone_qcif.yuv -pix_fmt nv12 carphone_qcif_nv12.yuv
Is there any way we can achieve this without using ffmpeg? As in, by using openCV library?
Post a Comment