plextool subs
Three actions for subtitles:
Action |
What it does |
|---|---|
Pull the subtitle tracks embedded in MKV and MP4 files out as separate files. |
|
Copy subtitles that Plex downloaded out of its database and save them next to the video. |
|
Search Plex’s subtitle providers for a language and download one, with a chance to choose. |
All three name files the same way (see Naming) and are a preview
unless --commit is passed.
Handy when:
Subtitles are inside the MKV or MP4 and another player, or another server, cannot use them (
extract).Plex downloaded a subtitle but only Plex can show it, because it is not a file beside the video (
export).A title has no subtitles in the wanted language (
fetch).
Where each subtitle comes from
The three actions read from different places, which is easy to mix up:
Action |
Where the subtitle comes from |
What plextool connects to |
|---|---|---|
|
A track embedded in the video file (MKV or MP4). |
Nothing: it reads the file with |
|
Plex’s subtitle providers on the internet. Plex searches and downloads; plextool just asks it to. |
The Plex server. |
|
The same download, then copied out of the Plex server. |
The Plex server. |
|
Subtitles Plex already has, kept in its database from earlier downloads. |
The Plex server. |
In short:
Only
extractreads the video file.plextool never contacts a subtitle provider itself. Plex does the searching and downloading, then keeps the result in its own database and does not write a file next to the video.
export(andfetch --export) take that stored copy back from the Plex server and save it as a file beside the video. They need to be able to see the video’s folder (see--map).By default
exportonly takes subtitles that came from a provider, or that someone uploaded. Tracks embedded in the video aren’t touched, since the server has no copy to fetch; useextractfor those.--all-externalalso includes subtitle files that were already beside the video.
Tools for extract
Only the tools for the file types in use are needed:
Files |
Needs |
|---|---|
|
|
|
|
If one set is missing, files of that type are skipped with a note saying what to
install, and the rest are processed as normal. It only stops with an error if
none of the files found can be handled. Use --types mkv or --types mp4 to
limit the run to one kind.
extract
$ plextool subs extract /mnt/media/Movies # preview
$ plextool subs extract /mnt/media/Movies --commit
$ plextool subs extract /mnt/media/Movies --commit --scan Movies
Every video under the directory (default: the current one), including all subfolders, is checked. Each subtitle track is saved beside its video.
Naming
These rules apply to all three actions.
Names follow Plex’s rules for external subtitles: the language code, then
.forced or .sdh if the track is flagged that way, then the extension.
Track |
File |
|---|---|
English |
|
English, forced |
|
English, SDH (hearing impaired) |
|
Spanish |
|
French image subtitles (PGS) |
|
A second, otherwise identical English track |
|
A second English SDH track |
|
A track counts as forced or SDH if the file marks it so, or if its name says so, such as “English (SDH)”, “Hearing Impaired”, “Closed Captions” or “Forced”.
A number is added only when two tracks would otherwise get the same name, so flagged tracks don’t get one. The first of a kind has no number, and later ones are 2, 3 and so on. The number goes in front of the language because Plex reads the language from the end of the name.
Language codes are short (
en,fr,pt). Languages with no short code stay three letters, and tracks with no language areund.The extension follows the format:
srt,ass,vtt,sup(PGS), orsub(VobSub, which also writes an.idx). In MP4 files text tracks (usuallymov_text) becomesrt.Image-based subtitles inside MP4 files can’t be turned into usable files. They are listed as skipped.
Options for extract
Option |
Meaning |
|---|---|
|
Where to search. Default is the current directory. |
|
File types to process: |
|
Write the files. Without it only a preview is shown. |
|
Overwrite subtitle files that already exist. By default they are skipped. |
|
After extracting, ask Plex to scan this library so the files appear. |
|
Folder to scan, as the Plex server sees it. Default is the directory searched. Set this if the server mounts the media at a different path. |
Only --scan needs a Plex connection (--token, --base-url). The rest works
without a server.
export
When Plex’s subtitle search is used, the result is stored in Plex’s
database, not beside the video, and can’t be reused elsewhere. export fetches
those stored subtitles back from the Plex server and saves them as ordinary files
next to the video. It does not read the video file and does not contact any
subtitle provider; see Where each subtitle comes from.
$ plextool subs export -t "Some Show" # preview
$ plextool subs export --all --lang eng --commit --scan
$ plextool subs export -l Movies -n 20 --map /data/media=/mnt/media --commit
Choose what to look at with one of -t/--title (a movie, or a show, which means
all its episodes), -g/--guid, -n/--recent N, or --all.
Option |
Meaning |
|---|---|
|
Library to use. Repeat for several. Default is every movie and TV library. |
|
Only this language, eg |
|
Also include subtitle files that were already beside the video. Normally only ones downloaded from a provider are exported. |
|
Translate a path as Plex sees it into one on this machine, eg |
|
Overwrite files that already exist. By default they are skipped. |
|
Afterwards, ask Plex to scan the folders that got new files. |
|
Write the files. |
This command has to be able to reach the video files. If it runs on another
machine, or Plex sees the media under a different path, use --map. A folder
that can’t be found is reported rather than created.
Each item is loaded from the server to read its subtitle list, so --all is
slow on big libraries. Narrow it with -l, -t or -n where possible.
fetch
Searches Plex’s subtitle providers for movies and episodes that have no subtitle in a language, and downloads one into Plex.
Plex keeps what it downloads in its own database and does not write a file next to
the video, so only Plex can use it. Add --export to also save it as a file beside
the video, which other players and servers can use. That needs this machine to be
able to read the media files (see --map).
$ plextool subs fetch -t "Some Movie" --lang en --list # just look
$ plextool subs fetch -t "Some Show" --lang fr --choose --commit
$ plextool subs fetch -n 20 --lang en --sdh prefer --export --commit
Choosing which subtitle
The most popular result isn’t always the right one, so there are three ways to work:
Mode |
What happens |
|---|---|
|
Shows the candidates for each item and stops. Nothing is downloaded. |
|
Shows the candidates for each item and asks which to download. Enter takes #1, a number takes that one, |
(neither) |
Downloads the top-ranked candidate automatically. |
Candidates are ranked with perfect matches first, then by download count
(score). Each line shows the number, a * for a perfect match, the score, the
provider, the format, forced/SDH flags, and the subtitle’s own title (often the
release name, which helps match it to the file).
1 * score 20 OpenSubtitles srt Some.Movie.2020.1080p.BluRay
2 score 5230 OpenSubtitles srt Some.Movie.2020.WEB-DL
3 score 880 OpenSubtitles srt sdh Some.Movie.2020.1080p.BluRay.SDH
Options
Option |
Meaning |
|---|---|
|
Language to look for, eg |
|
Which items, as for |
|
What to do about SDH (hearing impaired) subtitles. |
|
What to do about forced subtitles. |
|
Ignore candidates with a lower download count. Perfect matches are always kept. |
|
Show at most N candidates per item (default 10). |
|
Also search items that already have a subtitle in this language. |
|
After downloading, save the new subtitle beside the video. |
|
With |
|
As for |
Plex downloads in the background. Without --export the command returns once
the downloads are requested. With it, the command waits for each new subtitle to
show up and then saves it. If one hasn’t arrived in time, run subs export
afterwards.
Every item checked means a search against the subtitle provider, so start with
-t or -n before trying --all.