音视频开发32 FFmpeg 编码- 视频编码 h264 参数相关

1. ffmpeg -h 这个命令总不会忘记,用这个先将ffmpeg所有的help信息都list出来

C:\Users\Administrator>ffmpeg -h
ffmpeg version 6.0-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-shared --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Getting help:
    -h      -- print basic options
    -h long -- print more options
    -h full -- print all options (including all format and codec specific options, very long)
    -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol
    See man ffmpeg for detailed description of the options.

Print help / information / capabilities:
-L                  show license
-h topic            show help
-? topic            show help
-help topic         show help
--help topic        show help
-version            show version
-buildconf          show build configuration
-formats            show available formats
-muxers             show available muxers
-demuxers           show available demuxers
-devices            show available devices
-codecs             show available codecs
-decoders           show available decoders
-encoders           show available encoders
-bsfs               show available bit stream filters
-protocols          show available protocols
-filters            show available filters
-pix_fmts           show available pixel formats
-layouts            show standard channel layouts
-sample_fmts        show available audio sample formats
-dispositions       show available stream dispositions
-colors             show available color names
-sources device     list sources of the input device
-sinks device       list sinks of the output device
-hwaccels           show available HW acceleration methods

Global options (affect whole program instead of just one file):
-loglevel loglevel  set logging level
-v loglevel         set logging level
-report             generate a report
-max_alloc bytes    set maximum size of a single allocated block
-y                  overwrite output files
-n                  never overwrite output files
-ignore_unknown     Ignore unknown stream types
-filter_threads     number of non-complex filter threads
-filter_complex_threads  number of threads for -filter_complex
-stats              print progress report during encoding
-max_error_rate maximum error rate  ratio of decoding errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.

Per-file main options:
-f fmt              force format
-c codec            codec name
-codec codec        codec name
-pre preset         preset name
-map_metadata outfile[,metadata]:infile[,metadata]  set metadata information of outfile from infile
-t duration         record or transcode "duration" seconds of audio/video
-to time_stop       record or transcode stop time
-fs limit_size      set the limit file size in bytes
-ss time_off        set the start time offset
-sseof time_off     set the start time offset relative to EOF
-seek_timestamp     enable/disable seeking by timestamp with -ss
-timestamp time     set the recording timestamp ('now' to set the current time)
-metadata string=string  add metadata
-program title=string:st=number...  add program with specified streams
-target type        specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50" with optional prefixes "pal-", "ntsc-" or "film-")
-apad               audio pad
-frames number      set the number of frames to output
-filter filter_graph  set stream filtergraph
-filter_script filename  read stream filtergraph description from a file
-reinit_filter      reinit filtergraph on input parameter changes
-discard            discard
-disposition        disposition

Video options:
-vframes number     set the number of video frames to output
-r rate             set frame rate (Hz value, fraction or abbreviation)
-fpsmax rate        set max frame rate (Hz value, fraction or abbreviation)
-s size             set frame size (WxH or abbreviation)
-aspect aspect      set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-display_rotation angle  set pure counter-clockwise rotation in degrees for stream(s)
-display_hflip      set display horizontal flip for stream(s) (overrides any display rotation if it is not set)
-display_vflip      set display vertical flip for stream(s) (overrides any display rotation if it is not set)
-vn                 disable video
-vcodec codec       force video codec ('copy' to copy stream)
-timecode hh:mm:ss[:;.]ff  set initial TimeCode value.
-pass n             select the pass number (1 to 3)
-vf filter_graph    set video filters
-b bitrate          video bitrate (please use -b:v)
-dn                 disable data

Audio options:
-aframes number     set the number of audio frames to output
-aq quality         set audio quality (codec-specific)
-ar rate            set audio sampling rate (in Hz)
-ac channels        set number of audio channels
-an                 disable audio
-acodec codec       force audio codec ('copy' to copy stream)
-ab bitrate         audio bitrate (please use -b:a)
-af filter_graph    set audio filters

Subtitle options:
-s size             set frame size (WxH or abbreviation)
-sn                 disable subtitle
-scodec codec       force subtitle codec ('copy' to copy stream)
-stag fourcc/tag    force subtitle tag/fourcc
-fix_sub_duration   fix subtitles duration
-canvas_size size   set canvas size (WxH or abbreviation)
-spre preset        set the subtitle options to the indicated preset

2. 查看x264的编码器的详情  ffmpeg -codecs | findstr x264

 DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 
(decoders: h264 h264_qsv h264_cuvid ) 
(encoders: libx264 libx264rgb h264_amf h264_mf h264_nvenc h264_qsv )

我们可以看到encoders 默认的第一个就是 libx264

3. 再查看 libx264具体的的帮忙文档 ffmpeg -h encoder=libx264


 

