Files
HandBrake-docs/source/en/latest/cli/cli-guide.markdown
2016-04-17 15:44:48 +01:00

28 KiB

Title, Project, Project_URL, Project_Version, Language, Language_Code, Text_Encoding, Authors, Copyright, License, License_Abbr, License_URL
Title Project Project_URL Project_Version Language Language_Code Text_Encoding Authors Copyright License License_Abbr License_URL
CLI Guide HandBrake https://handbrake.fr/ Latest English en utf-8 Scott (s55) 2016 HandBrake Team Creative Commons Attribution-ShareAlike 4.0 International CC BY-SA 4.0 https://handbrake.fr/docs/license.html

CLI Guide

The following details all the available options in HandBrakeCLI

You can access this information at any time by running the following command:

HandBrakeCLI --help

The HandBrakeCLI Help Output

Syntax: HandBrakeCLI [options] -i <device> -o <file>

### General Handbrake Options---------------------------------------------

   -h, --help              Print help
   -v, --verbose <#>       Be verbose (optional argument: logging level)
   -Z. --preset <string>   Use a built-in preset. Capitalization matters,
                           and if the preset name has spaces, surround it
                           with double quotation marks
   -z, --preset-list       See a list of available built-in presets
   --preset-import-file    Import presets from a json preset file.
       <filespec>          'filespec' may be a list of files separated
                           by spaces, or it may use shell wildcards.
   --preset-import-gui     Import presets from GUI config preset file.
   --preset-export         Create a new preset from command line options and
       <name>              write a json representation of the preset to the
                           console or a file if '--preset-export-file' is
                           specified. The required 'name' argument will be
                           the new preset's name.
   --preset-export-file    Write new preset generated by '--preset-export'
       <filename>          to file 'filename'.
   --preset-export-description
       <description>       Add a description to the new preset created with
                           '--preset-export'
   --queue-import-file     Import an encode queue file created by the GUI
       <filename>
       --no-dvdnav         Do not use dvdnav for reading DVDs
       --no-opencl         Disable use of OpenCL

### Source Options--------------------------------------------------------

   -i, --input <string>    Set input device
   -t, --title <number>    Select a title to encode (0 to scan all titles
                           only, default: 1)
       --min-duration      Set the minimum title duration (in seconds).
                           Shorter titles will be ignored (default: 10).
       --scan              Scan selected title only.
       --main-feature      Detect and select the main feature title.
   -c, --chapters <string> Select chapters (e.g. "1-3" for chapters
                           1 to 3, or "3" for chapter 3 only,
                           default: all chapters)
       --angle <number>    Select the video angle (DVD or Blu-ray only)
       --previews <#:B>    Select how many preview images are generated,
                           and whether to store to disk (0 or 1).
                           (default: 10:0)
   --start-at-preview <#>  Start encoding at a given preview.
   --start-at    <unit:#>  Start encoding at a given frame, duration
                           (in seconds), or pts (on a 90kHz clock)
   --stop-at     <unit:#>  Stop encoding at a given frame, duration
                           (in seconds), or pts (on a 90kHz clock)
### Destination Options---------------------------------------------------

   -o, --output <string>   Set output file name
   -f, --format <string>   Set output container format (av_mp4/av_mkv)
                           (default: autodetected from file name)
   -m, --markers           Add chapter markers
       --no-markers        Disable preset chapter markers
   -O, --optimize          Optimize mp4 files for HTTP streaming
                           ("fast start")
       --no-optimize       Disable preset 'optimize'
   -I, --ipod-atom         Mark mp4 files so 5.5G iPods will accept them
       --no-ipod-atom      Disable 5.5G iPod tag
   -P, --use-opencl        Use OpenCL where applicable
   -U, --use-hwd           Use DXVA2 hardware decoding
       --no-hwd            Disable DXVA2 hardware decoding

