GithubHelp home page GithubHelp logo

troymccabe / isolate-mkv-langs Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 9 KB

Use MKVMerge to strip all but specified languages from your .mkvs. [USE AT YOUR OWN RISK]

License: MIT License

Python 100.00%
mkvmerge mkv language track audio subtitles

isolate-mkv-langs's Introduction

isolate-mkv-langs

Use MKVMerge to strip all but specified languages from your .mkvs. [USE AT YOUR OWN RISK]

USE AT YOUR OWN RISK

This worked for my files, but I obviously couldn't test this on yours. Using this script is at your own risk, and I assume no responsibility for lost/damaged files

Usage

  1. Download the repo (or just grab isolate_mkv_langs.py)
  2. From command line: py isolate_mkv_langs.py -d /path/to/mkvs -l 3-char_lang_code -m /path/to/mkvmerge

Help

isolate_mkv_langs.py -d </path/to/mkvs> -l <3-char_lang_code> -m </path/to/mkvmerge>
                  
 Options:
  -d, --dir <folder>            The directory where your MKVs are stored
  -h, --help                    Display help text
  -k, --keep        	        Keep original file
  -l, --langs <languages>       3-character language code (e.g. eng). To retain multiple, separate languages with a comma (e.g. eng,spa)
  -m, --mkvmerge <executable>   The path to the MKVMerge executable

isolate-mkv-langs's People

Contributors

troymccabe avatar

Stargazers

 avatar

Watchers

 avatar  avatar

isolate-mkv-langs's Issues

If Audio is und it will strip out the audio track

I have MKV's with the following mkvmerge json output

{
  "attachments": [],
  "chapters": [],
  "container": {
    "properties": {
      "container_type": 17,
      "duration": 2784416000000,
      "is_providing_timestamps": true,
      "muxing_application": "libebml v1.3.5 + libmatroska v1.4.8",
      "segment_uid": "b988904d51b8b7e6aa66579b40518080",
      "writing_application": "mkvmerge v20.0.0 ('I Am The Sun') 64-bit"
    },
    "recognized": true,
    "supported": true,
    "type": "Matroska"
  },
  "errors": [],
  "file_name": "c:\\TEMP\\Orange\\A Series of Unfortunate Events - S02E01 - The Austere Academy Part One (1080p.WEB-DL.METCON).mkv",
  "global_tags": [],
  "identification_format_version": 11,
  "track_tags": [],
  "tracks": [
    {
      "codec": "MPEG-4p10/AVC/h.264",
      "id": 0,
      "properties": {
        "codec_id": "V_MPEG4/ISO/AVC",
        "codec_private_data": "014d4028ffe10026674d4028e8803c0113f2e02200000300020000030061c0c00059b88001de85251803c60c448001000468ebecb2",
        "codec_private_length": 53,
        "default_duration": 41666666,
        "default_track": true,
        "display_dimensions": "1920x1080",
        "display_unit": 0,
        "enabled_track": true,
        "forced_track": false,
        "language": "und",
        "minimum_timestamp": 0,
        "number": 1,
        "packetizer": "mpeg4_p10_video",
        "pixel_dimensions": "1920x1080",
        "uid": 1838355504502411037
      },
      "type": "video"
    },
    {
      "codec": "AC-3",
      "id": 1,
      "properties": {
        "audio_channels": 6,
        "audio_sampling_frequency": 48000,
        "codec_id": "A_AC3",
        "codec_private_length": 0,
        "default_duration": 32000000,
        "default_track": true,
        "enabled_track": true,
        "forced_track": false,
        "language": "und",
        "minimum_timestamp": 0,
        "number": 2,
        "uid": 1
      },
      "type": "audio"
    },
    {
      "codec": "SubRip/SRT",
      "id": 2,
      "properties": {
        "codec_id": "S_TEXT/UTF8",
        "codec_private_length": 0,
        "default_track": false,
        "enabled_track": true,
        "encoding": "UTF-8",
        "forced_track": false,
        "language": "eng",
        "minimum_timestamp": 6125000000,
        "number": 3,
        "text_subtitles": true,
        "track_name": "English",
        "uid": 18090303752434403640
      },
      "type": "subtitles"
    },
    {
      "codec": "SubRip/SRT",
      "id": 3,
      "properties": {
        "codec_id": "S_TEXT/UTF8",
        "codec_private_length": 0,
        "default_track": false,
        "enabled_track": true,
        "encoding": "UTF-8",
        "forced_track": false,
        "language": "swe",
        "minimum_timestamp": 6166000000,
        "number": 4,
        "text_subtitles": true,
        "track_name": "Swedish",
        "uid": 13343674609987706554
      },
      "type": "subtitles"
    },
    {
      "codec": "SubRip/SRT",
      "id": 4,
      "properties": {
        "codec_id": "S_TEXT/UTF8",
        "codec_private_length": 0,
        "default_track": false,
        "enabled_track": true,
        "encoding": "UTF-8",
        "forced_track": false,
        "language": "nor",
        "minimum_timestamp": 6166000000,
        "number": 5,
        "text_subtitles": true,
        "track_name": "Norwegian",
        "uid": 14190375328162152868
      },
      "type": "subtitles"
    },
    {
      "codec": "SubRip/SRT",
      "id": 5,
      "properties": {
        "codec_id": "S_TEXT/UTF8",
        "codec_private_length": 0,
        "default_track": false,
        "enabled_track": true,
        "encoding": "UTF-8",
        "forced_track": false,
        "language": "ger",
        "minimum_timestamp": 6166000000,
        "number": 6,
        "text_subtitles": true,
        "track_name": "German",
        "uid": 6522050753938359961
      },
      "type": "subtitles"
    },
    {
      "codec": "SubRip/SRT",
      "id": 6,
      "properties": {
        "codec_id": "S_TEXT/UTF8",
        "codec_private_length": 0,
        "default_track": false,
        "enabled_track": true,
        "encoding": "UTF-8",
        "forced_track": false,
        "language": "fin",
        "minimum_timestamp": 6166000000,
        "number": 7,
        "text_subtitles": true,
        "track_name": "Finnish",
        "uid": 17098188466736604796
      },
      "type": "subtitles"
    }
  ],
  "warnings": []
}

In this case the command isolate_mkv_langs.py -d c:\TEMP\Orange -l eng -m "c:\Program Files\MKVToolNix\mkvmerge.exe" will leave me with a video with only the English subtitles but no audio.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.