Encoder libx264 [libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10]:
    General capabilities: dr1 delay threads
    Threading capabilities: other
    Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21 yuv420p10le yuv422p10le yuv444p10le nv20le gray gray10le
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     <boolean>    E..V....... Use fast settings when encoding first pass (default true)
  -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
  -a53cc             <boolean>    E..V....... Use A53 Closed Captions (if available) (default true)
  -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            0            E..V.......
     variance        1            E..V....... Variance AQ (complexity mask)
     autovariance    2            E..V....... Auto-variance AQ
     autovariance-biased 3            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               <boolean>    E..V....... Use psychovisual optimizations. (default auto)
  -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           <boolean>    E..V....... Weighted prediction for B-frames. (default auto)
  -weightp           <int>        E..V....... Weighted prediction analysis method. (from -1 to INT_MAX) (default -1)
     none            0            E..V.......
     simple          1            E..V.......
     smart           2            E..V.......
  -ssim              <boolean>    E..V....... Calculate and print SSIM stats. (default auto)
  -intra-refresh     <boolean>    E..V....... Use Periodic Intra Refresh instead of IDR frames. (default auto)
  -bluray-compat     <boolean>    E..V....... Bluray compatibility workarounds. (default auto)
  -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            0            E..V.......
     strict          1            E..V....... Strictly hierarchical pyramid
     normal          2            E..V....... Non-strict (not Blu-ray compatible)
  -mixed-refs        <boolean>    E..V....... One reference per partition, as opposed to one reference per macroblock (default auto)
  -8x8dct            <boolean>    E..V....... High profile 8x8 transform. (default auto)
  -fast-pskip        <boolean>    E..V....... (default auto)
  -aud               <boolean>    E..V....... Use access unit delimiters. (default auto)
  -mbtree            <boolean>    E..V....... Use macroblock tree ratecontrol. (default auto)
  -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            0            E..V.......
     spatial         1            E..V.......
     temporal        2            E..V.......
     auto            3            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            0            E..V.......
     vbr             1            E..V.......
     cbr             2            E..V.......
  -avcintra-class    <int>        E..V....... AVC-Intra class 50/100/200/300/480 (from -1 to 480) (default -1)
  -me_method         <int>        E..V....... Set motion estimation method (from -1 to 4) (default -1)
     dia             0            E..V.......
     hex             1            E..V.......
     umh             2            E..V.......
     esa             3            E..V.......
     tesa            4            E..V.......
  -motion-est        <int>        E..V....... Set motion estimation method (from -1 to 4) (default -1)
     dia             0            E..V.......
     hex             1            E..V.......
     umh             2            E..V.......
     esa             3            E..V.......
     tesa            4            E..V.......
  -forced-idr        <boolean>    E..V....... If forcing keyframes, force them as IDR frames. (default false)
  -coder             <int>        E..V....... Coder type (from -1 to 1) (default default)
     default         -1           E..V.......
     cavlc           0            E..V.......
     cabac           1            E..V.......
     vlc             0            E..V.......
     ac              1            E..V.......
  -b_strategy        <int>        E..V....... Strategy to choose between I/P/B-frames (from -1 to 2) (default -1)
  -chromaoffset      <int>        E..V....... QP difference between chroma and luma (from INT_MIN to INT_MAX) (default 0)
  -sc_threshold      <int>        E..V....... Scene change threshold (from INT_MIN to INT_MAX) (default -1)
  -noise_reduction   <int>        E..V....... Noise reduction (from INT_MIN to INT_MAX) (default -1)
  -udu_sei           <boolean>    E..V....... Use user data unregistered SEI if available (default false)
  -x264-params       <dictionary> E..V....... Override the x264 configuration using a :-separated list of key=value parameters

以如下一行为例:

  -preset            <string>     E..V....... Set the encoding preset (cf. x264 --fullhelp) (default "medium")

含义如下:

 参数名字为 -preset, 参数值类型为string,默认值为medium

但是没有更加详细的说明。提示给出:可以使用x264 --fullhelp查看。意思是,你要找一个可执行的x264(windows上是x264.exe),然后使用 x264 --fullhelp,查看更加相近的说明。

4.找到一个x264.exe,然后执行 x264 --fullhelp 命令

实际上 我们前面在windows 上 自己build ffmpeg的时候,就会有x264.exe build 出来。

如果忘记了,可以参考一下前面的博客。

有了x264.exe,cmd进入当前路径,执行 x264 --fullhelp

也可以使用  x264 --fullhelp > x264fullhelp.txt ,将h264参数都存储到 txt中

x264 core:164 r3161M a354f11
Syntax: x264 [options] -o outfile infile

Infile can be raw (in which case resolution is required),
  or YUV4MPEG (*.y4m),
  or Avisynth if compiled with support (yes).
  or libav* formats if compiled with lavf support (yes) or ffms support (yes).
Outfile type is selected by filename:
 .264 -> Raw bytestream
 .mkv -> Matroska
 .flv -> Flash Video
 .mp4 -> MP4 if compiled with GPAC or L-SMASH support (lsmash)
Output bit depth: 8/10

Options:

  -h, --help                  List basic options
      --longhelp              List more options
      --fullhelp              List all options

Example usage:

      Constant quality mode:
            x264 --crf 24 -o <output> <input>

      Two-pass with a bitrate of 1000kbps:
            x264 --pass 1 --bitrate 1000 -o <output> <input>
            x264 --pass 2 --bitrate 1000 -o <output> <input>

      Lossless:
            x264 --qp 0 -o <output> <input>

      Maximum PSNR at the cost of speed and visual quality:
            x264 --preset placebo --tune psnr -o <output> <input>

      Constant bitrate at 1000kbps with a 2 second-buffer:
            x264 --vbv-bufsize 2000 --bitrate 1000 -o <output> <input>