### Video Options------------------------------------------------------------

   -e, --encoder <string>  Set video library encoder
                           Options: x264/qsv_h264/vce_h264/x265/mpeg4/mpeg2/VP8/theora
       --encoder-preset    Adjust video encoding settings for a particular
         <string>          speed/efficiency tradeoff (encoder-specific)
   --encoder-preset-list   List supported --encoder-preset values for the
         <string>          specified video encoder
       --encoder-tune      Adjust video encoding settings for a particular
         <string>          type of souce or situation (encoder-specific)
   --encoder-tune-list     List supported --encoder-tune values for the
         <string>          specified video encoder
   -x, --encopts <string>  Specify advanced encoding options in the same
                           style as mencoder (all encoders except theora):
                           option1=value1:option2=value2
       --encoder-profile   Ensures compliance with the requested codec
         <string>          profile (encoder-specific)
   --encoder-profile-list  List supported --encoder-profile values for the
         <string>          specified video encoder
       --encoder-level     Ensures compliance with the requested codec
         <string>          level (encoder-specific)
   --encoder-level-list    List supported --encoder-level values for the
         <string>          specified video encoder
   -q, --quality <number>  Set video quality
   -b, --vb <kb/s>         Set video bitrate (default: 1000)
   -2, --two-pass          Use two-pass mode
   -T, --turbo             When using 2-pass use "turbo" options on the
                           1st pass to improve speed
                           (works with x264 and x265)
   -r, --rate              Set video framerate
                           (5/10/12/15/20/23.976/24/25/29.97/30/48/50/59.94/60
                           or a number between 1 and 1000).
                           Be aware that not specifying a framerate lets
                           HandBrake preserve a source's time stamps,
                           potentially creating variable framerate video
   --vfr, --cfr, --pfr     Select variable, constant or peak-limited
                           frame rate control. VFR preserves the source
                           timing. CFR makes the output constant rate at
                           the rate given by the -r flag (or the source's
                           average rate if no -r is given). PFR doesn't
                           allow the rate to go over the rate specified
                           with the -r flag but won't change the source
                           timing if it's below that rate.
                           If none of these flags are given, the default
                           is --pfr when -r is given and --vfr otherwise

### Audio Options---------------------------------------------------------

       --audio-lang-list   Specifiy a comma separated list of audio
         <string>          languages you would like to select from the
                           source title. By default, the first audio
                           matching each language will be added to your
                           output. Provide the language's iso639-2 code
                           (fre, eng, spa, dut, et cetera)
                           Use code 'und' (Unknown) to match all languages.
       --all-audio         Select all audio tracks matching languages in
                           the specified language list (--audio-lang-list).
                           Any language if list is not specified.
       --first-audio       Select first audio track matching languages in
                           the specified language list (--audio-lang-list).
                           Any language if list is not specified.
   -a, --audio <string>    Select audio track(s), separated by commas
                           ("none" for no audio, "1,2,3" for multiple
                            tracks, default: first one).
                           Multiple output tracks can be used for one input.
   -E, --aencoder <string> Audio encoder(s):
                               av_aac
                               copy:aac
                               ac3
                               copy:ac3
                               eac3
                               copy:eac3
                               copy:truehd
                               copy:dts
                               copy:dtshd
                               mp3
                               copy:mp3
                               vorbis
                               flac16
                               flac24
                               copy:flac
                               copy
                           copy:* will passthrough the corresponding
                           audio unmodified to the muxer if it is a
                           supported passthrough audio type.
                           Separate tracks by commas.
                           Defaults:
                               av_mp4   av_aac
                               av_mkv   mp3
       --audio-copy-mask   Set audio codecs that are permitted when the
               <string>    "copy" audio encoder option is specified
                           (aac/ac3/eac3/truehd/dts/dtshd/mp3/flac)
                           Separated by commas for multiple allowed options.
       --audio-fallback    Set audio codec to use when it is not possible
               <string>    to copy an audio track without re-encoding.
   -B, --ab <kb/s>         Set audio bitrate(s) (default: depends on the
                           selected codec, mixdown and samplerate)
                           Separate tracks by commas.
   -Q, --aq <quality>      Set audio quality metric.
                           Separate tracks by commas.
   -C, --ac <compression>  Set audio compression metric.
                           selected codec)
                           Separate tracks by commas.
   -6, --mixdown <string>  Format(s) for audio downmixing/upmixing:
                               mono
                               left_only
                               right_only
                               stereo
                               dpl1
                               dpl2
                               5point1
                               6point1
                               7point1
                               5_2_lfe
                           Separate tracks by commas.
                           Defaults:
                               av_aac           up to dpl2
                               ac3              up to 5point1
                               eac3             up to 5point1
                               mp3              up to dpl2
                               vorbis           up to dpl2
                               flac16           up to 7point1
                               flac24           up to 7point1
       --normalize-mix     Normalize audio mix levels to prevent clipping.
              <string>     Separate tracks by commas.
                           0 = Disable Normalization (default)
                           1 = Enable Normalization
   -R, --arate             Set audio samplerate(s)
                           (8/11.025/12/16/22.05/24/32/44.1/48 kHz)
                           Separate tracks by commas.
   -D, --drc <float>       Apply extra dynamic range compression to the
                           audio, making soft sounds louder. Range is 1.0
                           to 4.0 (too loud), with 1.5 - 2.5 being a useful
                           range.
                           Separate tracks by commas.
       --gain <float>      Amplify or attenuate audio before encoding.  Does
                           NOT work with audio passthru (copy). Values are
                           in dB.  Negative values attenuate, positive
                           values amplify. A 1 dB difference is barely
                           audible.
       --adither <string>  Apply dithering to the audio before encoding.
                           Separate tracks by commas.
                           Only supported by some encoders
                           (flac16).
                            Options:
                               auto (default)
                               none
                               rectangular
                               triangular
                               triangular_hp
                               triangular_ns
   -A, --aname <string>    Audio track name(s),
                           Separate tracks by commas.

### Picture Settings------------------------------------------------------

   -w, --width  <number>   Set picture width
   -l, --height <number>   Set picture height
       --crop  <T:B:L:R>   Set cropping values (default: autocrop)
       --loose-crop        Always crop to a multiple of the modulus
       --no-loose-crop     Disable preset 'loose-crop'
       --pad <W:H:C:X,Y>   Add borders to pad image to WxH (e.g. letterbox)
                           Optionally set color of pad to C (default black)
                           Color may be HTML color name or RGB value
                           Optionally set position of image in pad area
                           Any value may be 'auto' in which case the
                           default value for that field is used
   -Y, --maxHeight   <#>   Set maximum height
   -X, --maxWidth    <#>   Set maximum width
   --non-anamorphic        Set pixel aspect ratio to 1:1
   --strict-anamorphic     Store pixel aspect ratio in video stream
   --loose-anamorphic      Store pixel aspect ratio with specified width
   --custom-anamorphic     Store pixel aspect ratio in video stream and
                           directly control all parameters.
   --display-width         Set the width to scale the actual pixels to
     <number>              at playback, for custom anamorphic.
   --keep-display-aspect   Preserve the source's display aspect ratio
                           when using custom anamorphic
  --no-keep-display-aspect Disable preset 'keep-display-aspect'
   --pixel-aspect          Set a custom pixel aspect for custom anamorphic
     <PARX:PARY>           (--display-width and --pixel-aspect are mutually
                           exclusive.
   --itu-par               Use wider, ITU pixel aspect values for loose and
                           custom anamorphic, useful with underscanned
                           sources
   --no-itu-par            Disable preset 'itu-par'
   --modulus               Set the number you want the scaled pixel
                           dimensions
     <number>              to divide cleanly by. Does not affect strict
                           anamorphic mode, which is always mod 2
                           (default: 16)
   -M, --color-matrix      Set the color space signaled by the output
                           Values: 709, pal, ntsc, 601 (same as ntsc)
                           (default: detected from source)

### Filters---------------------------------------------------------------

   --comb-detect           Detect interlace artifacts in frames.
                           If not accompanied by the decomb or deinterlace
                           filters, this filter only logs the interlaced
                           frame count to the activity log.
                           If accompanied by the decomb or deinterlace
                           filters, it causes these filters to selectively
                           deinterlace only those frames where interlacing
                           is detected.
                           Presets:
                             <permissive/fast>
                           Custom Format:
                             <mode=m:spatial-metric=s:motion-thresh=m:
                              spatial-thresh=s:filter-mode=f:block-thresh=b:
                              block-width=b:block-height=b:disable=d>
                           Default:
                             <mode=3:spatial-metric=2:motion-thresh=1:
                              spatial-thresh=1:filter-mode=2:block-thresh=40:
                              block-width=16:block-height=16>
   --no-comb-detect        Disable preset comb-detect filter
   -d, --deinterlace       Deinterlaces using libav yadif.
                           Presets:
                             <skip-spatial/bob/qsv>
                           Custom Format:
                             <mode=m:parity=p>
                           Default:
                             <mode=3>
   --no-deinterlace        Disable preset deinterlace filter
   -5, --decomb            Deinterlaces using a combination of yadif,
                           blend, cubic, or EEDI2 interpolation.
                           Presets:
                             <bob/eedi2/eedi2bob>
                           Custom Format:
                             <mode=m:magnitude-thresh=m:variance-thresh=v:
                              laplacian-thresh=l:dilation-thresh=d:
                              erosion-thresh=e:noise-thresh=n:
                              search-distance=s:postproc=p:parity=p>
                           Default:
                             <mode=7>
   --no-decomb             Disable preset decomb filter
   -9, --detelecine        Detelecine (ivtc) video with pullup filter
                           Note: this filter drops duplicate frames to
                           restore the pre-telecine framerate, unless you
                           specify a constant framerate
                           (--rate 29.97 --cfr)
                           Custom Format:
                             <skip-left=s:skip-right=s:skip-top=s:
                              skip-bottom=s:strict-breaks=s:plane=p:parity=p:
                              disable=d>
                           Default:
                             <skip-left=1:skip-right=1:skip-top=4:
                              skip-bottom=4:plane=0>
   --no-detelecine         Disable preset detelecine filter
   -8, --hqdn3d            Denoise video with hqdn3d filter
                           Presets:
                             <ultralight/light/medium/strong>
                           Custom Format:
                             <y-spatial=y:cb-spatial=c:cr-spatial=c:
                              y-temporal=y:cb-temporal=c:cr-temporal=c>
                           Default:
                             <y-spatial=3:cb-spatial=2:cr-spatial=2:
                              y-temporal=2:cb-temporal=3:cr-temporal=3>
   --no-hqdn3d             Disable preset hqdn3d filter
   --denoise               Legacy alias for '--hqdn3d'
   --nlmeans               Denoise video with nlmeans filter
                           Presets:
                             <ultralight/light/medium/strong>
                           Custom Format:
                             <y-strength=y:y-origin-tune=y:y-patch-size=y:
                              y-range=y:y-frame-count=y:y-prefilter=y:
                              cb-strength=c:cb-origin-tune=c:cb-patch-size=c:
                              cb-range=c:cb-frame-count=c:cb-prefilter=c:
                              cr-strength=c:cr-origin-tune=c:cr-patch-size=c:
                              cr-range=c:cr-frame-count=c:cr-prefilter=c>
                           Default:
                             <y-strength=6:y-origin-tune=1:y-patch-size=7:
                              y-range=3:y-frame-count=2:y-prefilter=0:
                              cb-strength=6:cb-origin-tune=1:cb-patch-size=7:
                              cb-range=3:cb-frame-count=2:cb-prefilter=0>
   --no-nlmeans            Disable preset nlmeans filter
   --nlmeans-tune          Tune nlmeans filter to content type
                           Note: only works in conjunction with presets
                           ultralight/light/medium/strong.
                           Tunes:
                             <none/film/grain/highmotion/animation>
   -7, --deblock           Deblock video with pp7 filter
                           Custom Format:
                             <qp=q:mode=m:disable=d>
                           Default:
                             <qp=5>
   --no-deblock            Disable preset deblock filter
   --rotate                Rotate image or flip its axes.
                           angle rotates clockwise, can be one of:
                              0, 90, 180, 270
                           hflip flips the image on the x axis.
                           Custom Format:
                             <angle=a:hflip=h>
                           Default:
                             <angle=180:hflip=0>
   -g, --grayscale         Grayscale encoding
   --no-grayscale          Disable preset 'grayscale'

### Subtitle Options------------------------------------------------------

      --subtitle-lang-list Specifiy a comma separated list of subtitle
          <string>         languages you would like to select from the
                           source title. By default, the first subtitle
                           matching each language will be added to your
                           output. Provide the language's iso639-2 code
                           (fre, eng, spa, dut, et cetera)
      --all-subtitles      Select all subtitle tracks matching languages in
                           the specified language list
                           (--subtitle-lang-list).
                           Any language if list is not specified.
      --first-subtitle     Select first subtitle track matching languages in
                           the specified language list
                           (--subtitle-lang-list).
                           Any language if list is not specified.
  -s, --subtitle <string>  Select subtitle track(s), separated by commas
                           More than one output track can be used for one
                           input. "none" for no subtitles.
                           Example: "1,2,3" for multiple tracks.
                           A special track name "scan" adds an extra 1st
                           pass. This extra pass scans subtitles matching
                           the language of the first audio or the language 
                           selected by --native-language.
                           The one that's only used 10 percent of the time
                           or less is selected. This should locate subtitles
                           for short foreign language segments. Best used in
                           conjunction with --subtitle-forced.
  -F, --subtitle-forced    Only display subtitles from the selected stream
        <string>           if the subtitle has the forced flag set. The
                           values in "string" are indexes into the
                           subtitle list specified with '--subtitle'.
                           Separate tracks by commas.
                           Example: "1,2,3" for multiple tracks.
                           If "string" is omitted, the first track is
                           forced.
      --subtitle-burned    "Burn" the selected subtitle into the video
        <subtitle>         track. If "subtitle" is omitted, the first
                           track is burned. "subtitle" is an index into
                           the subtitle list specified with '--subtitle'
                           or "native" to burn the subtitle track that may
                           be added by the 'native-language' option.
      --subtitle-default   Flag the selected subtitle as the default
        <number>           subtitle to be displayed upon playback.  Setting
                           no default means no subtitle will be displayed
                           automatically. "number" is an index into the
                           subtitle list specified with '--subtitle'.
  -N, --native-language    Specifiy your language preference. When the first
      <string>             audio track does not match your native language
                           then select the first subtitle that does. When
                           used in conjunction with --native-dub the audio
                           track is changed in preference to subtitles.
                           Provide the language's iso639-2 code:
                               (fre, eng, spa, dut, et cetera)
      --native-dub         Used in conjunction with --native-language
                           requests that if no audio tracks are selected the
                           default selected audio track will be the first
                           one that matches the --native-language. If there
                           are no matching audio tracks then the first
                           matching subtitle track is used instead.
     --srt-file <string>   SubRip SRT filename(s), separated by commas.
     --srt-codeset         Character codeset(s) that the SRT file(s) are
       <string>            encoded in, separated by commas.
                           Use 'iconv -l' for a list of valid
                           codesets. If not specified, 'latin1' is assumed
     --srt-offset          Offset (in milliseconds) to apply to the SRT
       <string>            file(s), separated by commas. If not specified,
                           zero is assumed. Offsets may be negative.
     --srt-lang <string>   SRT track language as an iso639-2 code:
                               (fre, eng, spa, dut, et cetera)
                           Separated by commas. If not specified, then 'und'
                           is used.
     --srt-default         Flag the selected srt as the default subtitle
       <number>            to be displayed upon playback. Setting no default
                           means no subtitle will be automatically displayed
                           If "number" is omitted, the first SRT is the
                           default. "number" is an 1 based index into the
                           'srt-file' list
     --srt-burn            "Burn" the selected SRT subtitle into the
       <number>            video track. If "number" is omitted, the first
                           SRT is burned. "number" is an 1 based index
                           into the 'srt-file' list

### Intel Quick Sync Video------------------------------------------------

   --disable-qsv-decoding  Force software decoding of the video track.
   --enable-qsv-decoding   Allow QSV hardware decoding of the video track.
   --qsv-async-depth       Specifies how many asynchronous operations
                           should be performed before the result is
                           explicitly synchronized.
                           Default: 4. If zero, the value is not specified.