DVD2MKV(1) User Commands DVD2MKV(1)

dvd2mkv - encode the episodes on DVD rips to named, tagged MKV files

dvd2mkv [OPTIONS] [TITLES_FILE] SOURCE...
dvd2mkv --chapters SPEC [OPTIONS] [TITLES_FILE] SOURCE...
dvd2mkv --movie [OPTIONS] SOURCE...
dvd2mkv --list-presets

dvd2mkv turns a season's worth of DVD rips into one MKV file per episode, named "NN - Title.mkv" and with the MKV title tag set to the episode title.

For each DVD it runs dvdmap, which walks the disc's menus to work out which titles are episodes and in what order (DVD title numbers are often out of episode order, and discs carry bonus and "play all" titles too). The episodes from every SOURCE are numbered in sequence, and episode N gets the Nth name from TITLES_FILE or from the --name options. With --movie each source gives one file, named after the source unless a name is given (see MOVIES). With --chapters each episode is a run of chapters within a title, for discs that put a whole season into one long title (see CHAPTERS). Encoding is done by HandBrakeCLI using a HandBrake preset; the title tag is set afterwards with mkvpropedit(1).

Nothing is encoded unless -y is given. Without it, dvd2mkv prints the plan (see THE PLAN) so you can check the episode order, lengths and audio tracks first.

Each SOURCE is examined to decide what it is:

A directory holding VIDEO_TS/VIDEO_TS.IFO, as made by vobcopy --mirror, or a VIDEO_TS directory itself.
A file ending in .iso. It is read directly; there is no need to mount it.
A directory that is not itself a mirror but contains mirrors and/or ISO images (one level down), such as a season folder holding disc1/, disc2/, ... Each DVD is used in natural name order (so d2 comes before d10).
A file ending in .vob, for example from vobcopy without --mirror. The whole file is one episode. Its length and audio tracks are read with ffprobe(1) when that is installed; languages are not stored in VOB files and show as und.
A directory with no DVDs in it but with .vob files: each file is one episode, in natural name order.
A single mirror or ISO followed by a colon and a comma-separated list of DVD title numbers, e.g. disc3:2,3,5. Those titles are used, in that order, instead of dvdmap's guess. Use this when the guess is wrong, or for a disc where dvdmap finds no episodes.

When a folder is expanded, the plan says how many DVDs or VOB files were found in it.

Names can come from a titles file or from --name options (not both). Without either, the plan is printed without names and nothing can be encoded, except in movie mode.

A plain text file with one episode title per line, in episode order. Blank lines and leading/trailing spaces are ignored. A "/" in a title is written as "-" in the file name, but kept in the title tag.

The titles file is recognised as the first argument when that argument is an ordinary file (not an .iso or .vob). If it is left out, the plan is printed without names, which is handy for looking at a new set of discs before writing the file.

--name

Each --name gives the next episode's name, in order: -n Pilot -n "The Second One" is the same as a two-line titles file. Handy for a disc or two, or for movies.

The number of names must equal the number of episodes found; if not, dvd2mkv prints the plan and then stops with a "count mismatch" error.

With -m, --movie, each SOURCE gives a single file: the longest of the titles dvdmap picked out as reachable from the menus, or the longest title on the disc if it picked none. (A DISC:N source still chooses the title by hand.) A folder of DVDs gives one movie per DVD, so a whole folder of movie rips can be queued at once.

File names have no "NN - " prefix. With a name from --name or a titles file, the file is Name.mkv. Without one, the file keeps the source's own name (alexander.iso becomes alexander.mkv; a VIDEO_TS directory uses its parent's name), and the MKV title tag is tidied from it: underscores, dots and hyphens become spaces, and an all-lower-case name is given capitals (furiosa__a_mad_max_saga becomes "Furiosa a Mad Max Saga"). The plan shows the title tag next to the file name whenever they differ.

Two movies that would get the same file name are an error.

Some discs hold every episode in one long title, one or more chapters each, instead of one title per episode. dvdmap shows such a disc as a single long title with many chapters; dvdmap -c lists the length of every chapter, which makes the episode boundaries easy to see. --chapters then splits each selected title into episodes:

