【FFmpeg】编码h.264时,支持的像素格式pix_fmt

1、简述

使用FFmpeg对视频编码时,编码器格式AVCodecContext—>pix_fmt(类型 enum AVPixelFormat)不是什么格式都支持的。首先x264只支持YUV格式,不支持RGB格式。

2、像素格式列表

在FFmpeg(版本4.1)中编码h.264时,支持的像素格式pix_fmt列表如下:

AV_PIX_FMT_YUV420P、
AV_PIX_FMT_YUVJ420P、
AV_PIX_FMT_YUV422P、
AV_PIX_FMT_YUVJ422P、
AV_PIX_FMT_YUV444P、
AV_PIX_FMT_YUVJ444P、
AV_PIX_FMT_NV12、
AV_PIX_FMT_NV16、
AV_PIX_FMT_NV21
3、查看方法

执行命令:

	ffmpeg -h encoder=libx264

在打印信息中可以看到支持的像素格式:

Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21
4、完整打印信息如下
$ ffmpeg -h encoder=libx264
ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Encoder libx264 [libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]:
    Threading capabilities: no
    Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21
libx264 AVOptions:
  -preset            <string>     E..V.... Set the encoding preset (cf. x264 --fullhelp) (default "medium")
  -tune              <string>     E..V.... Tune the encoding params (cf. x264 --fullhelp)
  -profile           <string>     E..V.... Set profile restrictions (cf. x264 --fullhelp) 
  -fastfirstpass     <int>        E..V.... Use fast settings when encoding first pass (from 0 to 1) (default 1)
  -level             <string>     E..V.... Specify level (as defined by Annex A)
  -passlogfile       <string>     E..V.... Filename for 2 pass stats
  -wpredp            <string>     E..V.... Weighted prediction for P-frames
  -x264opts          <string>     E..V.... x264 options
  -crf               <float>      E..V.... Select the quality for constant quality mode (from -1 to FLT_MAX) (default -1)
  -crf_max           <float>      E..V.... In CRF mode, prevents VBV from lowering quality beyond this point. (from -1 to FLT_MAX) (default -1)
  -qp                <int>        E..V.... Constant quantization parameter rate control method (from -1 to INT_MAX) (default -1)
  -aq-mode           <int>        E..V.... AQ method (from -1 to INT_MAX) (default -1)
     none                         E..V....
     variance                     E..V.... Variance AQ (complexity mask)
     autovariance                 E..V.... Auto-variance AQ
     autovariance-biased          E..V.... Auto-variance AQ with bias to dark scenes
  -aq-strength       <float>      E..V.... AQ strength. Reduces blocking and blurring in flat and textured areas. (from -1 to FLT_MAX) (default -1)
  -psy               <int>        E..V.... Use psychovisual optimizations. (from -1 to 1) (default -1)
  -psy-rd            <string>     E..V.... Strength of psychovisual optimization, in <psy-rd>:<psy-trellis> format.
  -rc-lookahead      <int>        E..V.... Number of frames to look ahead for frametype and ratecontrol (from -1 to INT_MAX) (default -1)
  -weightb           <int>        E..V.... Weighted prediction for B-frames. (from -1 to 1) (default -1)
  -weightp           <int>        E..V.... Weighted prediction analysis method. (from -1 to INT_MAX) (default -1)
     none                         E..V....
     simple                       E..V....
     smart                        E..V....
  -ssim              <int>        E..V.... Calculate and print SSIM stats. (from -1 to 1) (default -1)
  -intra-refresh     <int>        E..V.... Use Periodic Intra Refresh instead of IDR frames. (from -1 to 1) (default -1)
  -bluray-compat     <int>        E..V.... Bluray compatibility workarounds. (from -1 to 1) (default -1)
  -b-bias            <int>        E..V.... Influences how often B-frames are used (from INT_MIN to INT_MAX) (default INT_MIN)
  -b-pyramid         <int>        E..V.... Keep some B-frames as references. (from -1 to INT_MAX) (default -1)
     none                         E..V....
     strict                       E..V.... Strictly hierarchical pyramid
     normal                       E..V.... Non-strict (not Blu-ray compatible)
  -mixed-refs        <int>        E..V.... One reference per partition, as opposed to one reference per macroblock (from -1 to 1) (default -1)
  -8x8dct            <int>        E..V.... High profile 8x8 transform. (from -1 to 1) (default -1)
  -fast-pskip        <int>        E..V.... (from -1 to 1) (default -1)
  -aud               <int>        E..V.... Use access unit delimiters. (from -1 to 1) (default -1)
  -mbtree            <int>        E..V.... Use macroblock tree ratecontrol. (from -1 to 1) (default -1)
  -deblock           <string>     E..V.... Loop filter parameters, in <alpha:beta> form.
  -cplxblur          <float>      E..V.... Reduce fluctuations in QP (before curve compression) (from -1 to FLT_MAX) (default -1)
  -partitions        <string>     E..V.... A comma-separated list of partitions to consider. Possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all
  -direct-pred       <int>        E..V.... Direct MV prediction mode (from -1 to INT_MAX) (default -1)
     none                         E..V....
     spatial                      E..V....
     temporal                     E..V....
     auto                         E..V....
  -slice-max-size    <int>        E..V.... Limit the size of each slice in bytes (from -1 to INT_MAX) (default -1)
  -stats             <string>     E..V.... Filename for 2 pass stats
  -nal-hrd           <int>        E..V.... Signal HRD information (requires vbv-bufsize; cbr not allowed in .mp4) (from -1 to INT_MAX) (default -1)
     none                         E..V....
     vbr                          E..V....
     cbr                          E..V....
  -avcintra-class    <int>        E..V.... AVC-Intra class 50/100/200 (from -1 to 200) (default -1)
  -motion-est        <int>        E..V.... Set motion estimation method (from -1 to 4) (default -1)
     dia                          E..V....
     hex                          E..V....
     umh                          E..V....
     esa                          E..V....
     tesa                         E..V....
  -forced-idr        <int>        E..V.... If forcing keyframes, force them as IDR frames. (from -1 to 1) (default -1)
  -x264-params       <string>     E..V.... Override the x264 configuration using a :-separated list of key=value parameters
发布了324 篇原创文章 · 获赞 266 · 访问量 42万+

猜你喜欢

转载自blog.csdn.net/u010168781/article/details/105540874