Closed hzhh110 closed 1 year ago
The data I obtained is in AV_PIX_FMT_YUVJ422P format, how to convert it to YUV?
static void YUV420PPackages(uint8_t yuv420, uint8_t y_ptr, uint8_t u_ptr, uint8_t v_ptr, int width, int height) { int yLen = width height; int uvLen = width / 2 height / 2; memcpy((unsigned char )yuv420, y_ptr, yLen); memcpy((unsigned char )yuv420 + yLen, u_ptr, uvLen); memcpy((unsigned char *)yuv420+yLen+uvLen, v_ptr, uvLen); } YUV420PPackages(buf, pVideoFrame->data[0], pVideoFrame->data[1], pVideoFrame->data[2], pCodecCtx->width, pCodecCtx->height);
Use swscale to convert colorspace, from YUVJ422P to YUV420P, or anything else
The data I obtained is in AV_PIX_FMT_YUVJ422P format, how to convert it to YUV?
static void YUV420PPackages(uint8_t yuv420, uint8_t y_ptr, uint8_t u_ptr, uint8_t v_ptr, int width, int height) { int yLen = width height; int uvLen = width / 2 height / 2; memcpy((unsigned char )yuv420, y_ptr, yLen); memcpy((unsigned char )yuv420 + yLen, u_ptr, uvLen); memcpy((unsigned char *)yuv420+yLen+uvLen, v_ptr, uvLen); } YUV420PPackages(buf, pVideoFrame->data[0], pVideoFrame->data[1], pVideoFrame->data[2], pCodecCtx->width, pCodecCtx->height);