Every N chapters make one episode, in order, for each title that would otherwise be an episode (dvdmap's guess, or the titles given as DISC:TITLES). If a title's chapter count is not a multiple of N, the chapters left at the end form a final shorter episode and the plan flags it, since that usually means N is wrong or the title ends with extras.
Explicit ranges, one per episode, applied to each selected title. Within a list a single number is a one-chapter episode (1-4,5); a one-chapter episode on its own is written 5-5 (a lone number is the count form above). Chapters not covered by any range are not encoded, so trailing extras can simply be left out. A range past the end of a title is an error.

The plan shows each episode as -t T -c lo-hi, with the length of those chapters, so the split can be checked against the titles file before encoding. Episodes are numbered across titles and discs as usual, and --audio-for refers to those numbers. --chapters applies to DVD titles only, not to VOB files, and cannot be combined with --movie.

Chapter markers inside each episode are kept when the preset has them; HandBrake names them by their number on the disc (Chapter 9, Chapter 10, ...), not from 1.

Each episode gets one line:


3 numbers-s03-d01 -t 3 0:41:31 8 chap PAL 16:9 -> 03 - Provenance.mkv
audio: 1 deu AC3 2.0, 2 eng AC3 5.1, 3 spa AC3 2.0 => keep 2,1 (--audio)
subs: 1 dan, 2 deu, 3 eng, 4 spa, 5 fra

That is: episode number, source and DVD title number (-t, as HandBrake counts titles; plus -c and the chapter range with --chapters), length, chapter count, video standard and aspect ratio, and the output file name.

The audio line lists the title's audio tracks as number language codec channels, plus a note for commentary or audio-description tracks. The numbers are the ones HandBrake uses and the ones --audio takes. After => comes the list of tracks that will be encoded, in output order, and where that choice came from: preset, --audio, or --audio-for. The first track kept becomes the default track in the MKV.

The subs line lists subtitle tracks the same way. Tracks are only listed again when they differ from the previous episode on the same disc. --brief leaves out the audio and subtitle lines.

Encode. Without this only the plan is printed.
Write the MKV files (and handbrake.log) to DIR, creating it if needed. Default: the current directory.
Use the HandBrake preset NAME. Presets made in the HandBrake GUI can be used, as well as the built-in ones. Default: Main Mkv or $DVD2MKV_PRESET if set. See PRESETS.
Choose which audio tracks to encode, and in what order, for every episode. See AUDIO TRACK LISTS. Without this the preset decides.
Choose audio tracks for some episodes only. EPISODES are episode numbers as shown in the plan, separated by commas, with ranges allowed: 3, 3,5-7. This option may be given more than once; it overrides --audio for the episodes it names, and a later --audio-for overrides an earlier one.
Name the next episode NAME. Repeat it for each episode, in order. Cannot be combined with a titles file. See NAMES.
Movie mode: one title (the main feature) per source, no number prefix, and names from the sources when none are given. See MOVIES.
Episodes are chapters of each selected title rather than whole titles. SPEC is a count (4 = four chapters per episode) or explicit ranges (1-4,5-8,9-13). See CHAPTERS.
One line per episode in the plan (audio choices are still shown when --audio or --audio-for applies).
List the presets in your HandBrake GUI preset file: which one dvd2mkv uses by default, which one the HandBrake GUI uses by default, a summary of your own presets' audio and subtitle choices, and the names of the built-in presets. Then exit.
Show a short summary of the options, then exit.
Show the version, then exit.

A LIST for --audio or --audio-for is a comma-separated list of items, read left to right. Each item adds tracks to the end of the output, skipping any already added:

That track, as numbered in the plan, e.g. 2.
Every track in that language, given as the three-letter code shown in the plan, e.g. eng, jpn.
Every track not added yet.
Nothing. A list of just none encodes no audio.

Examples:

-a 2
only track 2.
-a eng,all
English tracks first (so English is the default track), then all the others in disc order.
-a eng,jpn
English and Japanese tracks only.
-a 1,3
tracks 1 and 3: e.g. the main audio plus a commentary.
-A 5-8=fra
episodes 5 to 8: French only.

If a list matches nothing on some episode, the plan shows keep NO AUDIO for it. Track numbers can differ from disc to disc; languages are safer for a whole season, and the plan shows exactly what each episode will get.

Every kept track is encoded with the preset's audio settings (encoder, mixdown, bitrate or quality, sample rate, gain and DRC). If the preset lists more than one audio encoder, the first kept track gets all of them and later tracks get only the first one (HandBrake's "secondary encoder" rule), unless the preset turns that rule off.

