| 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:
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.
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:
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.
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:
Examples:
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.
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 |