소스 검색

Merge pull request #1540 from HelloWorld017/sami-fix

Fixed SMI Encoding Bug
Anthony Lavado 5 년 전
부모
커밋
a8014b3942
2개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      CONTRIBUTORS.md
  2. 7 1
      MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs

+ 1 - 0
CONTRIBUTORS.md

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

+ 7 - 1
MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs

@@ -425,7 +425,13 @@ namespace MediaBrowser.MediaEncoding.Subtitles
 
 
             var encodingParam = await GetSubtitleFileCharacterSet(inputPath, language, inputProtocol, cancellationToken).ConfigureAwait(false);
             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;
                 encodingParam = " -sub_charenc " + encodingParam;
             }
             }