mkvtoolnix

MKVToolNix GUI
is a Qt GUI for mkvmerge and a successor of mmg.
mkvmerge
merges multimedia streams into a Matroska file.
mkvinfo
lists all elements contained in a Matroska file.
mkvextract
extracts specific parts from a Matroska file to other formats.
mkvpropedit
allows to analyze and modify some Matroska file properties.

General Format for mkvmerge:

mkvmerge -o video_merged.mkv original.mkv original.srt

where -o or –output file-name is write to the file file-name.

add subs to a video:

mkvmerge -o Max\ Headroom\ -\ S01E01\ -\ Blipverts-merged.mkv Max\ Headroom\ -\ S01E01\ -\ Blipverts.mkv Max\ Headroom\ -\ S01E01\ -\ Blipverts.srt

extract subs from simple file:

mkvmerge -i Star\ Trek\ Lower\ Decks\ -\ S01E01\ -\ Second\ Contact.mkv
mkvextract tracks Star\ Trek\ Lower\ Decks\ -\ S01E01\ -\ Second\ Contact.mkv 2:Star\ Trek\ Lower\ Decks\ -\ S01E01\ -\ Second\ Contact.srt

extract subs from complex file:

mkvmerge -i Cowboy\ Bebop\ (2021)\ -\ S01E01\ -\ Cowboy\ Gospel.mkv
mkvextract tracks Cowboy\ Bebop\ (2021)\ -\ S01E01\ -\ Cowboy\ Gospel.mkv 7:Cowboy\ Bebop\ (2021)\ -\ S01E01\ -\ Cowboy\ Gospel.srt

convert mp4 to mkv with srt:

mkvmerge -o "result.mkv" "orig.mp4" "subs.srt" << reboot

Create comic book files

After downloading comic book or anime images as a mix of .webp and .jpg, run the following:

find . -name "* *" -type f | rename -v -f 's/ /_/g' && for f in *.webp; do dwebp $f -o $f.jpg;done && rename -v 's/\.webp\.jpg/\.jpg/' * && rm *.webp && sudo chown -R jeff:users * && sudo chmod -R 777 *

This will change any spaces to underscores, convert any .webp to .webp.jpg, rename those to just .jpg, set permissions and ownership.

Use the compress option in Gnomes Files to compress the jpg’s into a .zip, then rename the .zip to .cbz

or:

zip bookname.cbz *.jpg

extract subtitles from mkv

Download mkvtoolnix from:

https://mkvtoolnix.download/downloads.html

You can use mkvmerge (from mkvtoolnix) to inspect the file to see what the ID of the subtitles data will be:

mkvmerge -i input.mkv

This will list the tracks, for example like this:

File 'input.mkv': container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AAC)
Track ID 3: subtitles (S_TEXT/UTF8)

Based on the ID of the track, call the following command, where is the one you identified above. You can use any srt filename that you want.

mkvextract tracks input.mkv :.srt

So, in our case, that would have been:

mkvextract tracks input.mkv 3:subs.srt