[英]How to convert Live video stream from YUV(HDYC) to RGB
我想从网络摄像头转换视频流。 该视频流称为HDYC。 我认为这有点特别,所以我现在没有控制。
我的问题是如何使用ffmpeg在c ++中将该格式转换为rgb? 但是有一些限制。 我不想存档。 另外,它需要转换网络摄像头的视频流。 这也是实时操作。
谢谢。
我不确定为什么要用h.264对其进行标记,因为HDYC
只是UYVY
像素格式,布局和二次采样的一种,仅通过ITU-R Rec。 709定义的色彩空间。
因此,您的问题是如何使用FFmpeg将BT.709 YUV转换为RGB。 FFmpeg的libswscale可以做到这一点:其sws_scale
进行转换,而其sws_setColorspaceDetails
可为转换提供颜色空间详细信息。
/**
* Scale the image slice in srcSlice and put the resulting scaled
* slice in the image in dst. A slice is a sequence of consecutive
* rows in an image.
[...] */
int sws_scale(struct SwsContext *c, const uint8_t *const srcSlice[],
const int srcStride[], int srcSliceY, int srcSliceH,
uint8_t *const dst[], const int dstStride[]);
/**
[...]
* @param table the yuv2rgb coefficients describing the output yuv space, normally ff_yuv2rgb_coeffs[x]
[...] */
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
int srcRange, const int table[4], int dstRange,
int brightness, int contrast, int saturation);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.