Presets:

      --profile <string>      Force the limits of an H.264 profile
                                  Overrides all settings.
                                  - baseline:
                                    --no-8x8dct --bframes 0 --no-cabac
                                    --cqm flat --weightp 0
                                    No interlaced.
                                    No lossless.
                                  - main:
                                    --no-8x8dct --cqm flat
                                    No lossless.
                                  - high:
                                    No lossless.
                                  - high10:
                                    No lossless.
                                    Support for bit depth 8-10.
                                  - high422:
                                    No lossless.
                                    Support for bit depth 8-10.
                                    Support for 4:2:0/4:2:2 chroma subsampling.
                                  - high444:
                                    Support for bit depth 8-10.
                                    Support for 4:2:0/4:2:2/4:4:4 chroma subsampling.
      --preset <string>       Use a preset to select encoding settings [medium]
                                  Overridden by user settings.
                                  - ultrafast:
                                    --no-8x8dct --aq-mode 0 --b-adapt 0
                                    --bframes 0 --no-cabac --no-deblock
                                    --no-mbtree --me dia --no-mixed-refs
                                    --partitions none --rc-lookahead 0 --ref 1
                                    --scenecut 0 --subme 0 --trellis 0
                                    --no-weightb --weightp 0
                                  - superfast:
                                    --no-mbtree --me dia --no-mixed-refs
                                    --partitions i8x8,i4x4 --rc-lookahead 0
                                    --ref 1 --subme 1 --trellis 0 --weightp 1
                                  - veryfast:
                                    --no-mixed-refs --rc-lookahead 10
                                    --ref 1 --subme 2 --trellis 0 --weightp 1
                                  - faster:
                                    --no-mixed-refs --rc-lookahead 20
                                    --ref 2 --subme 4 --weightp 1
                                  - fast:
                                    --rc-lookahead 30 --ref 2 --subme 6
                                    --weightp 1
                                  - medium:
                                    Default settings apply.
                                  - slow:
                                    --direct auto --rc-lookahead 50 --ref 5
                                    --subme 8 --trellis 2
                                  - slower:
                                    --b-adapt 2 --direct auto --me umh
                                    --partitions all --rc-lookahead 60
                                    --ref 8 --subme 9 --trellis 2
                                  - veryslow:
                                    --b-adapt 2 --bframes 8 --direct auto
                                    --me umh --merange 24 --partitions all
                                    --ref 16 --subme 10 --trellis 2
                                    --rc-lookahead 60
                                  - placebo:
                                    --bframes 16 --b-adapt 2 --direct auto
                                    --slow-firstpass --no-fast-pskip
                                    --me tesa --merange 24 --partitions all
                                    --rc-lookahead 60 --ref 16 --subme 11
                                    --trellis 2
      --tune <string>         Tune the settings for a particular type of source
                              or situation
                                  Overridden by user settings.
                                  Multiple tunings are separated by commas.
                                  Only one psy tuning can be used at a time.
                                  - film (psy tuning):
                                    --deblock -1:-1 --psy-rd <unset>:0.15
                                  - animation (psy tuning):
                                    --bframes {+2} --deblock 1:1
                                    --psy-rd 0.4:<unset> --aq-strength 0.6
                                    --ref {Double if >1 else 1}
                                  - grain (psy tuning):
                                    --aq-strength 0.5 --no-dct-decimate
                                    --deadzone-inter 6 --deadzone-intra 6
                                    --deblock -2:-2 --ipratio 1.1
                                    --pbratio 1.1 --psy-rd <unset>:0.25
                                    --qcomp 0.8
                                  - stillimage (psy tuning):
                                    --aq-strength 1.2 --deblock -3:-3
                                    --psy-rd 2.0:0.7
                                  - psnr (psy tuning):
                                    --aq-mode 0 --no-psy
                                  - ssim (psy tuning):
                                    --aq-mode 2 --no-psy
                                  - fastdecode:
                                    --no-cabac --no-deblock --no-weightb
                                    --weightp 0
                                  - zerolatency:
                                    --bframes 0 --force-cfr --no-mbtree
                                    --sync-lookahead 0 --sliced-threads
                                    --rc-lookahead 0
      --slow-firstpass        Don't force these faster settings with --pass 1:
                                  --no-8x8dct --me dia --partitions none
                                  --ref 1 --subme {2 if >2 else unchanged}
                                  --trellis 0 --fast-pskip

Frame-type options:

  -I, --keyint <integer or "infinite"> Maximum GOP size [250]
  -i, --min-keyint <integer>  Minimum GOP size [auto]
      --no-scenecut           Disable adaptive I-frame decision
      --scenecut <integer>    How aggressively to insert extra I-frames [40]
      --intra-refresh         Use Periodic Intra Refresh instead of IDR frames
  -b, --bframes <integer>     Number of B-frames between I and P [3]
      --b-adapt <integer>     Adaptive B-frame decision method [1]
                                  Higher values may lower threading efficiency.
                                  - 0: Disabled
                                  - 1: Fast
                                  - 2: Optimal (slow with high --bframes)
      --b-bias <integer>      Influences how often B-frames are used [0]
      --b-pyramid <string>    Keep some B-frames as references [normal]
                                  - none: Disabled
                                  - strict: Strictly hierarchical pyramid
                                  - normal: Non-strict (not Blu-ray compatible)
      --open-gop              Use recovery points to close GOPs
                              Only available with b-frames
      --no-cabac              Disable CABAC
  -r, --ref <integer>         Number of reference frames [3]
      --no-deblock            Disable loop filter
  -f, --deblock <alpha:beta>  Loop filter parameters [0:0]
      --slices <integer>      Number of slices per frame; forces rectangular
                              slices and is overridden by other slicing options
      --slices-max <integer>  Absolute maximum slices per frame; overrides
                              slice-max-size/slice-max-mbs when necessary
      --slice-max-size <integer> Limit the size of each slice in bytes
      --slice-max-mbs <integer> Limit the size of each slice in macroblocks (max)
      --slice-min-mbs <integer> Limit the size of each slice in macroblocks (min)
      --tff                   Enable interlaced mode (top field first)
      --bff                   Enable interlaced mode (bottom field first)
      --constrained-intra     Enable constrained intra prediction.
      --pulldown <string>     Use soft pulldown to change frame rate
                                  - none, 22, 32, 64, double, triple, euro (requires cfr input)
      --fake-interlaced       Flag stream as interlaced but encode progressive.
                              Makes it possible to encode 25p and 30p Blu-Ray
                              streams. Ignored in interlaced mode.
      --frame-packing <integer> For stereoscopic videos define frame arrangement
                                  - 0: checkerboard - pixels are alternatively from L and R
                                  - 1: column alternation - L and R are interlaced by column
                                  - 2: row alternation - L and R are interlaced by row
                                  - 3: side by side - L is on the left, R on the right
                                  - 4: top bottom - L is on top, R on bottom
                                  - 5: frame alternation - one view per frame
                                  - 6: mono - 2D frame without any frame packing
                                  - 7: tile format - L is on top-left, R split across

Ratecontrol:

  -q, --qp <integer>          Force constant QP (0-81, 0=lossless)
  -B, --bitrate <integer>     Set bitrate (kbit/s)
      --crf <float>           Quality-based VBR (-12-51) [23.0]
      --rc-lookahead <integer> Number of frames for frametype lookahead [40]
      --vbv-maxrate <integer> Max local bitrate (kbit/s) [0]
      --vbv-bufsize <integer> Set size of the VBV buffer (kbit) [0]
      --vbv-init <float>      Initial VBV buffer occupancy [0.9]
      --crf-max <float>       With CRF+VBV, limit RF to this value
                                  May cause VBV underflows!
      --qpmin <integer>       Set min QP [0]
      --qpmax <integer>       Set max QP [81]
      --qpstep <integer>      Set max QP step [4]
      --ratetol <float>       Tolerance of ABR ratecontrol and VBV [1.0]
      --ipratio <float>       QP factor between I and P [1.40]
      --pbratio <float>       QP factor between P and B [1.30]
      --chroma-qp-offset <integer>  QP difference between chroma and luma [0]
      --aq-mode <integer>     AQ method [1]
                                  - 0: Disabled
                                  - 1: Variance AQ (complexity mask)
                                  - 2: Auto-variance AQ
                                  - 3: Auto-variance AQ with bias to dark scenes
      --aq-strength <float>   Reduces blocking and blurring in flat and
                              textured areas. [1.0]

  -p, --pass <integer>        Enable multipass ratecontrol
                                  - 1: First pass, creates stats file
                                  - 2: Last pass, does not overwrite stats file
                                  - 3: Nth pass, overwrites stats file
      --stats <string>        Filename for 2 pass stats ["x264_2pass.log"]
      --no-mbtree             Disable mb-tree ratecontrol.
      --qcomp <float>         QP curve compression [0.60]
      --cplxblur <float>      Reduce fluctuations in QP (before curve compression) [20.0]
      --qblur <float>         Reduce fluctuations in QP (after curve compression) [0.5]
      --zones <zone0>/<zone1>/...  Tweak the bitrate of regions of the video
                              Each zone is of the form
                                  <start frame>,<end frame>,<option>
                                  where <option> is either
                                      q=<integer> (force QP)
                                  or  b=<float> (bitrate multiplier)
      --qpfile <string>       Force frametypes and QPs for some or all frames
                              Format of each line: framenumber frametype QP
                              QP is optional (none lets x264 choose). Frametypes: I,i,K,P,B,b.
                                  K=<I or i> depending on open-gop setting
                              QPs are restricted by qpmin/qpmax.

