Skip to main content

Setuptools for mkvsubmerge.

Project description


Split MKV file according to timestamp pairs specified by SRT subtitle file and then merge into a new video file.


  1. Python 3
  2. MKVToolNix


Install latest version:

 pip install mkvsubmerge

For mkvtoolnix installation, see

On macOS you can install mkvtoolnix via brew:

brew install mkvtoolnix


usage: mkvsubmerge [-h] [-o OUT] [--srt SRT]
                   [--srt-encoding SRT_ENCODING]
                   [--start-offset START_OFFSET]
                   [--end-offset END_OFFSET]

positional arguments:
  mkv                   MKV file

optional arguments:
  -h, --help            show this help message and exit
  -o OUT                output MKV file
  --srt SRT             SRT file
  --srt-encoding SRT_ENCODING
                        SRT file encoding
  --start-offset START_OFFSET
                        offset to apply to every start
  --end-offset END_OFFSET
                        offset to apply to every end


# Looks for `` under same directory. Will output to `example_video.surbmerge.mkv` under same directory.
mkvsubmerge example_video.mkv

# Will output to `example_video` under same directory.
mkvsubmerge example_video.mkv --srt

# Will output `output_video.mkv`
mkvsubmerge example_video.mkv --srt -o output_video.mkv

If some sentence appears not complete in the generated video file, chances are that some timestamp falls between two key frames. See for detailed explanation:

Note that mkvmerge(1) only makes decisions about splitting at key frame positions. This applies to both the start and the end of each range. So even if an end timestamp is between two key frames mkvmerge(1) will continue outputting the frames up to but excluding the following key frame.

In that case you can extend every timestamp pair by specifying --start-offset and end-offset to include more key frames.

# This will extend every timestamp pair by two seconds. Every timestamp will start one second earlier and end one second later.
# No need to worry about overlapping/out-of-bounds timestamps as mkvsubmerge will take care of them.
mkvsubmerge example_video.mkv --start-offset -1000 --end-offset 1000



Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mkvsubmerge, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size mkvsubmerge-0.0.3.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page