This article is a draft and may contain incomplete or incorrect information.

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

Usage: HandBrakeCLI [options] -i <source> -o <destination>

General Options --------------------------------------------------------------

   -h, --help              Print help
   --version               Print version
   -v, --verbose[=number]  Be verbose (optional argument: logging level)
   -Z. --preset <string>   Select preset by name (case-sensitive)
                           Enclose names containing spaces in double quotation
                           marks (e.g. "Preset Name")
   -z, --preset-list       List available presets
   --preset-import-file <filespec>
                           Import presets from a json preset file.
                           '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 <string>
                           Create a new preset from command line options and
                           write a json representation of the preset to the
                           console or a file if '--preset-export-file' is
                           specified. The required argument will be the name
                           of the new preset.
   --preset-export-file <filename>
                           Write new preset generated by '--preset-export'
                           to file 'filename'.
   --preset-export-description <string>
                           Add a description to the new preset created with
                           '--preset-export'
   --queue-import-file <filename>
                           Import an encode queue file created by the GUI
       --no-dvdnav         Do not use dvdnav for reading DVDs


Source Options ---------------------------------------------------------------

   -i, --input <string>    Set input file or device ("source")
   -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 <number:boolean>
                           Select how many preview images are generated,
                           and whether to store to disk (0 or 1).
                           (default: 10:0)
   --start-at-preview <number>
                           Start encoding at a given preview.
   --start-at <string:number>
                           Start encoding at a given duration (in seconds),
                           frame, or pts (on a 90kHz clock)
                           (e.g. duration:10, frame:300, pts:900000)
   --stop-at  <string:number>
                           Stop encoding at a given duration (in seconds),
                           frame, or pts (on a 90kHz clock)
                           (e.g. duration:10, frame:300, pts:900000)


Destination Options ----------------------------------------------------------

   -o, --output <filename> Set destination file name
   -f, --format <string>   Select container format:
                               av_mp4
                               av_mkv
                           default: auto-detected from destination file name)
   -m, --markers           Add chapter markers
       --no-markers        Disable preset chapter markers
   -O, --optimize          Optimize MP4 files for HTTP streaming (fast start,
                           s.s. rewrite file to place MOOV atom at beginning)
       --no-optimize       Disable preset 'optimize'
   -I, --ipod-atom         Add iPod 5G compatibility atom to MP4 container
       --no-ipod-atom      Disable iPod 5G atom


