swscaler警告:已弃用像素格式 [英] swscaler warning : deprecated pixel format used

查看:1486
本文介绍了swscaler警告:已弃用像素格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在使用以下代码将视频帧转换为opengl纹理之前执行色彩空间转换:

I want to perform a color space conversion of my video frame before converting it to an opengl texture with the following code:

struct SwsContext * pSwsCtx = sws_getCachedContext(NULL,width, height, codec->pix_fmt, width, height, AV_PIX_FMT_RGBA, SWS_POINT, NULL, NULL, NULL);

每次调用 sws_getCachedContext()函数时,我收到以下警告:

Each time the sws_getCachedContext() function is called I got the following warning:

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

这是我的版本信息的 ffmpeg 输出:

Here is my ffmpeg output for version information:

ffmpeg version 2.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar 26 2014 15:29:01 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libavresample   1.  2.  0 /  1.  2.  0
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Hyper fast Audio and Video encoder

任何想法来禁用此警告?如何正确设置颜色范围?

Any idea to disable this warning? How to set the color range correctly?

推荐答案

看来您正在尝试阅读 AV_PIX_FMT_YUVJXXXP 不建议使用的框架(请参阅 libav doc ) 。您可以使用此解决方法来管理它:

It seems you're trying to read AV_PIX_FMT_YUVJXXXP frames which are deprecated (see the libav doc). You can use this workaround to manage it :

AVPixelFormat pixFormat;
switch (_videoStream->codec->pix_fmt) {
case AV_PIX_FMT_YUVJ420P :
    pixFormat = AV_PIX_FMT_YUV420P;
    break;
case AV_PIX_FMT_YUVJ422P  :
    pixFormat = AV_PIX_FMT_YUV422P;
    break;
case AV_PIX_FMT_YUVJ444P   :
    pixFormat = AV_PIX_FMT_YUV444P;
    break;
case AV_PIX_FMT_YUVJ440P :
    pixFormat = AV_PIX_FMT_YUV440P;
default:
    pixFormat = _videoStream->codec->codec->pix_fmts;
    break;
}

这篇关于swscaler警告:已弃用像素格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