AVFrame data format

Viewed 218

I process the raw data from AVFrame.data. Pixel format of this frames is AV_PIX_FMT_YUV420P. I want to understand in what range of values is this data located.

Seems UV (in YUV scheme) must be in [-128, 128] range, CbCr (in YCbCr) must be in [0, 255]. What scheme used in FFmpeg?

1 Answers

All pixel component values in YUV and RGB formats in FFmpeg are unsigned. Depending on the particular format, the type may differ (int, float) and so may the bit depth.

For AV_PIX_FMT_YUV420P, the strict range is 16-235 for Y and 16-240 for U and V, usually called limited range. Mid-point for U and V is typically 128.

However, full range can also be encountered.

Related