Analysis:

  -A, --partitions <string>   Partitions to consider ["p8x8,b8x8,i8x8,i4x4"]
                                  - p8x8, p4x4, b8x8, i8x8, i4x4, none, all
                                  (p4x4 requires p8x8. i8x8 requires --8x8dct.)
      --direct <string>       Direct MV prediction mode ["spatial"]
                                  - none, spatial, temporal, auto
      --no-weightb            Disable weighted prediction for B-frames
      --weightp <integer>     Weighted prediction for P-frames [2]
                                  - 0: Disabled
                                  - 1: Weighted refs
                                  - 2: Weighted refs + Duplicates
      --me <string>           Integer pixel motion estimation method ["hex"]
                                  - dia: diamond search, radius 1 (fast)
                                  - hex: hexagonal search, radius 2
                                  - umh: uneven multi-hexagon search
                                  - esa: exhaustive search
                                  - tesa: hadamard exhaustive search (slow)
      --merange <integer>     Maximum motion vector search range [16]
      --mvrange <integer>     Maximum motion vector length [-1 (auto)]
      --mvrange-thread <int>  Minimum buffer between threads [-1 (auto)]
  -m, --subme <integer>       Subpixel motion estimation and mode decision [7]
                                  - 0: fullpel only (not recommended)
                                  - 1: SAD mode decision, one qpel iteration
                                  - 2: SATD mode decision
                                  - 3-5: Progressively more qpel
                                  - 6: RD mode decision for I/P-frames
                                  - 7: RD mode decision for all frames
                                  - 8: RD refinement for I/P-frames
                                  - 9: RD refinement for all frames
                                  - 10: QP-RD - requires trellis=2, aq-mode>0
                                  - 11: Full RD: disable all early terminations
      --psy-rd <float:float>  Strength of psychovisual optimization ["1.0:0.0"]
                                  #1: RD (requires subme>=6)
                                  #2: Trellis (requires trellis, experimental)
      --no-psy                Disable all visual optimizations that worsen
                              both PSNR and SSIM.
      --no-mixed-refs         Don't decide references on a per partition basis
      --no-chroma-me          Ignore chroma in motion estimation
      --no-8x8dct             Disable adaptive spatial transform size
  -t, --trellis <integer>     Trellis RD quantization. [1]
                                  - 0: disabled
                                  - 1: enabled only on the final encode of a MB
                                  - 2: enabled on all mode decisions
      --no-fast-pskip         Disables early SKIP detection on P-frames
      --no-dct-decimate       Disables coefficient thresholding on P-frames
      --nr <integer>          Noise reduction [0]

      --deadzone-inter <int>  Set the size of the inter luma quantization deadzone [21]
      --deadzone-intra <int>  Set the size of the intra luma quantization deadzone [11]
                                  Deadzones should be in the range 0 - 32.
      --cqm <string>          Preset quant matrices ["flat"]
                                  - flat, jvt
      --cqmfile <string>      Read custom quant matrices from a JM-compatible file
                                  Overrides any other --cqm* options.
      --cqm4 <list>           Set all 4x4 quant matrices
                                  Takes a comma-separated list of 16 integers.
      --cqm8 <list>           Set all 8x8 quant matrices
                                  Takes a comma-separated list of 64 integers.
      --cqm4i, --cqm4p, --cqm8i, --cqm8p <list>
                              Set both luma and chroma quant matrices
      --cqm4iy, --cqm4ic, --cqm4py, --cqm4pc <list>
                              Set individual quant matrices

Video Usability Info (Annex E):
The VUI settings are not used by the encoder but are merely suggestions to
the playback equipment. See doc/vui.txt for details. Use at your own risk.

      --overscan <string>     Specify crop overscan setting ["undef"]
                                  - undef, show, crop
      --videoformat <string>  Specify video format ["undef"]
                                  - component, pal, ntsc, secam, mac, undef
      --range <string>        Specify color range ["auto"]
                                  - auto, tv, pc
      --colorprim <string>    Specify color primaries ["undef"]
                                  - undef, bt709, bt470m, bt470bg, smpte170m,
                                    smpte240m, film, bt2020, smpte428,
                                    smpte431, smpte432
      --transfer <string>     Specify transfer characteristics ["undef"]
                                  - undef, bt709, bt470m, bt470bg, smpte170m,
                                    smpte240m, linear, log100, log316,
                                    iec61966-2-4, bt1361e, iec61966-2-1,
                                    bt2020-10, bt2020-12, smpte2084, smpte428,
                                    arib-std-b67
      --colormatrix <string>  Specify color matrix setting ["???"]
                                  - undef, bt709, fcc, bt470bg, smpte170m,
                                    smpte240m, GBR, YCgCo, bt2020nc, bt2020c,
                                    smpte2085, chroma-derived-nc,
                                    chroma-derived-c, ICtCp
      --chromaloc <integer>   Specify chroma sample location (0 to 5) [0]
      --mastering-display <string> Specify 'G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min)'
                              for primaries, white point, and display brightness
      --cll <string>          Specify 'max_content,max_frame_average' content
                              light levels
      --alternative-transfer <string> Specify an alternative transfer
                              characteristics ["undef"]
                                  - same values as --transfer
      --nal-hrd <string>      Signal HRD information (requires vbv-bufsize)
                                  - none, vbr, cbr (cbr not allowed in .mp4)
      --filler                Force hard-CBR and generate filler (implied by
                              --nal-hrd cbr)
      --pic-struct            Force pic_struct in Picture Timing SEI
      --crop-rect <string>    Add 'left,top,right,bottom' to the bitstream-level
                              cropping rectangle

