# HandBrakeCLI

HandBrakeCLI is command-line driven interface to a collection of built-in libraries which enables the decoding, encoding and conversion of audio and video streams to MP4 (M4V) and MKV container formats with an emphasis on H.264/MPEG-4 AVC encoding through x264.

## Package installation

Install handbrake-cli from the Official repositories.

## Encoding examples

The factual accuracy of this article or section is disputed.

Reason: Single-pass and Two-pass sections are the same? (Discuss in Talk:HandBrakeCLI#)

### Single-pass x264 (very high-quality)

    HandBrakeCLI -i X-Men.First.Class.2011.vob -o X-Men.First.Class.2011.mkv -E lame -B 160k -6 stereo -R 48000 -e x264 -x b_adapt=2:bframes=8:direct=auto:fast_pskip=0:deblock=-1,-1:psy-rd=1,0.15:me=umh:me_range=24:partitions=all:ref=16:subq=10:trellis=2:rc_lookahead=60:frameref=15:threads=auto -s1 -S 2250 -2 -v2

### Two-pass x264 (very high-quality)

    HandBrakeCLI -i X-Men.First.Class.2011.vob -o X-Men.First.Class.2011.mkv -E lame -B 160k -6 stereo -R 48000 -e x264 -x b_adapt=2:bframes=8:direct=auto:fast_pskip=0:deblock=-1,-1:psy-rd=1,0.15:me=umh:me_range=24:partitions=all:ref=16:subq=10:trellis=2:rc_lookahead=60:frameref=15:threads=auto -s1 -S 2250 -2 -v2

ULTRAFAST TESTING

    HandBrakeCLI -i Hostel.II.vob -o Hostel.II.mkv -E lame -B 128k -6 dpl2 -R 48000 -e x264 -x ref=1:bframes=0:cabac=0:8x8dct=0:weightp=0:me=dia:subq=0:rc-lookahead=0:mbtree=0:analyse=none:trellis=0:aq-mode=0:scenecut=0:no-deblock=1:threads=auto -s1 -S 750 -v

## Adding subtitles

This article or section needs expansion.

Reason: TODO. (Discuss in Talk:HandBrakeCLI#)

## See also

- Official CLI Guide

Category:

- Multimedia

Hidden categories:

- Pages or sections flagged with Template:Accuracy
- Pages or sections flagged with Template:Expansion