Handbrake

DVD to MKV

apt install handbrake-cli
 
sudo apt-get install -y libdvd-pkg
sudo dpkg-reconfigure libdvd-pkg
 
# h265 to MKV
for i in {1..99}; do
HandBrakeCLI \
  -t${i} \
  --encoder x265 \
  --format mkv \
  --quality 22 \
  --keep-display-aspect \
  --output "/tmp/${i}.mkv" \
  --chapters 1-99 \
  --subtitle-lang-list "eng,deu" \
  --audio-lang-list "eng,deu" \
  --input VIDEO_TS
done
 
 
#  --rate 23.976 \
#  --aencoder copy \
 
# h264 to MP3
HandBrakeCLI --input DVD_DISC1/VIDEO_TS/ -t1  --encoder x264 --format av_mp4 --quality 22 --aencoder copy  --keep-display-aspect --rate 23.976 --output "Chapter s%.h264"  --chapters 1-99 --subtitle-lang-list "eng,deu"  --audio-lang-list  "eng,deu"
 
# --all-audio
# --all-subtitles

Install from Ubuntu 22.04 repository

echo "deb http://de.archive.ubuntu.com/ubuntu jammy main restricted universe multiverse" | \
    sudo tee /etc/apt/sources.list.d/ubuntu-jammy.list
echo "deb http://de.archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse" | \
    sudo tee /etc/apt/sources.list.d/ubuntu-jammy-updates.list
 
sudo apt update
sudo apt-get install handbrake-cli
sudo rm /etc/apt/sources.list.d/ubuntu-jammy*
sudo apt update

Command line reference
https://mattgadient.com/comparing-x264-rf-settings-in-handbrake-examples/
https://handbrake.fr/docs/en/latest/cli/command-line-reference.html
https://handbrake.fr/docs/en/1.5.0/cli/cli-options.html

for TITLE in echo {1..20}; do
    HandBrakeCLI \
        --input VIDEO_TS  \
        --output /tmp/mwc_${TITLE}.m4v \
        --format av_mp4 \
        --optimize \
        --encoder x264 \
        --encoder-tune film \
        --encoder-level 3.1 \
        --encoder-preset fast \ 
        --two-pass \
        --quality 20 \ 
        --keep-display-aspect \
        --loose-anamorphic \
        --vfr \
        --aencoder mp3 \
        --ab 192 \
        --markers \
        --all-audio \ 
        --all-subtitles \
        --title 0
done
sudo apt install handbrake

#!/bin/bash

sudo apt-add-repository -y ppa:stebbins/handbrake-snapshots
sudo apt-get update -qq
sudo apt-get install -y handbrake-cli handbrake-gtk
>

# apt-get install handbrake-gui

Links
https://handbrake.fr/docs/en/1.3.0/cli/command-line-reference.html
https://handbrake.fr/docs/en/latest/technical/audio-codecs.html
https://handbrake.fr/docs/en/1.3.0/technical/containers.html