All the fancy video GUI tools transcode. That's just a fact.
The way to avoid that is by using tools which provide control over trancoding. mkvmerge will not transcode anything.
With a little editing, you can manually control edits.
$ more split-mkv
Code:
#!/bin/bash
IN="$1"
ROOT=${IN/%.*/}
# ensure the output file doesn't exist already
if [[ ! -f "$ROOT.mkv" ]] ; then
mkvmerge -o "$ROOT.mkv" \
--split parts:-3:05.0,+4:09.0-6:16.0,+8:20.0-09:10.0,+42:13.0- \
"$IN"
else
echo ERROR: Outfile file exists: "$ROOT.mkv"
fi
Run it as split-mkv some-video-file.mpg The video needs an extension, but it doesn't matter what that extension is, provided it isn't ".mkv". There are ways to ensure the output is always unique - perhaps inserting the PID number after the "ROOT" part? The output file will always be an MKV, but the video and audio inside that container can be anything you like. mkvmerge is crazy flexible at holding stuff. Put video, audio, multiple tracks, multiple subtitles, a text file with metadata, almost anything. In my testing of about 10 different video editors, only mkvmerge correctly dealt with edits of multiple audio tracks AND multiple caption files (ASS or SRT). Every other editor would only make the block cuts for the audio and video. They completely ignored caption and sub files in the cuts.
Just modify the block times as you like. May want to put each block onto a separate line for readability and easy edits later.
So, now that you see the typical mkvmerge command, it is easier to understand that getting the times for blocks we want to keep (or remove) into the correct format is all that remains. The output from 1 small script can feed the input to the next one. That's called using a filter and it is how all Unix pipes work. It is extremely common.
Bookmarks