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
- Mux
mkvvideo,mkaaudio,asssubtitles, and fonts together into a singlemkvfile-
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 aschi - For Traditional Chinese, track name will be
cht, and language is marked aschi - For Japanese, track name will be
jpnand language is marked asjpn - For SC&JP, track name will be
jp_scand language is marked aschi - For TC&JP, track name will be
jp_tcand language is marked aschi - For Russian, track name will be
rusand language is marked asrus
- For Simplified Chinese, track name will be
-
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.
-
-
Download and install MKVToolNix and add its folder to
PATHsystem environment variables- Or, you can copy a
mkvmerge.exefile to the same folder ofmain.py
- Or, you can copy a
-
Take
main.pyinto the work folder where media are stored-
Change the
Global Variablepart 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
Fontssubdirectory after the task is finished ifTrue, otherwise do nothing
- Delete
-
DELETE_ORIGINAL_MKV- Delete the original
mkvfile after the task is finished ifTrue, otherwise move the file intoExtrasubdirectory
- Delete the original
-
DELETE_ORIGINAL_MKA- Delete the original
mkafile after the task is finished ifTrue, otherwise move the file intoExtrasubdirectory
- Delete the original
-
DELETE_SUB- Delete the original
assfile after the task is finished ifTrue, otherwise move the file intoExtrasubdirectory
- Delete the original
-
SUFFIX_NAME- The suffix name in the new multiplexed, to differentiate with the original file;
_Plexwill be used as default ifSUFFIX_NAME = ""
- The suffix name in the new multiplexed, to differentiate with the original file;
-
-
Make sure the name of files used for mux meet the requirements
-
File that name includes the original
mkvfile name is considered as the same group-
e.g.
[Kamigami] Ansatsu Kyoushitsu [00][Ma10p_1080p][x265_flac].mkvand[Kamigami&VCB-Studio] Ansatsu Kyoushitsu [00][Ma10p_1080p][x265_flac].sc.assare 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].mkvare in the same group
-
Based on this rule, if the file is in
assextension, 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.asisKamigami&VCB-Studio,this subtitle track name will bechs Kamigami&VCB-Studio
- The author of
- e.g.
-
-
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)
- Then the program will match the file with same ep number, with the following rule
-
If there's a
Fontssubdirectory, fonts in it will be used as attached fronts- Files only with
ttf,otfandttcextension are considered as fonts
- Files only with
-
If there isn't a
Fontssubdirectory, the program will look for azipor7zfile including keywordFonts, unzip it and use its contents as the attached fonts
-
-
Run
main.pypython main.py