Input/Output:

  -o, --output <string>       Specify output file
      --muxer <string>        Specify output container format ["auto"]
                                  - auto, raw, mkv, flv, mp4
      --demuxer <string>      Specify input container format ["auto"]
                                  - auto, raw, y4m, avs, lavf, ffms
      --input-fmt <string>    Specify input file format (requires lavf support)
      --input-csp <string>    Specify input colorspace format for raw input
                              - valid csps for `raw' demuxer:
                                i400, i420, yv12, nv12, nv21, i422, yv16, nv16, 
                                yuyv, uyvy, i444, yv24, bgr, bgra, rgb
                              - valid csps for `lavf' demuxer:
                                yuv420p, yuyv422, rgb24, bgr24, yuv422p, 
                                yuv444p, yuv410p, yuv411p, gray, monow, monob, 
                                pal8, yuvj420p, yuvj422p, yuvj444p, uyvy422, 
                                uyyvyy411, bgr8, bgr4, bgr4_byte, rgb8, rgb4, 
                                rgb4_byte, nv12, nv21, argb, rgba, abgr, bgra, 
                                gray16be, gray16le, yuv440p, yuvj440p, 
                                yuva420p, rgb48be, rgb48le, rgb565be, rgb565le, 
                                rgb555be, rgb555le, bgr565be, bgr565le, 
                                bgr555be, bgr555le, vaapi, yuv420p16le, 
                                yuv420p16be, yuv422p16le, yuv422p16be, 
                                yuv444p16le, yuv444p16be, dxva2_vld, rgb444le, 
                                rgb444be, bgr444le, bgr444be, ya8, bgr48be, 
                                bgr48le, yuv420p9be, yuv420p9le, yuv420p10be, 
                                yuv420p10le, yuv422p10be, yuv422p10le, 
                                yuv444p9be, yuv444p9le, yuv444p10be, 
                                yuv444p10le, yuv422p9be, yuv422p9le, gbrp, 
                                gbrp9be, gbrp9le, gbrp10be, gbrp10le, gbrp16be, 
                                gbrp16le, yuva422p, yuva444p, yuva420p9be, 
                                yuva420p9le, yuva422p9be, yuva422p9le, 
                                yuva444p9be, yuva444p9le, yuva420p10be, 
                                yuva420p10le, yuva422p10be, yuva422p10le, 
                                yuva444p10be, yuva444p10le, yuva420p16be, 
                                yuva420p16le, yuva422p16be, yuva422p16le, 
                                yuva444p16be, yuva444p16le, vdpau, xyz12le, 
                                xyz12be, nv16, nv20le, nv20be, rgba64be, 
                                rgba64le, bgra64be, bgra64le, yvyu422, ya16be, 
                                ya16le, gbrap, gbrap16be, gbrap16le, qsv, mmal, 
                                d3d11va_vld, cuda, 0rgb, rgb0, 0bgr, bgr0, 
                                yuv420p12be, yuv420p12le, yuv420p14be, 
                                yuv420p14le, yuv422p12be, yuv422p12le, 
                                yuv422p14be, yuv422p14le, yuv444p12be, 
                                yuv444p12le, yuv444p14be, yuv444p14le, 
                                gbrp12be, gbrp12le, gbrp14be, gbrp14le, 
                                yuvj411p, bayer_bggr8, bayer_rggb8, 
                                bayer_gbrg8, bayer_grbg8, bayer_bggr16le, 
                                bayer_bggr16be, bayer_rggb16le, bayer_rggb16be, 
                                bayer_gbrg16le, bayer_gbrg16be, bayer_grbg16le, 
                                bayer_grbg16be, xvmc, yuv440p10le, yuv440p10be, 
                                yuv440p12le, yuv440p12be, ayuv64le, ayuv64be, 
                                videotoolbox_vld, p010le, p010be, gbrap12be, 
                                gbrap12le, gbrap10be, gbrap10le, mediacodec, 
                                gray12be, gray12le, gray10be, gray10le, p016le, 
                                p016be, d3d11, gray9be, gray9le, gbrpf32be, 
                                gbrpf32le, gbrapf32be, gbrapf32le, drm_prime, 
                                opencl, gray14be, gray14le, grayf32be, 
                                grayf32le, yuva422p12be, yuva422p12le, 
                                yuva444p12be, yuva444p12le, nv24, nv42, vulkan, 
                                y210be, y210le, x2rgb10le, x2rgb10be, 
                                x2bgr10le, x2bgr10be, p210be, p210le, p410be, 
                                p410le, p216be, p216le, p416be, p416le, vuya, 
                                rgbaf16be, rgbaf16le, vuyx, p012le, p012be, 
                                y212be, y212le, xv30be, xv30le, xv36be, xv36le, 
                                rgbf32be, rgbf32le, rgbaf32be, rgbaf32le
      --output-csp <string>   Specify output colorspace ["i420"]
                                  - i400, i420, i422, i444, rgb
      --input-depth <integer> Specify input bit depth for raw input
      --output-depth <integer> Specify output bit depth
      --input-range <string>  Specify input color range ["auto"]
                                  - auto, tv, pc
      --input-res <intxint>   Specify input resolution (width x height)
      --index <string>        Filename for input index file
      --sar width:height      Specify Sample Aspect Ratio
      --fps <float|rational>  Specify framerate
      --seek <integer>        First frame to encode
      --frames <integer>      Maximum number of frames to encode
      --level <string>        Specify level (as defined by Annex A)
      --bluray-compat         Enable compatibility hacks for Blu-ray support
      --avcintra-class <integer> Use compatibility hacks for AVC-Intra class
                                  - 50, 100, 200, 300, 480
      --avcintra-flavor <string> AVC-Intra flavor ["panasonic"]
                                  - panasonic, sony
      --stitchable            Don't optimize headers based on video content
                              Ensures ability to recombine a segmented encode

  -v, --verbose               Print stats for each frame
      --no-progress           Don't show the progress indicator while encoding
      --quiet                 Quiet Mode
      --log-level <string>    Specify the maximum level of logging ["info"]
                                  - none, error, warning, info, debug
      --psnr                  Enable PSNR computation
      --ssim                  Enable SSIM computation
      --threads <integer>     Force a specific number of threads
      --lookahead-threads <integer> Force a specific number of lookahead threads
      --sliced-threads        Low-latency but lower-efficiency threading
      --thread-input          Run Avisynth in its own thread
      --sync-lookahead <integer> Number of buffer frames for threaded lookahead
      --non-deterministic     Slightly improve quality of SMP, at the cost of repeatability
      --cpu-independent       Ensure exact reproducibility across different cpus,
                                  as opposed to letting them select different algorithms
      --asm <integer>         Override CPU detection
      --no-asm                Disable all CPU optimizations
      --opencl                Enable use of OpenCL
      --opencl-clbin <string> Specify path of compiled OpenCL kernel cache
      --opencl-device <integer> Specify OpenCL device ordinal
      --dump-yuv <string>     Save reconstructed frames
      --sps-id <integer>      Set SPS and PPS id numbers [0]
      --aud                   Use access unit delimiters
      --force-cfr             Force constant framerate timestamp generation
      --tcfile-in <string>    Force timestamp generation with timecode file
      --tcfile-out <string>   Output timecode v2 file from input timestamps
      --timebase <int/int>    Specify timebase numerator and denominator
                 <integer>    Specify timebase numerator for input timecode file
                              or specify timebase denominator for other input
      --dts-compress          Eliminate initial delay with container DTS hack

