HandBrake CLI: install, presets, commands and safe queues
A practical HandBrakeCLI workflow from installation and source scanning to presets, track indexes, queues and output verification.
HandBrakeCLI is HandBrake's command-line video transcoder: give it a source, an output filename and an encoding preset. Download the separate CLI package on Windows or macOS; the official Linux Flatpak includes it. I'd start with one scanned source and an explicit preset, because a command that runs successfully can still select the wrong title, soundtrack or subtitles.
The CLI is useful for repeatable jobs and automation. It doesn't turn HandBrake into a video stream-copy tool, an audio-only converter or a timeline editor, and removing the graphical interface doesn't guarantee a faster encode. The useful difference is control over how you submit the work.
Install the CLI and make sure your terminal can find it
Use the official command-line downloads. The current download page offers a universal macOS disk image, Windows x64 and ARM64 ZIPs, and the Linux Flatpak route. Choose your operating system and processor type; don't look for HandBrakeCLI.exe inside the Windows GUI installer.

| Platform | Setup | First check |
|---|---|---|
| Windows PowerShell | Extract the CLI ZIP to a dedicated folder, then open PowerShell in that folder. | .\HandBrakeCLI.exe --version |
| macOS Terminal | Open the CLI disk image and copy the executable to a permanent folder. Change to that folder. | ./HandBrakeCLI --version |
| Linux, official Flatpak installed | Run the CLI included with fr.handbrake.ghb. | flatpak run --command=HandBrakeCLI fr.handbrake.ghb --version |
The official install guide documents the Flatpak launcher. Its file access also follows Flatpak permissions. If a host terminal can see a source but the Flatpak cannot, check the app's access to that source and destination rather than changing encoder settings.
For a Windows executable outside the current folder, PowerShell accepts a quoted full path with its call operator: & "C:\Tools\HandBrakeCLI\HandBrakeCLI.exe" --version. A quoted path by itself is only a string. Adding the executable's directory to PATH is optional; open a new terminal after a PATH change. Administrator mode isn't the normal solution to “not recognized.”
On macOS, a full executable path works too. If you use a package manager, follow its current package and linking instructions, then check the installed version. Avoid copying a tutorial's old version-specific Cellar or mounted-disk path. Compare an official download's SHA-256 with the checksum for that exact package; a matching filename alone isn't verification.
Check the version, available options and preset names
In the remaining examples, HandBrakeCLI means the working launcher you just checked. Replace it with .\HandBrakeCLI.exe, ./HandBrakeCLI, a full path or the Flatpak prefix as appropriate. These are command examples: substitute your own existing paths and choose new output names.
HandBrakeCLI --version
HandBrakeCLI --help
HandBrakeCLI --preset-list
The command-line reference says options can vary with the operating system and hardware. Your executable's --help is the final check for an option it actually accepts. The online “latest” reference can contain development features absent from an installed release.
Copy the preset's exact, case-sensitive name after -Z and keep quotes around names containing spaces. -Z selects a complete HandBrake preset; --encoder-preset selects an encoder-specific speed/efficiency setting. They aren't interchangeable. Don't assume an old article's “Normal” default or a hardware encoder is available on your system.
Scan the source before encoding a title
A video file usually has one title, while an unprotected disc folder can expose several. Scan all titles before choosing:
HandBrakeCLI -i "source.mkv" -t 0 --min-duration 0
-t 0 scans all titles without encoding; --min-duration 0 includes short titles that the normal duration threshold could hide. Read the title number, duration, dimensions, audio languages and subtitle tracks. A title's language label doesn't distinguish main dialogue from commentary, so check the track description and sample playback too.
To inspect just the chosen title, use HandBrakeCLI -i "source.mkv" -t 1 --scan. Use the title number found in your scan, not a number copied from another disc. The longest title or --main-feature detection can be a starting clue, but neither guarantees the wanted episode or movie. The Linux DVD CLI workflow covers the disc-specific decisions.
Make one deliberate video conversion
After confirming that Fast 1080p30 appears in your preset list, this example encodes title 1 to a new MP4. It explicitly chooses source audio track 1 and omits subtitles:
HandBrakeCLI -i "source.mkv" -t 1 -Z "Fast 1080p30" -a 1 -s none -f av_mp4 -o "delivery-01.mp4"
-i names the source, -t its title, -a its audio track, -s the subtitles, -f the container and -o the output. The preset supplies video and audio settings that the explicit options don't replace. This example is a 1080p/30 delivery starting point; choose another listed preset if you need a different resolution, frame-rate limit, HDR workflow or player compatibility.
For a quick content check, add --start-at seconds:60 --stop-at seconds:30 and use a separate sample filename. That starts at 60 seconds and encodes a 30-second duration; the second number is not the absolute ending timestamp. Choose offsets that exist in your source. Remove both options for the full encode.

