Try to fix dfxp embedding in mp4 (ismt?) - thx larsk2/VXsz :)

Fix #5253
This commit is contained in:
niksedk 2021-08-10 19:46:51 +02:00
parent 24e2b4faa0
commit ceb2e1741b

View File

@ -76,7 +76,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
// adjust to last exisiting sub
var lastSub = subtitle.GetParagraphOrDefault(subtitle.Paragraphs.Count - 1);
if (lastSub != null)
if (lastSub != null && sub.Paragraphs.Count > 0 && lastSub.StartTime.TotalMilliseconds > sub.Paragraphs[0].StartTime.TotalMilliseconds)
{
sub.AddTimeToAllParagraphs(lastSub.EndTime.TimeSpan);
}
@ -89,6 +89,13 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
}
}
var merged = MergeLinesSameTextUtils.MergeLinesWithSameTextInSubtitle(subtitle, false, 250);
if (merged.Paragraphs.Count < subtitle.Paragraphs.Count)
{
subtitle.Paragraphs.Clear();
subtitle.Paragraphs.AddRange(merged.Paragraphs);
}
subtitle.Renumber();
}