Giter VIP home page Giter VIP logo

plexmuxy's Introduction

PlexMuxy

PlexMuxy is a Python script to multiplex video with each independent audio, subtitle and fonts in bulk, in order to allow Plex Media Server to present media best in visual.

English README | 中文 README

Feature

  • Mux mkv video, mka audio, ass subtitles, and fonts together into a single mkv file
    • Audio

      • Usually are external 5.1 Channel audio and audio commentary
    • Subtitle

      • Determine the language by file name, including Simplified Chinese, Traditional Chinese, Japanese, SC&JP, TC&JP, Russian

        • For Simplified Chinese, track name will be chs , and language is marked as chi
        • For Traditional Chinese, track name will be cht, and language is marked as chi
        • For Japanese, track name will be jpn and language is marked as jpn
        • For SC&JP, track name will be jp_sc and language is marked as chi
        • For TC&JP, track name will be jp_tc and language is marked as chi
        • For Russian, track name will be rus and language is marked as rus
      • Determine the subtitle author by file name

    • Fonts

      • Fonts will be packaged together as attachments
      • This is designed to allow Plex to fully display the subtitle visual effect, but this is waste significant amount of storage. It is recommended to use font subset instead of full font file.
    • Based on user's setting, remove or move the original files to avoid Plex Server's scanning.

Usage

  • Download and install MKVToolNix and add its folder to PATH system environment variables

    • Or, you can copy a mkvmerge.exe file to the same folder of main.py
  • Take main.py into the work folder where media are stored

    • Change the Global Variable part setting with your own decision, default values are shown below:

      # Global Variable
      DELETE_FONTS = False
      DELETE_ORIGINAL_MKV = False
      DELETE_ORIGINAL_MKA = False
      DELETE_SUB = False
      SUFFIX_NAME = "_Plex"
    • DELETE_FONTS

      • Delete Fonts subdirectory after the task is finished if True, otherwise do nothing
    • DELETE_ORIGINAL_MKV

      • Delete the original mkv file after the task is finished if True, otherwise move the file into Extra subdirectory
    • DELETE_ORIGINAL_MKA

      • Delete the original mka file after the task is finished if True, otherwise move the file into Extra subdirectory
    • DELETE_SUB

      • Delete the original ass file after the task is finished if True, otherwise move the file into Extra subdirectory
    • SUFFIX_NAME

      • The suffix name in the new multiplexed, to differentiate with the original file; _Plex will be used as default if SUFFIX_NAME = ""
  • Make sure the name of files used for mux meet the requirements

    • File that name includes the original mkv file name is considered as the same group

      • e.g.

        • [Kamigami] Ansatsu Kyoushitsu [00][Ma10p_1080p][x265_flac].mkv and [Kamigami&VCB-Studio] Ansatsu Kyoushitsu [00][Ma10p_1080p][x265_flac].sc.ass are in the same group
        • [VCB-Studio] Tenki no Ko [Ma10p_2160p_HDR][x265_flac].mkaand [VCB-Studio] Tenki no Ko [Ma10p_2160p_HDR][x265_flac].mkv are in the same group
      • Based on this rule, if the file is in ass extension, and there's key word matched, the language will be decided. The language decision rule is below in the table:

        • Keywords Decision
          .jpsc, [jpsc], jp_sc, [jp_sc], chs&jap, 简日 jp_sc
          .jptc, [jptc], jp_tc, [jp_tc], cht&jap, 繁日 jp_tc
          .chs, .sc, [chs], [sc], .gb, [gb] chs
          .cht, .tc, [cht], [tc], big5, [big5] cht
          .jp, .jpn, .jap, [jp], [jpn], [jap] jpn
          .ru, .rus, [ru], [rus] rus
      • If the file name starts with [, and the following characters until next ] will be considered as subtitle author and marked in the track name

        • e.g.
          • The author of [Kamigami] Ansatsu Kyoushitsu [00][Ma10p_1080p][x265_flac].sc.as is Kamigami&VCB-Studio,this subtitle track name will be chs Kamigami&VCB-Studio
    • If there's no matching-up file, the program will find the episode number in [02] rule (number included by [])

      • Then the program will match the file with same ep number, with the following rule
        • [02]
        • .02.
        • 02 (space before and after the ep number)
        • 02. (One space before the ep number)
    • If there's a Fonts subdirectory, fonts in it will be used as attached fronts

      • Files only with ttf, otf and ttc extension are considered as fonts
    • If there isn't a Fonts subdirectory, the program will look for a zip or 7z file including keyword Fonts, unzip it and use its contents as the attached fonts

  • Run main.py

    • python main.py

Screenshot

Program running

Subtitle Choices from Plex

plexmuxy's People

Contributors

masterain98 avatar vvyushmanov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

plexmuxy's Issues

MKV Project Folder Enhancement

In response to #2

  • Ask the user to define the language of the film project every time
  • In global settings, add the user's preferred language; use the preferred language subtitle track as the default subtitle
  • In global settings, add the user's preferred track name rules

Configuration persistence & convenience improvement

  • Configuration should be a persistence. Save the configuration file at a proper location
    • Create a default configuration file the first time user run the program and hint the user
  • Expect to run the program at any location of the folder; ask work directory every time before the task starts
  • More personalized configurations should be easier to be modified
    • Subtitle keywords
    • Allowed font extensions

Localization Support

  • Add language support based on the user's system settings
  • Add default languages
    • English
    • Simplified Chinese
  • Opened translation platform

非常好用,但是能否在增加两个小功能!

1.添加音频语言信息,因为我也是拿来封装动漫,基本都是日语;
如果音频没有语言信息的话,plex这里显示不够美观(强迫症!

QQ截图20230704093336

对应到mkvtoolnix这里音频语言为ja:
QQ截图20230704093627

这里为ja的情况下,plex能完美显示:
QQ截图20230704095225

==============================================================================

2.多字幕情况下,能不能只开启一个【默认轨道】字幕(简体/繁体),或者只开启一个强制显示轨道!

QQ截图20230704094430
或者这样:
QQ截图20230704094450

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.