Last edited: 2025-05-12
For the impatient: jump to the #Guide.
After looking at all the tools available, I have chosen to write my own script for backing up the dvds: dvd2mkv. Let's see why other tools were unsatisfactory.
Why even remux? Why not just make exact copies of the dvds using only dvdbackup? Well, the container used by dvds is MPEG-2, which is not suitable for streaming. Even on a local network (streaming from your NAS to your tv for instance), you will get stuttering. Additionally, remuxing saves space, from my experience remuxing into mkv format saved a little more than 11% space (for my collection that meant > 200G saved). What's more, the dvd structure is pretty weird, movies are split across multiple files, so you can't use standard tools such as ffmpeg to operate on the files. Once you have remuxed into nice single file mkvs it is easy to transcode to formats with better streaming, more space savings ect...
The most important reason for not choosing MakeMKV is that MakeMKV is proprietary software whilst my solution uses 100% libre software. Although part of MakeMKV is open source out of obligation from the GPL, the MakeMKV developpers are clearly antithetic to the ideas of libre software. Indeed, they called the GPL a cancer - citation from source code in mmdvdnav.h: « GPL is cancer. A hacky and otherwise useless glue code to comply with GPL licensing. ». Although I have not tested this yet, my script might be faster than MakeMKV. Before copying the disk, makemkv has to analyze the different movie titles on the disk, which takes a long time, as VOB files are not contiguous and is a kind of weird format, so MakeMKV seems to run through the whole disk to figure out the mapping between VOB files and titles. By comparison, my script just makes a 1 to 1 copy of the disk with dvdbackup then converts it to mkv with mkvmerge. What's more, MakeMKV is a graphical tool and requires multiple manual steps (one click to open the disk, then another to analyse the titles and yet another to backup the titles to mkv) whilst dvd2mkv, being a command line tool, can be fully automated [CLAIM TO CHECK: there's a makemkv-cli package on the AUR]. I also like the fact that two of the tools dvd2mkv uses are quite small: around 2k lines of C code for dvdbackup and around 1.3k lines of C code for lsdvd, which makes it quite hackable (despite my meager C skills and although that turned out to be unnecessary, I was able to change dvdbackup to make it print out the dvd sectors of each title for example).
The issue with Handbrake is that it always transcodes, it cannot simply remux the container. Transcoding is very CPU intensive and very long. I find it more flexible to remux and then transcode as an optional additional step.
I had issues with ffmpeg when converting to mkv container directly where the middle of the file was missing and there were different issues when I converted to mp4 instead. I might not have tested this thoroughly however, so perhaps I should try again, replacing mkvmerge with ffmpeg in dvd2mkv.
Once we have obtained a nice mkv, we may use mkvpropedit from mkvtoolnix to rectify the naming and tagging of audio and subtitle tracks. For instance, you may want to set the the forced tag of a foreign language subtitle track so that in the movie, when the characters speak in the foreign language the subtitles are always activated. mkvpropedit lets you set the language of an audio track, tag an audio track as commentary ect...
When I do transcode, I prefer to use ffmpeg over handbrake but use the one that works best for you. In my opinion, ffmpeg gives you more control and is easier to understand than handbrake, because it uses less abstraction, which may scare people but is good for understanding (read ffmpeg's manual! it's very nice). ffmpeg is a ubiquitous tool and as such has high quality documentation and a million answered questions - if you encounter a problem someone will already have solved it. ffmpeg is installed pretty much everywhere and relatively recent versions are in every every repo (not the case with handbrake on parabola for instance).
See Freedom respecting file formats to use for video - Container for the reasons for which we choose mkv as the container format. When not transcoding, we by definition keep the original audio, video and subtitle codecs.
When transcoding, we use mkv container with AV1 video, Opus audio and WebVTT subtitles for text subtitles, and fallback to VOBSUB if existing subtitles were in an image format. See Freedom respecting file formats to use for video for the full breakdown.
Install dvd2mkv, following the instructions in the README.
On the commandline, naviguate to the directory where you will be putting your dvd rips.
Make a directory:
mkdir remuxed # we put the remuxed dvds here
Identify your optical drive:
lsblk
# the optical drive is usually /dev/sr0, /dev/dvd[0-9]
Mount your optical drive to /media for example:
sudo mount /dev/sr0 /media
Find out the identifier of your movie on TheMovieDataBase (TMDB). Sometimes, it is hard to find the reference of the dvd, for instance, there are many different versions of Cinderella, so you should look at the copyright year written on the dvd to help you, or you can also search by actor/director on TheMovieDataBase and identify the correct movie that way. For the naming, we make a difference between a few types of dvds. This lets us automate a tedious task latter on, bear with me and you'll be glad. Most movies are contained in a single dvd which might come with some optional extras. For these movies, we just use the TMDB identifier. example: "White Fang (1991)" For some movies, we have a dvd with the main movie and a dvd with extras, like the making of for instance. In this case we give the TMDB identifier to the main movie: "Star Wars: Episode II - Attack of the Clones (2002)" and we name the extra disc like so: <TMDB ID>_EXTRAS_<NAME OF EXTRA DVD>. For example: "Star Wars: Episode II - Attack of the Clones (2002)_EXTRAS_From Puppets to Pixels: Digital Characters in 'Episode II' (2002)". If the extra doesn't have a name just put "Making of" or "Bonus" or something. Some very long movies are split accross more than one dvd. For these, we use the TMDB identifier and add _DISC<N>_ eg: "The Lord of the Rings: The Return of the King (2003)_DISC1_", "The Lord of the Rings: The Return of the King (2003)_DISC2_". In our automated future step, the main feature of disc 1 and 2 will be merged into one movie. If this movie also has extras there is no difference, the extras are named like so: "The Lord of the Rings: The Return of the King (2003)_EXTRAS_Appendicies, Fifth Part: The War of the Ring", "The Lord of the Rings: The Return of the King (2003)_EXTRAS_Appendicies, Sixth Part: The Passing of an Age". Some dvds contain multiple movies. For these we use the TMDB identifier and add _MULTIMOVIE_ at the end: "TINTIN1_MULTIMOVIE". Unfortunately these will be have to be delt with manually.
Rip your dvd with dvd2mkv:
dvd2mkv -i /media -o remuxed --name="<NAME>" --min-size=204800
Where <NAME> is the name you found in the step above. If you don't set this name, the name will be set to the title found on the dvd (or the dvd id if the title cannot be found), which can be rather random.
This command will rip every unique title on the dvd, that is it will keep all the extra features on a dvd like making offs, trailers, bonuses ect... If you only care about the main film (the "main feature"), add the -F option.
You might want to adjust the --min-size and --min-duration options to get rid blank titles and other unwanted titles (see dvd2mkv documentation).
Note: if you have previously made an identical backup of a dvd with for example dvdbackup, you can use dvd2mkv on the backup. Say we have put all of our backups in the mirrors/ dir:
for movie in mirrors/*; do
dvd2mkv -i "$movie" -o remuxed --name="$(basename "$movie")" --min-size=204800;
done
One way of getting notified is by opening the optical disk tray when the backup is done. Setup your sudo privileges so you can run sudo eject without typing a password (we need sudo privileges when doing eject because it unmounts the optical drive). Then use this command to do the ripping:
dvd2mkv -i /media -o remuxed --name="<NAME>" --min-size=204800 && sudo eject
Some terminals such as urxvt let you run a custom command when receiving a bell. So if you use urxvt another way of getting notified is to set
URxvt.bell-command: notify-send "rxvt-unicode: bell!"
in your ~/.Xresources and then chain the dvd2mkv command with
printf "\a"
This is useful if you are making your backups on a computer in another room in which you have sshed.
Great! now we can repeat the steps above and rip all our dvd into the remuxed/ directory.
create a movies/ dir
mkdir movies
Now we can merge all the _EXTRAS_ discs and the multidisc (_DISC1_, _DISC2_) movies into a more coherent structure. I wrote this script which follows the kodi naming scheme, kodi_restructure, but feel free to change it according to your needs.
kodi_restructure INPUTDIR OUTPUTDIR
where INPUTDIR is in our case "remuxed" and OUTPUTDIR is in our case "movies".
You'll notice that this script ignores the multimovie dvds. For these, you have to watch the different titles and identify them. For instance, I had this Tintin dvd which contained both "Tintin in America (1992)" and "Cigars of the Pharaoh (1991)". After ripping, the directory looked like this:
remuxed/Tintin1
---- title1.mkv
---- title2.mkv
I had to skim the titles to know which corresponded to which movie and then I renamed each title accordingly.
mkdir "movies/Cigars of the Pharaoh (1991)" "movies/Tintin in America (1992)"
mv remuxed/Tintin1/title1.mkv "movies/Cigars of the Pharaoh (1991)/Cigars of the Pharaoh (1991).mkv"
mv remuxed/Tintin1/title2.mkv "movies/Tintin in America (1992)/Tintin in America (1992).mkv"
rmdir remuxed/Tintin1
Important note: in the case of a long movie split accross multiple discs, my kodi_restructure script only works if the discs have their tracks numbered the same way. Let me give you an example. Let's say your movie is The Lord of the Rings, which has 2 discs. Normally, both discs will have the same number of video tracks and audio tracks, and if we have the following audio tracks for disc 1:
audio track 1: english
audio track 2: french
audio track 3: spanish
audio track 4: german
then we should have the same numbering for disc 2
If this is not the case, when we merge our discs together using the default mapping, then at the middle of your movie the language will change. So, if your discs don't have the same track numbering you have to use mkvmerge manually specifying the mapping with the --append-to option.
Now we are pretty much done. You can optionally go through your mkv files and use mkvpropedit from mkvtoolnix to rectify the naming and tagging of audio and subtitle tracks. For instance, you may want to set the the forced tag of a foreign language subtitle track so that in the movie, when the characters speak in the foreign language the subtitles are always activated. mkvpropedit lets you set the language of an audio track, tag an audio track as commentary ect...
You can also transcode your movies with ffmpeg if you wish:
for mkv_file in movies/**/*.mkv; do
SOME_FFMPEG_COMMAND "$mkv_file";
done
Hope this guide was helpful! Feel free to contact me if you have some improvements to suggest or questions, see contact info on dvd2mkv repo.