fix(plex): show PGS subtitles when transcoding (#1399)
* fix(plex): show PGS subtitles when transcoding Bitmap subtitles (PGS/VOBSUB) disappeared from the menu while transcoding on Plex, leaving only "Off". The MKV transcode already supports them, so embed them in the stream like text subs. Now they show up and can be turned on. * fix(plex): give bitmap subtitle codecs the right sidecar extension getSubtitleExtension fell back to .srt for vobsub, pgssub and dvb subs. Map them to .sub/.sup so it stays consistent with isImageSubtitleCodec and any sidecar URL or download uses the correct extension.
This commit is contained in:
@@ -21,10 +21,14 @@ class CodecUtils {
|
||||
case 'mov_text':
|
||||
return 'srt';
|
||||
case 'pgs':
|
||||
case 'pgssub':
|
||||
case 'hdmv_pgs_subtitle':
|
||||
return 'sup';
|
||||
case 'dvd_subtitle':
|
||||
case 'dvdsub':
|
||||
case 'vobsub':
|
||||
case 'dvb_sub':
|
||||
case 'dvb_subtitle':
|
||||
return 'sub';
|
||||
default:
|
||||
return 'srt';
|
||||
@@ -39,6 +43,31 @@ class CodecUtils {
|
||||
};
|
||||
}
|
||||
|
||||
/// Image-based (bitmap) subtitle codecs. These can't be converted to text;
|
||||
/// during an HTTP/MKV transcode Plex copies the stream into the container and
|
||||
/// the player renders it natively.
|
||||
static bool isImageSubtitleCodec(String? codec) {
|
||||
if (codec == null) return false;
|
||||
return switch (codec.toLowerCase()) {
|
||||
'pgs' ||
|
||||
'pgssub' ||
|
||||
'hdmv_pgs_subtitle' ||
|
||||
'dvd_subtitle' ||
|
||||
'dvdsub' ||
|
||||
'vobsub' ||
|
||||
'dvb_sub' ||
|
||||
'dvb_subtitle' => true,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
/// Subtitle codecs that can be carried inside the HTTP/MKV transcode stream
|
||||
/// (`subtitles=embedded`): text codecs plus the image codecs the MKV target
|
||||
/// supports. Keyed sidecars are delivered separately and are not covered here.
|
||||
static bool isEmbeddableSubtitleCodec(String? codec) {
|
||||
return isTextSubtitleCodec(codec) || isImageSubtitleCodec(codec);
|
||||
}
|
||||
|
||||
/// Formats a subtitle codec name to a user-friendly display format.
|
||||
///
|
||||
/// Converts internal codec names like 'SUBRIP' to friendly names like 'SRT'.
|
||||
|
||||
Reference in New Issue
Block a user