Filtering:

      --vf, --video-filter <filter0>/<filter1>/... Apply video filtering to the input file

      Filter options may be specified in <filter>:<option>=<value> format.

      Available filters:
      crop:left,top,right,bottom
            removes pixels from the edges of the frame
      resize:[width,height][,sar][,fittobox][,csp][,method]
            resizes frames based on the given criteria:
            - resolution only: resizes and adapts sar to avoid stretching
            - sar only: sets the sar and resizes to avoid stretching
            - resolution and sar: resizes to given resolution and sets the sar
            - fittobox: resizes the video based on the desired constraints
               - width, height, both
            - fittobox and sar: same as above except with specified sar
            - csp: convert to the given csp. syntax: [name][:depth]
               - valid csp names [keep current]: i400, i420, yv12, nv12, nv21, i422, yv16, nv16, yuyv, uyvy, i444, yv24, bgr, bgra, rgb
               - depth: 8 or 16 bits per pixel [keep current]
            note: not all depths are supported by all csps.
            - method: use resizer method ["bicubic"]
               - fastbilinear, bilinear, bicubic, experimental, point,
               - area, bicublin, gauss, sinc, lanczos, spline
      select_every:step,offset1[,...]
            apply a selection pattern to input frames
            step: the number of frames in the pattern
            offsets: the offset into the step to select a frame
            see: http://avisynth.nl/index.php/Select#SelectEvery

5.x264常用的参数,以及说明

5.1 预设参数


–profile:设置H264视频的配置,设置成功会覆盖所有的参数设置。可选参数有:
         baseline:无损,非隔行扫描,–no-8x8dct --bframes 0 --no-cabac --cqm flat --weightp 0;

                        基本画质。⽀持I/P 帧,只⽀持⽆交错(Progressive)和CAVLC


         main:–no-8x8dct --cqm flat,无损;       

                        主流画质。提供I/P/B 帧,⽀持⽆交错(Progressive )和交错( Interlaced ),也⽀持 CAVLC 和 CABAC 的⽀持;

         high:无损;

                ⾼级画质。在main Profile 的基础上增加了 8x8 内部预测、⾃定义量化、 ⽆损视频编码
和更多的 YUV 格式;

         high10:支持8-10bit,无损;
         high422:支持8-10bit,YUV420和YUV422;
         high444:支持8-10bit,YUV420、YUV422和YUV444。


–present:压缩效率和运算时间中平衡的预设值。如果指定了一个预设值,它会在其它选项生效前生效。可选的值有:ultrafast、superfast、veryfast、faster、fast、medium、slow、slower、veryslow和placebo。


–tune:上一个选项基础上进一步优化输入。如果定义了一个tune值,它将在preset之后,其它选项之前生效。可选:film、animation、grain、stillimage、psnr、ssim、fastdecode、zerolatency和touhou。

                film:电影类型,对视频的质量⾮常严格时使⽤该选项
                animation:动画⽚,压缩的视频是动画⽚时使⽤该选项
                grain:颗粒物很重,该选项适⽤于颗粒感很重的视频
                stillimage:静态图像,该选项主要⽤于静⽌画⾯⽐较多的视频
                psnr:提⾼psnr,该选项编码出来的视频 psnr ⽐较⾼
                ssim:提⾼ssim ,该选项编码出来的视频 ssim ⽐较⾼
                fastdecode:快速解码,该选项有利于快速解码
                zerolatency :零延迟,该选项主要⽤于视频直播
                如果你不确定使⽤哪个选项或者说你的输⼊与所有的tune皆不匹配,你可以忽略 --tune 选项。
                你可以使⽤-tune来查看 tune 列表,也可以通过 x264 --fullhelp 来查看 tune 所采⽤的参数配置。

–slow-firstpass:使用–pass 1会在解析命令行时增加一些设置。如果设置preset=placebo则自动关闭此特性。如果想显式关闭此特性,使用slow-firstpass。

baseline profile 多应⽤于实时通信领域;
main profile 多应⽤于流媒体领域;
high profile 则多应⽤于⼴电和存储领域。

5.2 帧类型选项


-I, --keyint<integer or "infinite">:设置GOPSize,默认值为250;

IDR帧是视频流的“分隔符”,所有帧都不可以使用越过关键帧的帧作为参考帧。
IDR帧是I帧的一种,所以它们也不参照其它帧。
这意味着它们可以作为视频的搜索(seek)点。
通过这个设置可以设置IDR帧的最大间隔帧数(亦称最大图像组长度)。
较大的值将导致IDR帧减少(会用占用空间更少的P帧和B帧取代),
也就同时减弱了参照帧选择的限制。
较小的值导致减少搜索一个随机帧所需的平均时间。

