Fixed SMI to SRT UTF-16 Encoding bug

This commit is contained in:
Khinenw 2019-07-14 23:05:45 +09:00
parent e94fa791a9
commit 59518ec87e
2 changed files with 8 additions and 1 deletions

View File

@ -27,6 +27,7 @@
- [pjeanjean](https://github.com/pjeanjean)
- [DrPandemic](https://github.com/drpandemic)
- [joern-h](https://github.com/joern-h)
- [Khinenw](https://github.com/HelloWorld017)
# Emby Contributors

View File

@ -425,7 +425,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles
var encodingParam = await GetSubtitleFileCharacterSet(inputPath, language, inputProtocol, cancellationToken).ConfigureAwait(false);
if (!string.IsNullOrEmpty(encodingParam))
// FFmpeg automatically convert character encoding when it is UTF-16
// If we specify character encoding, it rejects with "do not specify a character encoding" and "Unable to recode subtitle event"
if ((inputPath.EndsWith(".smi") || inputPath.EndsWith(".sami")) && (encodingParam == "UTF-16BE" || encodingParam == "UTF-16LE"))
{
encodingParam = "";
}
else if (!string.IsNullOrEmpty(encodingParam))
{
encodingParam = " -sub_charenc " + encodingParam;
}