A few minor "hard burn subs" fixes - thx Leon :)

Fix #5651
This commit is contained in:
niksedk 2021-12-31 20:44:39 +01:00
parent fc783a3de7
commit dc800ee2ed
7 changed files with 25 additions and 16 deletions

View File

@ -799,10 +799,10 @@ Note: Do check free disk space.</WaveFileMalformed>
<DurationInMinutes>Duration in minutes</DurationInMinutes>
</GenerateBlankVideo>
<GenerateVideoWithBurnedInSubs>
<Title>Generate video with burned-in subtile</Title>
<Title>Generate video with burned-in subtitle</Title>
<InfoAssaOff>Note: Advanced Substation Alpha styling supported.</InfoAssaOff>
<InfoAssaOn>Note: Advanced Substation Alpha styling will be used :)</InfoAssaOn>
<XGeneratedWithBurnedInSubs>"{0}" generated with burned-in subtitle.</XGeneratedWithBurnedInSubs>
<XGeneratedWithBurnedInSubsInX>"{0}" generated with burned-in subtitle in {1}.</XGeneratedWithBurnedInSubsInX>
<TimeRemainingMinutes>Time remaining: {0} minutes</TimeRemainingMinutes>
<TimeRemainingSeconds>Time remaining: {0} seconds</TimeRemainingSeconds>
<TimeRemainingMinutesAndSeconds>Time remaining: {0} minutes and {1} seconds</TimeRemainingMinutesAndSeconds>

View File

@ -26,6 +26,7 @@ namespace Nikse.SubtitleEdit.Forms
private StringBuilder _log;
private readonly bool _isAssa;
public string VideoFileName { get; private set; }
public long MillisecondsEncoding { get; private set; }
public GenerateVideoWithHardSubs(Subtitle assaSubtitle, string inputVideoFileName, VideoInfo videoInfo, int? fontSize)
{
@ -241,6 +242,7 @@ namespace Nikse.SubtitleEdit.Forms
progressBar1.Visible = true;
}
var stopWatch = Stopwatch.StartNew();
if (checkBoxTargetFileSize.Checked)
{
RunTwoPassEncoding(assaTempFileName);
@ -253,6 +255,7 @@ namespace Nikse.SubtitleEdit.Forms
progressBar1.Visible = false;
labelPleaseWait.Visible = false;
timer1.Stop();
MillisecondsEncoding = stopWatch.ElapsedMilliseconds;
labelProgress.Text = string.Empty;
groupBoxSettings.Enabled = true;
@ -265,23 +268,31 @@ namespace Nikse.SubtitleEdit.Forms
// ignore
}
if (!_abort && !File.Exists(VideoFileName))
if (_abort)
{
SeLogger.Error(Environment.NewLine + "Generate hard subbed video failed: " + Environment.NewLine + _log?.ToString());
DialogResult = DialogResult.Cancel;
return;
}
DialogResult = _abort ? DialogResult.Cancel : DialogResult.OK;
if (!File.Exists(VideoFileName) || new FileInfo(VideoFileName).Length == 0)
{
SeLogger.Error(Environment.NewLine + "Generate hard subbed video failed: " + Environment.NewLine + _log);
DialogResult = DialogResult.Cancel;
return;
}
DialogResult = DialogResult.OK;
}
private string SuggestNewVideoFileName()
{
var fileName = Path.GetFileNameWithoutExtension(_inputVideoFileName);
fileName += $".burn-in";
fileName += ".burn-in";
fileName += $".{numericUpDownWidth.Value}x{numericUpDownHeight.Value}";
if (comboBoxVideoEncoding.Text == "libx265")
if (comboBoxVideoEncoding.Text == "libx265" || comboBoxVideoEncoding.Text == "hevc_nvenc")
{
fileName += ".x265";
}

View File

@ -32688,7 +32688,8 @@ namespace Nikse.SubtitleEdit.Forms
return;
}
using (var f = new ExportPngXmlDialogOpenFolder(string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.XGeneratedWithBurnedInSubs, Path.GetFileName(form.VideoFileName)), Path.GetDirectoryName(form.VideoFileName), form.VideoFileName))
var encodingTime = new TimeCode(form.MillisecondsEncoding).ToString();
using (var f = new ExportPngXmlDialogOpenFolder(string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.XGeneratedWithBurnedInSubsInX, Path.GetFileName(form.VideoFileName), encodingTime), Path.GetDirectoryName(form.VideoFileName), form.VideoFileName))
{
f.ShowDialog(this);
}

View File

@ -1022,7 +1022,7 @@ namespace Nikse.SubtitleEdit.Logic
Title = "Generate video with burned-in subtitle",
InfoAssaOff = "Note: Advanced Substation Alpha styling supported.",
InfoAssaOn= "Note: Advanced Substation Alpha styling will be used :)",
XGeneratedWithBurnedInSubs = "\"{0}\" generated with burned-in subtitle.",
XGeneratedWithBurnedInSubsInX = "\"{0}\" generated with burned-in subtitle in {1}.",
TimeRemainingMinutes = "Time remaining: {0} minutes",
TimeRemainingSeconds = "Time remaining: {0} seconds",
TimeRemainingMinutesAndSeconds = "Time remaining: {0} minutes and {1} seconds",

View File

@ -2125,8 +2125,8 @@ namespace Nikse.SubtitleEdit.Logic
case "GenerateVideoWithBurnedInSubs/InfoAssaOn":
language.GenerateVideoWithBurnedInSubs.InfoAssaOn = reader.Value;
break;
case "GenerateVideoWithBurnedInSubs/XGeneratedWithBurnedInSubs":
language.GenerateVideoWithBurnedInSubs.XGeneratedWithBurnedInSubs = reader.Value;
case "GenerateVideoWithBurnedInSubs/XGeneratedWithBurnedInSubsInX":
language.GenerateVideoWithBurnedInSubs.XGeneratedWithBurnedInSubsInX = reader.Value;
break;
case "GenerateVideoWithBurnedInSubs/TimeRemainingMinutes":
language.GenerateVideoWithBurnedInSubs.TimeRemainingMinutes = reader.Value;

View File

@ -883,7 +883,7 @@
public string Title { get; set; }
public string InfoAssaOff { get; set; }
public string InfoAssaOn { get; set; }
public string XGeneratedWithBurnedInSubs { get; set; }
public string XGeneratedWithBurnedInSubsInX { get; set; }
public string TimeRemainingMinutes { get; set; }
public string TimeRemainingSeconds { get; set; }
public string TimeRemainingMinutesAndSeconds { get; set; }

View File

@ -146,10 +146,7 @@ namespace Nikse.SubtitleEdit.Logic
}
};
processMakeVideo.StartInfo.Arguments = processMakeVideo.StartInfo.Arguments
.Replace(" ", " ")
.Replace(" ", " ")
.Trim();
processMakeVideo.StartInfo.Arguments = processMakeVideo.StartInfo.Arguments.Trim();
SetupDataReceiveHandler(dataReceivedHandler, processMakeVideo);