0

我想从网络摄像头转换视频流。该视频流称为 HDYC。我觉得这有点特别,所以我现在没有控制。

我的问题是如何使用 ffmpeg 在 C++ 中将该格式转换为 rgb?但有一些限制。我不想做一个文件。换句话说,它需要转换来自网络摄像头的视频流。也是实时操作。

谢谢。

4

1 回答 1

0

我不知道你为什么用标记它,因为它是像素格式、布局和二次采样HDYC的一种风格,只是用ITU-R Rec. 709定义的色彩空间。UYVY

所以您的问题是如何使用 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);
于 2013-06-23T16:15:42.610 回答