Presets are looked up in the HandBrake GUI's presets.json (see FILES), which holds both the built-in presets and the ones you made in the GUI. From it dvd2mkv reads what the preset does with audio and subtitles so the plan can show which tracks it keeps, and so --audio can reuse the preset's audio encoder settings. A preset name that is not in the file is an error.

There are two defaults: dvd2mkv uses Main Mkv (or $DVD2MKV_PRESET), and the HandBrake GUI has its own default preset. --list-presets shows both.

A preset can encode one source track more than once: every entry in its audio encoder list makes its own output track. For example a movie preset with Vorbis stereo plus AC3 passthru gives a small stereo track and the original 5.1 track, both from audio track 1. (Only the first kept track gets the extra entries; see AUDIO TRACK LISTS.) Keeping such a preset separate from the one used for TV shows avoids a second, duplicate stereo track on stereo-only discs.

Subtitle tracks are always chosen by the preset.

The preset to use when --preset is not given. Default: Main Mkv.
The HandBrakeCLI command, split on spaces. Default: flatpak run --command=HandBrakeCLI fr.handbrake.ghb. Set it to HandBrakeCLI for a native install. Extra HandBrakeCLI options may be added here, e.g. --stop-at seconds:30 for a quick test.
A HandBrake preset file to read instead of the ones under FILES.

~/.var/app/fr.handbrake.ghb/config/ghb/presets.json
HandBrake GUI presets (flatpak install).
~/.config/ghb/presets.json
HandBrake GUI presets (native install), used if the flatpak file is absent.
HandBrake's log for every encode, appended to.
The file being encoded. It is renamed to its final name once done, so an interrupted run leaves no half-written episode under a real name. Existing output files are skipped, so re-running continues where it stopped.

0
Success (plan shown, or all episodes encoded or skipped).
1
A source could not be read, the episode and title counts differ, or HandBrake failed.
2
Bad options or arguments.

Look at a season's discs before writing a titles file:

dvd2mkv ~/rips/numb3rs/season-03

Check the plan, then encode, keeping English as the first audio track:

dvd2mkv -a eng,all s03.txt ~/rips/numb3rs/season-03
dvd2mkv -y -a eng,all -o ~/tv/numb3rs/s03 s03.txt ~/rips/numb3rs/season-03

Two discs, the second with titles picked by hand, and a commentary track added for episode 3:

dvd2mkv -A 3=1,3 titles.txt disc1 disc2:2,3,5

One movie, named on the command line, with a preset that adds a 5.1 track:

dvd2mkv -m -p "Main Mkv Movie" -n "Master and Commander" ~/rips/master_and_commander

Every movie in a folder of rips, each named after its folder:

dvd2mkv -y -m -p "Main Mkv Movie" -o ~/movies ~/rips/movies/

A disc whose single title 1 holds six episodes of four chapters each, followed by two chapters of extras; look at the chapter lengths first, then split (the extras become a flagged seventh episode with -c 4, so give the ranges explicitly):

dvdmap -c ~/rips/show/disc1
dvd2mkv -c 4 ~/rips/show/disc1:1
dvd2mkv -y -c 1-4,5-8,9-12,13-16,17-20,21-24 titles.txt ~/rips/show/disc1:1

Episodes as separate VOB files, with a different preset:

dvd2mkv -p "H.265 MKV 576p25" titles.txt ~/rips/show/vobs/

HandBrake runs as a flatpak by default, which cannot see /tmp; keep sources and output elsewhere.

Track numbers and languages come from the DVD's IFO files (read by dvdmap), numbered as HandBrake numbers them. A disc whose IFO files are wrong about its streams may differ from what HandBrake finds when it scans.

The plan's preset track choice copies HandBrake's language rules but not every detail (for example, its fallback when no track matches the preset's languages).

dvdmap (run dvdmap --help), HandBrakeCLI (run with --help), mkvpropedit(1), vobcopy(1), ffprobe(1)

2026-10-23 dvd2mkv 0.4.0