-i,  --min-keyint<integer> :最小的GPOSize,默认为auto
     --no-scenecut:完全关闭自适应I帧决策;
     -- scenecut<integer> :设置决策使用I帧、IDR帧的阈值(场景变换检测);

x264会计算每一帧与前一帧的不同程度并得出一个值。
如果这个值低于scenecut,那么就算检测到一个“场景变换”。
如果此时距离上一帧的距离小于 min-keyint则插入一个I帧,反之则插入一个IDR帧。
较高的值会增加侦测到“场景变换”概率。

        --intra-refresh 让x264为每keyint数量的帧使用宏块内部编码取代IDR帧;

块以水平移动列的方式更新,也叫刷新波。
对于低延迟的流,这样可以让帧的尺寸比使用标准的IDR帧更加保持恒定。
而且这样可以增强视频流对丢包的容错能力。
这个选项会降低压缩率,所以在确实需要的时候才选择它。

-b,   --bframes<integer> :设置x264可使用的B帧的最大连续数量,默认3;
        --b-adapt<integer> :设置B帧决策算法,这个选项会影响到x264使用P帧或者B帧;

                        0:关闭。总是使用B帧。和以前的 no-b-adapt选项效果相同;
                        1:‘快速’算法。快速,–b-frames越大速度越快;
                        2:‘最佳’算法,慢速,–b-frames越大速度越慢;
       --b-bias<integer> :调节使用B帧的力度。越大的值越偏向B帧,可以在-100和100之间选择。100或-100不能保证完全或是全是B帧(使用 –b-adapt 0);

        –b-pyramid<string>:允许B帧作为参照帧。如果关闭,那么只有I帧和P帧才能作为参照帧。可以作为参照帧的B帧的量化参数会介于P帧和普通B帧之间。只在–b-frames设置大于等于2时此选项才生效。如果是在为蓝光光盘编码,请使用none或者strict。

                        none:不允许B帧作为参照帧;
                        strict:一个图像组内只允许一个B帧参照帧,这是蓝光编码强制要求的标准;
                        normal:任意使用B帧参照帧;
        –open-gop:Open-GOP是一个提升压缩效率的编码技术,有些解码器不能完全支持open-GOP流,因此这个选项默认关闭;

                        none:关闭
                        normal:开启
                        bluray:开启。一个稍低效的open-GOP版本,因为normal模式不能用于蓝光编码。
                        open and closed gops all you need to know

        –no-cabac:关闭CABAC (Context Adaptive Binary Arithmetic Coder)压缩,使用较为低效的CAVLC (Context Adaptive Variable Length Coder)。这两者在压缩效率和解码效率上有10%-20%的差别;

-r     --ref<integer>:控制DPB (Decoded Picture Buffer)的大小。可以在0-16之间选择。简单地说,就是设置P帧可以选择它之前的多少帧作为参照帧(B帧的值要小1-2,取决于那个B帧能不能作为参照)。最小可以选择值1,只参照自己前面的那帧。注意H.264标准限制了每个level可以参照的帧的数量。如果选择level4.1,1080p最大选4,720p最大选9;
        --no-deblock:完全关闭内置去块滤波器;


-f     --deblock<alpha:beta>:调节H.264标准中的内置去块滤波器。这是个性价比很高的选择;
        --slices<integer> :设置每帧的分片数,强制使用矩形分片;

        --slices-max <integer> :每帧的绝对最大切片数,在必要时会覆盖lice-max-size/slice-max-mbs

        --slice-max-size<integer> :设置每个分块包括NAL头的最大大小(bytes);
        --slice-max-mbs<integer> :设置每个分块包含的最大宏块数量;
        --slice-min-mbs<integer> :设置每个分块包含的最小宏块数量;
        --tff:开启隔行编码并设置上半场在前。x264的隔行编码使用MBAFF,因此效率不如逐行扫描。所以,仅在需要在隔行显示的设备上显示时才开启这个选项;
        --bff:开启隔行编码并设置下半场在前;
        --constrained-intra:开启SVC编码的底层要求的强制帧内预测;
        --pulldown<string> :为你的输入流(逐行扫描的,固定帧率的)使用一组预设的“soft pulldown”;可选的参数有:none、22、32、64、double、triple、euro;
        --fake-interlaced:把流标志为隔行的但不按隔行编码。用于编码25p和30p的蓝光兼容视频;
        --frame-packing<integer>:对于立体视频,定义帧排列方式:
                                0:棋盘格 - 像素交替来自左眼和右眼
                                1:列交替 - 左眼和右眼通过列交替交织
                                2:行交替 - 左眼和右眼通过行交替交织
                                3:左右并排 - 左眼在左侧,右眼在右侧
                                4:上下并排 - 左眼在上方,右眼在下方
                                5:帧交替 - 每帧显示一个视图
                                6:单眼 - 2D帧,没有任何帧包装
                                7:平铺格式 - 左眼在左上方,右眼分割在其余区域


5.3 码率控制


-q,     --qp<integer>  :强制使用恒定的QP值(0-81,0=无损);
-B,    --bitrate<integer>  :设置比特率(kbit/s);
        --crf<float> :基于质量的可变比特率(-12-51)[23.0];
        --rc-lookahead<integer>  :预测帧类型的帧数 [40];
        --vbv-maxrate<integer>  :最大本地比特率(kbit/s)[0];
        --vbv-bufsize<integer>  :设置VBV缓冲区大小(kbit)[0];
        --vbv-init<float> :初始VBV缓冲区占用率 [0.9];
        --crf-max<float> :使用CRF+VBV时,限制RF到此值可能导致VBV下溢!;
        --qpmin<integer>:设置最小QP值 [0];
        --qpmax<integer>:设置最大QP值 [81];
        --qpstep<integer>:设置最大QP步长 [4];
        --ratetol<float>:ABR速率控制和VBV的容差 [1.0];
        --ipratio<float>:I和P之间的QP因子 [1.40];
        --pbratio<float>:P和B之间的QP因子 [1.30];
        --chroma-qp-offset<integer> :色度与亮度之间的QP差异 [0];
        --aq-mode<integer> :AQ方法 [1];
                                0: 禁用;
                                1: 方差AQ(复杂度掩码);
                                2: 自动方差AQ;
                                3: 自动方差AQ,并偏向于暗场景;
        –aq-strength<float>:减少平坦和纹理区域中的块和模糊 [1.0];