Keep input and output different. Create the destination directory beforehand and use an output filename that doesn't exist; don't rely on a shell command to protect an existing file. Quote paths containing spaces, use ordinary straight quotes and hyphen-minus characters, and keep each example on one command line. PowerShell, Command Prompt and Unix shells have different multiline continuation rules.
Bring a custom GUI preset into the CLI
Export the wanted GUI preset to a JSON file, then import that file and select the preset by its stored name:
HandBrakeCLI --preset-import-file "delivery-preset.json" -Z "My Delivery" -i "source.mkv" -t 1 -o "delivery-02.mp4"
“My Delivery” must be the name inside the exported preset, not the JSON filename. --preset-import-gui can import the local GUI preset configuration, but an explicitly exported file makes the chosen configuration easier to identify and move. Use compatible GUI/CLI versions and inspect the log for rejected or substituted settings.
To confirm the CLI sees your custom preset, list the presets in the same command that imports the file.
HandBrakeCLI --preset-import-file "delivery-preset.json" --preset-list
Put the import first. The HandBrake 1.11.2 CLI prints the loaded presets and exits when it reads --preset-list. Include the import again when you run the encode. The preset list goes to standard error, so add 2>&1 before the pipe when filtering it in sh, Bash, or zsh.
A preset stores selection rules, not a promise that audio track 1 is the main mix in every file. Recheck tracks, cropping, dimensions and frame-rate behavior on a different source before treating the preset as a batch recipe.
Select audio and subtitles without confusing the indexes
-a 1,2 selects source audio tracks 1 and 2. Output encoder, bitrate and Mixdown lists correspond to the selected output rows. For automatic audio copying, -E copy uses the codecs allowed by --audio-copy-mask. If HandBrake can't copy a track, it uses a valid --audio-fallback encoder when one is available. HandBrake drops the track when copying fails and the fallback is disabled. Check the saved audio's codec and channels in the target player.
For subtitles, -s 3 selects source subtitle track 3. In -s 3 --subtitle-burned=1, the 1 means the first item in the selected subtitle list: source track 3. It does not mean source track 1. Burning makes that subtitle part of the picture and prevents switching it off.
--subtitle-default=1 instead flags the first selected subtitle as the default; it doesn't burn it. Container and subtitle-format support determine which tracks can remain selectable. Play the delivered file in the intended player and check its subtitle menu, rather than assuming a successful encode proves every subtitle survived. For the container decision, see MKV-to-MP4 track compatibility.
Run a queue with checks between jobs
If the GUI can prepare your jobs, an exported encode queue is a practical alternative to writing a folder loop. The CLI supports HandBrakeCLI --queue-import-file "queue.json". On Windows, use Queue → Options → Export Queue (CLI Only). The ordinary native queue export has a different format. Inspect every source and destination, and ensure those paths exist on the machine running it. A queue already contains job settings; don't expect one extra preset flag to redesign all its jobs.
For shell-driven batches, first list the intended files and convert one representative input. Keep the output folder outside the source tree, preserve enough of each filename to avoid collisions, and don't let a recursive search pick up newly encoded outputs. clip.mkv and clip.mov would collide if both were reduced to clip.mp4.
Run jobs sequentially until you understand the workload. Record a separate log and exit status per job, stop on failure, and inspect any partial output before retrying. Check the last program's status immediately: $LASTEXITCODE in PowerShell, $? in Bash/zsh or ERRORLEVEL in Command Prompt. Don't delete originals automatically after a process merely exits without an error.
Read the log and verify the delivered copy
Capture a diagnostic log by appending 2> "delivery-01.log" to a command, using a new log filename. HandBrake's Activity Log explanation identifies the important evidence: version/build, source scan, selected settings and tracks, encoder messages and completion errors. CLI diagnostics are written to standard error; the log can contain local paths, so inspect it before sharing.
| Problem | First check |
|---|---|
| Command not found / not recognized | Current directory, executable name and launcher syntax; try its full path. |
| Unknown option or preset | Installed --version, local --help, exact preset name and ASCII punctuation. |
| No valid source or title | Quoted input path, read permission, source integrity and the scan's title list. |
| Cannot open destination | Existing parent directory, write permission, free space and a distinct output path; check Flatpak access too. |
| Wrong language, missing subtitles or wrong length | Scanned source indexes, selected title, preset selection rules and leftover sample-range options. |
| Stops during encoding | First meaningful error in the saved log, process exit status and partial output; don't retry blindly over it. |
After a full encode, check duration, resolution, frame rate and retained tracks. Play the start, middle and end; switch audio and subtitles and check synchronization on the receiving device. Once that copy is correct, keep the command, preset JSON and log together. That gives you a repeatable job with evidence of what it produced.



