FFmpeg deprecated pixel format used問題描述

場景
        在指定編碼格式優化點播的時候,指定像素格式 pFormatContext->streams[video_index]->codecpar->format = AV_PIX_FMT_YUVJ420P;
根聽說法deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range,AV_PIX_FMT_YUV420P取代AV_PIX_FMT_YUV420P和設置顏色空間ide


int format;函數

    /**優化

     * - video: the pixel format, the value corresponds to enum AVPixelFormat.
     * - audio: the sample format, the value corresponds to enum AVSampleFormat.
     */
    

編碼


函數調用邏輯
spa

av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, SwsFilter *dstFilter)
            av_log(c, AV_LOG_WARNING, "deprecated pixel format used, make sure you did set range correctly\n");    code

區別orm

AV_PIX_FMT_YUVJ420P和AV_PIX_FMT_YUV420P二者的不一樣在於,顏色空間不一樣。
AVCOL_RANGE_JPEGci

/**
* MPEG vs JPEG YUV range.
*/
enum AVColorRange {
 AVCOL_RANGE_UNSPECIFIED = 0,
 AVCOL_RANGE_MPEG        = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges
 AVCOL_RANGE_JPEG        = 2, ///< the normal     2^n-1   "JPEG" YUV ranges
 AVCOL_RANGE_NB,              ///< Not part of ABI
};it

YUVJ420P的字面含義是「使用了JPEG顏色範圍的YUV420P,像素使用表示顏色的數值範圍發生了變化。io

YUV420p的像素顏色範圍是[16,235],16表示黑色,235表示白色
YUVJ420P的像素顏色範圍是[0,255]。0表示黑色,255表示白色

宏定義enum AVPixelFormat {    AV_PIX_FMT_NONE = -1,    AV_PIX_FMT_YUV420P,   ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)    AV_PIX_FMT_YUYV422,   ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr    AV_PIX_FMT_RGB24,     ///< packed RGB 8:8:8, 24bpp, RGBRGB...    AV_PIX_FMT_BGR24,     ///< packed RGB 8:8:8, 24bpp, BGRBGR...    AV_PIX_FMT_YUV422P,   ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)    AV_PIX_FMT_YUV444P,   ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)    AV_PIX_FMT_YUV410P,   ///< planar YUV 4:1:0,  9bpp, (1 Cr & Cb sample per 4x4 Y samples)    AV_PIX_FMT_YUV411P,   ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)    AV_PIX_FMT_GRAY8,     ///<        Y        ,  8bpp    AV_PIX_FMT_MONOWHITE, ///<        Y        ,  1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb    AV_PIX_FMT_MONOBLACK, ///<        Y        ,  1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb    AV_PIX_FMT_PAL8,      ///< 8 bits with AV_PIX_FMT_RGB32 palette    AV_PIX_FMT_YUVJ420P,  ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range    AV_PIX_FMT_YUVJ422P,  ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range    AV_PIX_FMT_YUVJ444P,  ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range#if FF_API_XVMC    AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing....}

相關文章
相關標籤/搜索