-p,     --pass<integer>:启用多通道速率控制;
                                1: 第一遍,创建统计文件;
                                2: 最后一遍,不覆盖统计文件;
                                3: 第N遍,覆盖统计文件;
        --stats<string> :用于两遍统计的文件名 [“x264_2pass.log”];
        --no-mbtree:禁用mb-tree速率控制;
        --qcomp<float> :QP曲线压缩 [0.60];
        --cplxblur<float> :减少QP的波动(曲线压缩之前) [20.0];
        --qblur<float> :减少QP的波动(曲线压缩之后) [0.5];
        --zones:调整视频区域的比特率;每个区域的格式为<起始帧数>,<结束帧数>,<选项>,其中<选项>可以是q=<整数>(强制QP)或 b=<浮点数>(比特率倍增器);
       --qpfile<string>   :强制一些或所有帧的帧类型和QP值;每行的格式:帧号 帧类型 QPQP是可选的(none表示由x264选择)。帧类型:I,i,K,P,B,b。K=<I或i>取决于open-gop设置QP受qpmin/qpmax的限制。


5.4 分析


-A,–partitions:要考虑的分区。可选值为[“p8x8, b8x8, i8x8, i4x4”],表示考虑的分区类型,包括p8x8、p4x4、b8x8、i8x8、i4x4、none和all。
–direct:直接运动矢量(MV)预测模式。可选值为[“spatial”],表示直接MV预测模式,包括none、spatial、temporal和auto。
–no-weightb:禁用B帧的加权预测。
–weightp:P帧的加权预测。可选值为[2],表示加权预测的类型,包括0(禁用)、1(加权参考帧)和2(加权参考帧+复制帧)。
–me:整数像素运动估计方法。可选值为[“hex”],表示整数像素运动估计方法,包括dia(钻石搜索,半径1,快速)、hex(六边形搜索,半径2)、umh(不均匀多六边形搜索)、esa(穷举搜索)和tesa(哈达玛穷举搜索,慢)。
–merange:最大运动矢量搜索范围,默认值为16。
–mvrange:最大运动矢量长度,默认值为-1(自动)。
–mvrange-thread:线程之间的最小缓冲区,默认值为-1(自动)。
-m, --subme:亚像素运动估计和模式决策。可选值为[7],表示亚像素运动估计和模式决策的级别,包括0(仅全像素,不推荐使用)、1(SAD模式决策,一次qpel迭代)、2(SATD模式决策)等。
–psy-rd:心理视觉优化的强度,默认值为"1.0:0.0"。其中,#1表示RD(需要subme>=6),#2表示Trellis(需要trellis,实验性)。
–no-psy:禁用所有恶化PSNR和SSIM的视觉优化。
–no-mixed-refs:不基于每个分区来决定引用帧。
–no-chroma-me:忽略运动估计中的色度。
–no-8x8dct:禁用自适应空间变换大小。
-t, --trellis:Trellis RD量化,默认值为1。可选值为0(禁用)、1(仅在MB的最终编码中启用)、2(在所有模式决策中启用)。
–no-fast-pskip:在P帧上禁用早期SKIP检测。
–no-dct-decimate:在P帧上禁用系数阈值。
–nr:降噪,默认值为0。
–deadzone-inter:设置互帧亮度量化deadzone的大小,默认值为21。
–deadzone-intra:设置帧内亮度量化deadzone的大小,默认值为11。deadzone的大小应在0到32之间。
–cqm:预设量化矩阵。可选值为[“flat”],表示预设的量化矩阵类型,包括flat和jvt。
–cqmfile:从与JM兼容的文件中读取自定义的量化矩阵。会覆盖其他–cqm*选项。
–cqm4:设置所有的4x4量化矩阵。需要提供一个由16个整数组成的逗号分隔列表。
–cqm8:设置所有的8x8量化矩阵。需要提供一个由64个整数组成的逗号分隔列表。
–cqm4i, --cqm4p, --cqm8i, --cqm8p:同时设置亮度和色度的量化矩阵。
–cqm4iy, --cqm4ic, --cqm4py, --cqm4pc:设置单独的亮度和色度量化矩阵。


5.5 设置视频可用性信息


  VUI设置不被编码器使用,只是对播放设备的建议。

–overscan:指定裁剪超扫描设置。可选值为[“undef”],表示裁剪超扫描的设置,包括undef、show和crop。
–videoformat:指定视频格式。可选值为[“undef”],表示视频格式,包括component、pal、ntsc、secam、mac和undef。
–range:指定颜色范围。可选值为[“auto”],表示颜色范围,包括auto、tv和pc。
–colorprim:指定颜色原色。可选值为[“undef”],表示颜色原色,包括undef、bt709、bt470m、bt470bg、smpte170m、smpte240m、film、bt2020、smpte428、smpte431和smpte432。
–transfer:指定传输特性。可选值为[“undef”],表示传输特性,包括undef、bt709、bt470m、bt470bg、smpte170m、smpte240m、linear、log100、log316、iec61966-2-4、bt1361e、iec61966-2-1、bt2020-10、bt2020-12、smpte2084、smpte428和arib-std-b67。
–colormatrix:指定颜色矩阵设置。可选值为[“???”],表示颜色矩阵设置,包括undef、bt709、fcc、bt470bg、smpte170m、smpte240m、GBR、YCgCo、bt2020nc、bt2020c、smpte2085、chroma-derived-nc、chroma-derived-c和ICtCp。
–chromaloc:指定色度采样位置(0到5)。默认值为0。
**–mastering-display :指定主显示器的亮度、白点和显示亮度。格式为’G(x,y)B(x,y)R(x,y)WP(x,y)L(max,min)'。
–cll:指定内容光亮度的最大值和最大帧平均值。格式为’max_content,max_frame_average’。
–alternative-transfer:指定备用传输特性。可选值与–transfer相同。
–nal-hrd:信号HRD信息(需要vbv-bufsize)。可选值为none、vbr、cbr(.mp4中不允许使用cbr)。
–filler:强制使用硬CBR并生成填充数据(隐含–nal-hrd cbr)。
–pic-struct:强制在图像定时SEI中使用pic_struct。
–crop-rect:将’left,top,right,bottom’添加到比特流级别的裁剪矩形。


 

  • 22
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值