Generally, the video data directly collected is in rgb24 format. The size of a rgb24 frame is size = width × heigth × 3 bit, and the size of rgb32 is width × heigth × 4, for i420 (that is, the YUV standard format), the data volume is size = width × heigth × 1. 5 bit. After rgb24 data is collected, the data in this format needs to be compressed for the first time. The color space of the image is determined by rgb2yuv. Because the standard YUV () is required for x264 encoding ). However, it should be noted that although yv12 is also (), yv12 and i420 are different, and there are some differences in the storage space. As follows: Yv12: brightness (row x column) + U (row x column/4) + V (row x column/4) I420: brightness (row x column) + V (row x column/4) + U (row x column/4) It can be seen that yv12 and i420 are basically the same, that is, the UV sequence is different. Continue to our topic. After the first data compression, rgb24-> YUV (i420 ). In this way, the data volume will be halved. Why? Well, this is too basic, and I will not write more. Similarly, if it is rgb24-> YUV (yv12), it is also halved. However, although both are half, if yv12 is used, the effect will be greatly reduced. Then, the data size will be greatly reduced after the x264 encoding. The encoded data is packaged and transmitted in real time through RTP. After arriving at the destination, extract and decode the data. After decoding, the data is still in YUV format. Therefore, a conversion is required so that the windows driver can process the data, that is, yuv2rgb24. Yuy2 is [y0 U0 Y1 V0] |