Tag Archives: [swscaler @ …] deprecated pixel format used, make sure you did set range correctly

[swscaler @ …] deprecated pixel format used, make sure you did set range correctly

Explain the function of static keyword and final keyword in Java in detail>>>

My own mistake in using the following function for conversion

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[]);

Answers to online search:

https://stackoverflow.com/questions/23067722/swscaler-warning-deprecated-pixel-format-used

The reason is that the format you use has been abolished. You can see which ones are not available in the following links:

https://libav.org/documentation/doxygen/master/pixfmt_ 8h.html#a9a8e335cf3be472042bc9f0cf80cd4c5。

The conversion function I wrote:

AVPixelFormat ConvertDeprecatedFormat(enum AVPixelFormat format)
{
    switch (format)
    {
    case AV_PIX_FMT_YUVJ420P:
        return AV_PIX_FMT_YUV420P;
        break;
    case AV_PIX_FMT_YUVJ422P:
        return AV_PIX_FMT_YUV422P;
        break;
    case AV_PIX_FMT_YUVJ444P:
        return AV_PIX_FMT_YUV444P;
        break;
    case AV_PIX_FMT_YUVJ440P:
        return AV_PIX_FMT_YUV440P;
        break;
    default:
        return format;
        break;
    }
}

If you want to use a new format type and set the color range, you have not yet made clear the concept of color range. I will add it later and write it down first