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

Vevina ·
更新时间:2024-11-13
· 743 次阅读

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 E..V.... Set the encoding preset (cf. x264 --fullhelp) (default "medium") -tune E..V.... Tune the encoding params (cf. x264 --fullhelp) -profile E..V.... Set profile restrictions (cf. x264 --fullhelp) -fastfirstpass E..V.... Use fast settings when encoding first pass (from 0 to 1) (default 1) -level E..V.... Specify level (as defined by Annex A) -passlogfile E..V.... Filename for 2 pass stats -wpredp E..V.... Weighted prediction for P-frames -x264opts E..V.... x264 options -crf E..V.... Select the quality for constant quality mode (from -1 to FLT_MAX) (default -1) -crf_max E..V.... In CRF mode, prevents VBV from lowering quality beyond this point. (from -1 to FLT_MAX) (default -1) -qp E..V.... Constant quantization parameter rate control method (from -1 to INT_MAX) (default -1) -aq-mode 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 E..V.... AQ strength. Reduces blocking and blurring in flat and textured areas. (from -1 to FLT_MAX) (default -1) -psy E..V.... Use psychovisual optimizations. (from -1 to 1) (default -1) -psy-rd E..V.... Strength of psychovisual optimization, in : format. -rc-lookahead E..V.... Number of frames to look ahead for frametype and ratecontrol (from -1 to INT_MAX) (default -1) -weightb E..V.... Weighted prediction for B-frames. (from -1 to 1) (default -1) -weightp E..V.... Weighted prediction analysis method. (from -1 to INT_MAX) (default -1) none E..V.... simple E..V.... smart E..V.... -ssim E..V.... Calculate and print SSIM stats. (from -1 to 1) (default -1) -intra-refresh E..V.... Use Periodic Intra Refresh instead of IDR frames. (from -1 to 1) (default -1) -bluray-compat E..V.... Bluray compatibility workarounds. (from -1 to 1) (default -1) -b-bias E..V.... Influences how often B-frames are used (from INT_MIN to INT_MAX) (default INT_MIN) -b-pyramid 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 E..V.... One reference per partition, as opposed to one reference per macroblock (from -1 to 1) (default -1) -8x8dct E..V.... High profile 8x8 transform. (from -1 to 1) (default -1) -fast-pskip E..V.... (from -1 to 1) (default -1) -aud E..V.... Use access unit delimiters. (from -1 to 1) (default -1) -mbtree E..V.... Use macroblock tree ratecontrol. (from -1 to 1) (default -1) -deblock E..V.... Loop filter parameters, in form. -cplxblur E..V.... Reduce fluctuations in QP (before curve compression) (from -1 to FLT_MAX) (default -1) -partitions E..V.... A comma-separated list of partitions to consider. Possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all -direct-pred 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 E..V.... Limit the size of each slice in bytes (from -1 to INT_MAX) (default -1) -stats E..V.... Filename for 2 pass stats -nal-hrd 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 E..V.... AVC-Intra class 50/100/200 (from -1 to 200) (default -1) -motion-est 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 E..V.... If forcing keyframes, force them as IDR frames. (from -1 to 1) (default -1) -x264-params E..V.... Override the x264 configuration using a :-separated list of key=value parameters
作者:郭老二



fmt ffmpeg 像素

需要 登录 后方可回复, 如果你还没有账号请 注册新账号