Skip to content

Instantly share code, notes, and snippets.

@klaxa
Created June 4, 2015 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klaxa/6c54f54f6b2b6ace34b5 to your computer and use it in GitHub Desktop.
Save klaxa/6c54f54f6b2b6ace34b5 to your computer and use it in GitHub Desktop.
First generate a list of the timestamps of the I-frames:
mkvinfo -s input.mkv | grep track\ 1 | grep I\ frame | grep -o -E "[0-9]{1,2}\:[0-9]{1,2}\:[0-9]{1,2}\.[0-9]{3}" > I-frames_stripped.txt
Now copy the timestamps you want into another file.
Then you can run:
mkvmerge --split timecodes:$(cat marks.txt) input.mkv -o input_split.mkv
where marks.txt contains your timestamps.
You can then use:
mkvmerge -o combined.mkv input_split-001.mkv + input_split-002.mkv + input_split-003.mkv [...]
to combine your videofiles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment