fix the UTF-16 error while burning ass/ssa subtitles
This commit is contained in:
parent
0e9d9a7897
commit
0af353404c
|
@ -946,7 +946,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
gopArg = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
" -g {0} -keyint_min {0} -sc_threshold 0",
|
||||
state.SegmentLength * Math.Ceiling(Convert.ToDecimal(framerate))
|
||||
Math.Ceiling(state.SegmentLength * framerate.Value)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -980,6 +980,8 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
args += EncodingHelper.GetGraphicalSubtitleParam(state, encodingOptions, codec);
|
||||
}
|
||||
|
||||
// -start_at_zero is necessary to use with -ss when seeking,
|
||||
// otherwise the target position cannot be determined.
|
||||
if (!(state.SubtitleStream != null && state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream))
|
||||
{
|
||||
args += " -start_at_zero";
|
||||
|
|
|
@ -730,6 +730,14 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
|||
{
|
||||
var charset = CharsetDetector.DetectFromStream(stream).Detected?.EncodingName;
|
||||
|
||||
// UTF16 is automatically converted to UTF8 by FFmpeg, do not specify a character encoding
|
||||
if ((path.EndsWith(".ass") || path.EndsWith(".ssa"))
|
||||
&& (string.Equals(charset, "utf-16le", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(charset, "utf-16be", StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
charset = "";
|
||||
}
|
||||
|
||||
_logger.LogDebug("charset {0} detected for {Path}", charset ?? "null", path);
|
||||
|
||||
return charset;
|
||||
|
|
Loading…
Reference in New Issue
Block a user