Jump to content

Script: Embedded MKV title - clean and set version


ginjaninja

Recommended Posts

ginjaninja

Background

I wanted my movie versions eg. "Directors Cut" to show in UI even if only one version available. This is only possible with Global advanced library option and Embedded Titles...

image.png.137ae941bc93d9251fc4f201946e32a4.png

.However all my embedded [in mkv] titles were all over the place, so I wrote this script to clean embedded names on Video, Audio and Subtitle tracks

image.png.1bcd8f899863dfa83de45544eedb0d69.png

Along the way, the script protects track names containing special words [customisable] and if the subtitle has "forced" in the title sets the forced flag (if language is in preferred list).

Installation

Requires powershell 7 and MKVToolnix (tested with version 73)

Review and edit config.psd1

set track naming tokens and protected names

$logonly=true - just dumps the current tags in emby and mkvs (belt and braces) < use this first and save log

$testmode=true logs what changes would have been made.

Notes

only works on mkvs.

test on a backed up library, mkvpropedit makes changes to track names and removes track properties on the files on your filesystem.

Review the naming logic, it may not be to your preference. If there is no version, i remove the name because i am happy with Emby's default for blank trackname. With a bit of tlc a user could write their own set of rules for how they want their tags cleaned up - the script has the bare bones and builds up an array of mkvpropedit commands to send in one go.

best to use a monospaced font like courier new to view logs.

warning - "mostly only useful for people who have done zero tag maintenance on their mkvs - experienced taggers would probably want to improve the rules in the script".

Issues and Suggestions Welcome - The rules are rudimentary to clean ui for most titles and protect tracks with useful data - stage 1

Examples

Movie version present but not embedded

image.png.71a4607591be9de9e117a7125959f217.pngimage.png.9530c57875b40780f2a8a88931e2b2b9.png

No movie version, but subtitle has a protected name eg 'SDH' or 'Commentary'

image.png.3aef0266dda3f6c17c747e7608aa06eb.pngimage.png.e52c38c90d6c50a238e8a4755ced8e7c.png

Forced Subtitle by trackname but not property in preferred language - now Emby auto selects the forced track

image.png.81502d59667deaafbab5ce2d809a29f7.pngimage.png.e041def62f14a3b285876e5a523cd2eb.png

Changes

 

SetMKVTitlebyVersion v0.0.0.1.zip

Edited by ginjaninja
  • Like 1
  • Thanks 2
Link to comment
Share on other sites

  • 4 weeks later...
ginjaninja

SetMKVTitlebyVersion v0.0.0.2.zip

v0.0.0.2

Added logic to set the language of video, audio and subtitle tracks to either  'mylangauge' when undefined or to the language of the [video|audio] track in safe (non multi video|audio track) scenarios.

Added option to set subtitle tracks with 'sdh' in name to 'default'.

Added function and option to clear segment title (emby doesnt use segment titles so this is purely ocd)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...