Video Options ----------------------------------------------------------------

   -e, --encoder <string>  Select video encoder:
                               x264
                               x265
                               mpeg4
                               mpeg2
                               VP8
                               VP9
                               theora
       --encoder-preset <string>
                           Adjust video encoding settings for a particular
                           speed/efficiency tradeoff (encoder-specific)
   --encoder-preset-list <string>
                           List supported --encoder-preset values for the
                           specified video encoder
       --encoder-tune <string>
                           Adjust video encoding settings for a particular
                           type of source or situation (encoder-specific)
   --encoder-tune-list <string>
                           List supported --encoder-tune values for the
                           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 <string>
                           Ensure compliance with the requested codec
                           profile (encoder-specific)
   --encoder-profile-list <string>
                           List supported --encoder-profile values for the
                           specified video encoder
       --encoder-level <string>
                           Ensures compliance with the requested codec
                           level (encoder-specific)
   --encoder-level-list <string>
                           List supported --encoder-level values for the
                           specified video encoder
   -q, --quality <float>   Set video quality (e.g. 22.0)
   -b, --vb <number>       Set video bitrate in kbit/s (default: 1000)
   -2, --two-pass          Use two-pass mode
       --no-two-pass       Disable two-pass mode
   -T, --turbo             When using 2-pass use "turbo" options on the
                           first pass to improve speed
                           (works with x264 and x265)
       --no-turbo          Disable 2-pass mode's "turbo" first pass
   -r, --rate <float>      Set video framerate
                           (5/10/12/15/20/23.976/24/25/29.97/
                           30/48/50/59.94/60/72/75/90/100/120
                           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 <string>
                           Specify a comma separated list of audio
                           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 ISO 639-2 code
                           (e.g. 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> Select audio encoder(s):
                               none
                               av_aac
                               ca_aac
                               ca_haac
                               copy:aac
                               ac3
                               copy:ac3
                               eac3
                               copy:eac3
                               copy:truehd
                               copy:dts
                               copy:dtshd
                               mp3
                               copy:mp3
                               vorbis
                               flac16
                               flac24
                               copy:flac
                               opus
                               copy
                           "copy:<type>" will pass through the corresponding
                           audio track without modification, if pass through
                           is supported for the audio type.
                           Separate tracks by commas.
                           Defaults:
                               av_mp4   ca_aac/av_aac
                               av_mkv   ca_aac/mp3
       --audio-copy-mask <string>
                           Set audio codecs that are permitted when the
                           "copy" audio encoder option is specified
                           (aac/ac3/eac3/truehd/dts/dtshd/mp3/flac)
                           Separated by commas for multiple allowed options.
       --audio-fallback <string>
                           Set audio codec to use when it is not possible
                           to copy an audio track without re-encoding.
   -B, --ab <number>       Set audio track bitrate(s) in kbit/s.
                           (default: determined by the selected codec, mixdown,
                           and samplerate combination).
                           Separate tracks by commas.
   -Q, --aq <float>        Set audio quality metric.
                           Separate tracks by commas.
   -C, --ac <float>        Set audio compression metric.
                           (available depending on 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:
                               none             up to dpl2
                               av_aac           up to dpl2
                               ca_aac           up to dpl2
                               ca_haac          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
                               opus             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>  Select dithering to apply before encoding audio:
                               auto (default)
                               none
                               rectangular
                               triangular
                               triangular_hp
                               triangular_ns
                           Separate tracks by commas.
                           Supported by encoder(s):
                               flac16
   -A, --aname <string>    Set audio track name(s).
                           Separate tracks by commas.


Picture Options --------------------------------------------------------------

   -w, --width  <number>   Set storage width in pixels
   -l, --height <number>   Set storage height in pixels
       --crop   <top:bottom:left:right>
                           Set picture cropping in pixels
                           (default: automatically remove black bars)
       --loose-crop        Always crop to a multiple of the modulus
       --no-loose-crop     Disable preset 'loose-crop'
   -Y, --maxHeight <number>
                           Set maximum height in pixels
   -X, --maxWidth  <number>
                           Set maximum width in pixels
   --non-anamorphic        Set pixel aspect ratio to 1:1
   --auto-anamorphic       Store pixel aspect ratio that maximizes storage
                           resolution
   --loose-anamorphic      Store pixel aspect ratio that is as close as
                           possible to the source video pixel aspect ratio
   --custom-anamorphic     Store pixel aspect ratio in video stream and
                           directly control all parameters.
   --display-width <number>
                           Set display width in pixels, for custom anamorphic.
                           This determines the display aspect during playback,
                           which may differ from the storage aspect.
   --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 <par_x:par_y>
                           Set pixel aspect for custom anamorphic
                           (--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 <number>      Set storage width and height modulus
                           Dimensions will be made divisible by this number.
                           (default: set by preset, typically 2)
   -M, --color-matrix <string>
                           Set the color space signaled by the output:
                               2020
                               709
                               601
                               ntsc (same as 601)
                               pal
                           (default: auto-detected from source)


Filters Options --------------------------------------------------------------

   --comb-detect[=string]  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[=string]
                           Deinterlace video using libav yadif.
                           Presets:
                               skip-spatial
                               bob
                           Custom Format:
                               mode=m:parity=p
                           Default:
                               mode=3
       --no-deinterlace    Disable preset deinterlace filter
   -5, --decomb[=string]   Deinterlace video 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[=string]
                           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[=string]   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[=string]      Legacy alias for '--hqdn3d'
   --nlmeans[=string]      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 <string> Tune NLMeans filter to content type
                           Tunes:
                               none
                               film
                               grain
                               highmotion
                               animation
                               tape
                               sprite
                           Applies to NLMeans presets only (does not affect
                           custom settings)
   --unsharp[=string]      Sharpen video with unsharp filter
                           Presets:
                               ultralight
                               light
                               medium
                               strong
                               stronger
                               verystrong
                           Custom Format:
                               y-strength=y:y-size=y:cb-strength=c:cb-size=c:
                               cr-strength=c:cr-size=c
                           Default:
                               y-strength=0.25:y-size=7:cb-strength=0.25:
                               cb-size=7
   --no-unsharp            Disable preset unsharp filter
   --unsharp-tune <string> Tune unsharp filter
                           Tunes:
                               none
                               ultrafine
                               fine
                               medium
                               coarse
                               verycoarse
                           Applies to unsharp presets only (does not affect
                           custom settings)
   --lapsharp[=string]     Sharpen video with lapsharp filter
                           Presets:
                               ultralight
                               light
                               medium
                               strong
                               stronger
                               verystrong
                           Custom Format:
                               y-strength=y:y-kernel=y:cb-strength=c:
                               cb-kernel=c:cr-strength=c:cr-kernel=c
                           Default:
                               y-strength=0.2:y-kernel=isolap:cb-strength=0.2:
                               cb-kernel=isolap
   --no-lapsharp           Disable preset lapsharp filter
   --lapsharp-tune <string>
                           Tune lapsharp filter
                           Tunes:
                               none
                               film
                               grain
                               animation
                               sprite
                           Applies to lapsharp presets only (does not affect
                           custom settings)
   -7, --deblock[=string]  Deblock video with pp7 filter
                           Custom Format:
                               qp=q:mode=m:disable=d
                           Default:
                               qp=5
   --no-deblock            Disable preset deblock filter
   --rotate[=string]       Rotate image or flip its axes.
                           angle rotates clockwise, can be one of:
                               0, 90, 180, 270
                           hflip=1 flips the image on the x axis (horizontally).
                           Custom Format:
                               angle=a:hflip=h:disable=d
                           Default:
                               angle=180:hflip=0
   --pad <string>          Pad image with borders (e.g. letterbox).
                           The padding color may be set (default black).
                           Color may be an HTML color name or RGB value.
                           The position of image in pad may also be set.
                           Custom Format:
                               width=w:height=h:color=c:x=x:y=y
   -g, --grayscale         Grayscale encoding
   --no-grayscale          Disable preset 'grayscale'


Subtitles Options ------------------------------------------------------------

  --subtitle-lang-list <string>
                           Specify a comma separated list of subtitle
                           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 ISO 639-2 code
                           (e.g. 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 first
                           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[=string]
                           Only display subtitles from the selected stream
                           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[=number]
                           "Burn" the selected subtitle into the video
                           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[=number or "none"]
                           Flag the selected subtitle as the default
                           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'.
                           "none" may be used to override an automatically
                           selected default subtitle track.
  -N, --native-language <string>
                           Specify your language preference. When the first
                           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 ISO 639-2 code
                           (e.g. 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 <string>
                           Character codeset(s) that the SRT file(s) are
                           encoded as, separated by commas.
                           If not specified, 'latin1' is assumed.
                           Command 'iconv -l' provides a list of valid codesets.
     --srt-offset <string> Offset (in milliseconds) to apply to the SRT
                           file(s), separated by commas. If not specified,
                           zero is assumed. Offsets may be negative.
     --srt-lang <string>   SRT track language as an ISO 639-2 code
                           (e.g. fre, eng, spa, dut, et cetera)
                           If not specified, then 'und' is used.
                           Separate by commas.
     --srt-default[=number]
                           Flag the selected SRT as the default subtitle
                           to be displayed during playback.
                           Setting no default means no subtitle will be
                           automatically displayed. If 'number' is omitted,
                           the first SRT is the default.
                           'number' is a 1-based index into the 'srt-file' list
     --srt-burn[=number]   "Burn" the selected SRT subtitle into
                           the video track.
                           If 'number' is omitted, the first SRT is burned.
                           'number' is a 1-based index into the 'srt-file' list