diff --git a/src/libse/SubtitleFormats/RhozetHarmonic.cs b/src/libse/SubtitleFormats/RhozetHarmonic.cs
index 170865f60..f5d79b817 100644
--- a/src/libse/SubtitleFormats/RhozetHarmonic.cs
+++ b/src/libse/SubtitleFormats/RhozetHarmonic.cs
@@ -142,11 +142,11 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
{
try
{
- if (node.Attributes != null)
+ if (node.Attributes?["Title"] != null)
{
- string text = node.Attributes.GetNamedItem("Title").InnerText.Trim();
- string start = node.Attributes.GetNamedItem("StartTimecode").InnerText;
- string end = node.Attributes.GetNamedItem("EndTimecode").InnerText;
+ var text = node.Attributes.GetNamedItem("Title").InnerText.Trim();
+ var start = node.Attributes.GetNamedItem("StartTimecode").InnerText;
+ var end = node.Attributes.GetNamedItem("EndTimecode").InnerText;
subtitle.Paragraphs.Add(new Paragraph(DecodeTimeCodeFrames(start, splitChars), DecodeTimeCodeFrames(end, splitChars), text));
}
}
diff --git a/src/ui/Forms/GenerateVideoWithSoftSubs.Designer.cs b/src/ui/Forms/GenerateVideoWithSoftSubs.Designer.cs
index fd0841108..7b450e57d 100644
--- a/src/ui/Forms/GenerateVideoWithSoftSubs.Designer.cs
+++ b/src/ui/Forms/GenerateVideoWithSoftSubs.Designer.cs
@@ -78,14 +78,9 @@ namespace Nikse.SubtitleEdit.Forms
this.nTSC720x480ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.x352ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.x272ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.contextMenuStripForm = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.closeWindowAfterGenerateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.defaultSaveInMatroskamkvToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.defaultSaveInMp4ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBoxSettings.SuspendLayout();
this.contextMenuSubtitles.SuspendLayout();
this.contextMenuStripRes.SuspendLayout();
- this.contextMenuStripForm.SuspendLayout();
this.SuspendLayout();
//
// buttonGenerate
@@ -510,46 +505,11 @@ namespace Nikse.SubtitleEdit.Forms
this.x272ToolStripMenuItem.Size = new System.Drawing.Size(203, 22);
this.x272ToolStripMenuItem.Text = "640x272";
//
- // contextMenuStripForm
- //
- this.contextMenuStripForm.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.closeWindowAfterGenerateToolStripMenuItem,
- this.defaultSaveInMatroskamkvToolStripMenuItem,
- this.defaultSaveInMp4ToolStripMenuItem});
- this.contextMenuStripForm.Name = "contextMenuStripForm";
- this.contextMenuStripForm.Size = new System.Drawing.Size(238, 70);
- //
- // closeWindowAfterGenerateToolStripMenuItem
- //
- this.closeWindowAfterGenerateToolStripMenuItem.Checked = true;
- this.closeWindowAfterGenerateToolStripMenuItem.CheckOnClick = true;
- this.closeWindowAfterGenerateToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
- this.closeWindowAfterGenerateToolStripMenuItem.Name = "closeWindowAfterGenerateToolStripMenuItem";
- this.closeWindowAfterGenerateToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
- this.closeWindowAfterGenerateToolStripMenuItem.Text = "Close window after generate";
- //
- // defaultSaveInMatroskamkvToolStripMenuItem
- //
- this.defaultSaveInMatroskamkvToolStripMenuItem.Checked = true;
- this.defaultSaveInMatroskamkvToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
- this.defaultSaveInMatroskamkvToolStripMenuItem.Name = "defaultSaveInMatroskamkvToolStripMenuItem";
- this.defaultSaveInMatroskamkvToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
- this.defaultSaveInMatroskamkvToolStripMenuItem.Text = "Default save in Matroska (mkv)";
- this.defaultSaveInMatroskamkvToolStripMenuItem.Click += new System.EventHandler(this.defaultSaveInMatroskamkvToolStripMenuItem_Click);
- //
- // defaultSaveInMp4ToolStripMenuItem
- //
- this.defaultSaveInMp4ToolStripMenuItem.Name = "defaultSaveInMp4ToolStripMenuItem";
- this.defaultSaveInMp4ToolStripMenuItem.Size = new System.Drawing.Size(237, 22);
- this.defaultSaveInMp4ToolStripMenuItem.Text = "Default save in mp4";
- this.defaultSaveInMp4ToolStripMenuItem.Click += new System.EventHandler(this.defaultSaveInMp4ToolStripMenuItem_Click);
- //
// GenerateVideoWithSoftSubs
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(869, 439);
- this.ContextMenuStrip = this.contextMenuStripForm;
this.Controls.Add(this.groupBoxSettings);
this.Controls.Add(this.buttonGenerate);
this.Controls.Add(this.buttonCancel);
@@ -569,7 +529,6 @@ namespace Nikse.SubtitleEdit.Forms
this.groupBoxSettings.PerformLayout();
this.contextMenuSubtitles.ResumeLayout(false);
this.contextMenuStripRes.ResumeLayout(false);
- this.contextMenuStripForm.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -622,11 +581,7 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.Button buttonSetDefault;
private System.Windows.Forms.ToolStripMenuItem toggleForcedToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toggleDefaultToolStripMenuItem;
- private System.Windows.Forms.ContextMenuStrip contextMenuStripForm;
- private System.Windows.Forms.ToolStripMenuItem closeWindowAfterGenerateToolStripMenuItem;
private System.Windows.Forms.Button buttonSetLanguage;
private System.Windows.Forms.ToolStripMenuItem setLanguageToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem defaultSaveInMatroskamkvToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem defaultSaveInMp4ToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/src/ui/Forms/GenerateVideoWithSoftSubs.cs b/src/ui/Forms/GenerateVideoWithSoftSubs.cs
index 7975f45a5..bc6d77bf1 100644
--- a/src/ui/Forms/GenerateVideoWithSoftSubs.cs
+++ b/src/ui/Forms/GenerateVideoWithSoftSubs.cs
@@ -355,11 +355,6 @@ namespace Nikse.SubtitleEdit.Forms
groupBoxSettings.Enabled = true;
return;
}
-
- if (closeWindowAfterGenerateToolStripMenuItem.Checked)
- {
- DialogResult = DialogResult.OK;
- }
}
private static string GetTargetVideoFilter()
@@ -381,8 +376,9 @@ namespace Nikse.SubtitleEdit.Forms
{
var fileName = Path.GetFileNameWithoutExtension(_inputVideoFileName);
fileName += ".embed";
- fileName += defaultSaveInMatroskamkvToolStripMenuItem.Checked ? ".mkv" : ".mp4";
- return fileName.Replace(".", "_");
+ fileName = fileName.Replace(".", "_");
+ fileName += Configuration.Settings.Tools.GenVideoEmbedOutputExt == ".mp4" ? ".mp4" : ".mkv";
+ return fileName;
}
private void RunEmbedding()
@@ -757,17 +753,5 @@ namespace Nikse.SubtitleEdit.Forms
buttonSetDefault.Enabled = count == 1;
buttonSetLanguage.Enabled = count > 0;
}
-
- private void defaultSaveInMatroskamkvToolStripMenuItem_Click(object sender, EventArgs e)
- {
- defaultSaveInMatroskamkvToolStripMenuItem.Checked = true;
- defaultSaveInMp4ToolStripMenuItem.Checked = false;
- }
-
- private void defaultSaveInMp4ToolStripMenuItem_Click(object sender, EventArgs e)
- {
- defaultSaveInMatroskamkvToolStripMenuItem.Checked = false;
- defaultSaveInMp4ToolStripMenuItem.Checked = true;
- }
}
}
diff --git a/src/ui/Forms/GenerateVideoWithSoftSubs.resx b/src/ui/Forms/GenerateVideoWithSoftSubs.resx
index 7fa142499..8fdf49b1b 100644
--- a/src/ui/Forms/GenerateVideoWithSoftSubs.resx
+++ b/src/ui/Forms/GenerateVideoWithSoftSubs.resx
@@ -123,7 +123,4 @@
104, 17
-
- 442, 17
-
\ No newline at end of file
diff --git a/src/ui/Logic/VideoPreviewGenerator.cs b/src/ui/Logic/VideoPreviewGenerator.cs
index ced2238b5..351014798 100644
--- a/src/ui/Logic/VideoPreviewGenerator.cs
+++ b/src/ui/Logic/VideoPreviewGenerator.cs
@@ -276,17 +276,15 @@ namespace Nikse.SubtitleEdit.Logic
var subsMeta = string.Empty;
var subsFormat = string.Empty;
- //TODO: check number of audio + video tracks!
var ffmpegInfo = FfmpegMediaInfo.Parse(inputVideoFileName);
- var videoTrackCount = ffmpegInfo.Tracks.Count(p => p.TrackType == FfmpegTrackType.Video);
var audioTrackCount = ffmpegInfo.Tracks.Count(p => p.TrackType == FfmpegTrackType.Audio);
var isMp4 = outputVideoFileName.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase);
- var count = 0;
+ var count = 1;
+ var number = 0;
foreach (var softSub in softSubs)
{
- count++;
subsInput += $" -i \"{softSub.FileName}\"";
subsMap += $" -map {count}";
@@ -296,7 +294,7 @@ namespace Nikse.SubtitleEdit.Logic
var threeLetterCode = Iso639Dash2LanguageCode.GetThreeLetterCodeFromTwoLetterCode(lang);
if (lang.Length == 3)
{
- threeLetterCode = softSub.Language;
+ threeLetterCode = lang;
}
var languageName = Iso639Dash2LanguageCode.List.FirstOrDefault(p => p.ThreeLetterCode == threeLetterCode)?.EnglishName;
@@ -307,25 +305,25 @@ namespace Nikse.SubtitleEdit.Logic
if (!string.IsNullOrEmpty(threeLetterCode) && !string.IsNullOrEmpty(languageName))
{
- subsMeta += $" -metadata:s:s:{count - 1} language=\"{threeLetterCode}\"";
- subsMeta += $" -metadata:s:s:{count - 1} title=\"{languageName}\"";
+ subsMeta += $" -metadata:s:s:{number} language=\"{threeLetterCode}\"";
+ subsMeta += $" -metadata:s:s:{number} title=\"{languageName}\"";
}
else if (!string.IsNullOrEmpty(softSub.Language))
{
- subsMeta += $" -metadata:s:s:{count - 1} language=\"{softSub.Language}\"";
- subsMeta += $" -metadata:s:s:{count - 1} title=\"{softSub.Language}\"";
+ subsMeta += $" -metadata:s:s:{number} language=\"{softSub.Language}\"";
+ subsMeta += $" -metadata:s:s:{number} title=\"{softSub.Language}\"";
}
}
if (softSub.IsDefault)
{
- subsMeta += $" -disposition:s:s:{count - 1} default";
+ subsMeta += $" -disposition:s:s:{number} default";
}
if (softSub.IsForced)
{
- subsMeta += $" -disposition:s:s:{count - 1} forced";
- subsMeta += $" -metadata:s:s:{count - 1} forced=1";
+ subsMeta += $" -disposition:s:s:{number} forced";
+ subsMeta += $" -metadata:s:s:{number} forced=1";
}
if (isMp4)
@@ -334,25 +332,28 @@ namespace Nikse.SubtitleEdit.Logic
}
else if (softSub.SubtitleFormat == null && softSub.Format == "Blu-ray sup")
{
- subsFormat += $" -c:s:s:{count - 1} copy"; // should be "pgs" or "pgssub" or ?
+ subsFormat += $" -c:s:s:{number} copy"; // should be "pgs" or "pgssub" or ?
}
else if (softSub.SubtitleFormat?.GetType() == typeof(SubRip))
{
- subsFormat += $" -c:s:s:{count - 1} srt";
+ subsFormat += $" -c:s:s:{number} srt";
}
else if (softSub.SubtitleFormat?.GetType() == typeof(AdvancedSubStationAlpha))
{
- subsFormat += $" -c:s:s:{count - 1} ass";
+ subsFormat += $" -c:s:s:{number} ass";
}
else if (softSub.SubtitleFormat?.GetType() == typeof(SubStationAlpha))
{
- subsFormat += $" -c:s:s:{count - 1} ssa";
+ subsFormat += $" -c:s:s:{number} ssa";
}
else if (softSub.SubtitleFormat?.GetType() == typeof(WebVTT) ||
softSub.SubtitleFormat?.GetType() == typeof(WebVTTFileWithLineNumber))
{
- subsFormat += $" -c:s:s:{count - 1} webvtt";
+ subsFormat += $" -c:s:s:{number} webvtt";
}
+
+ count++;
+ number++;
}
subsInput = " " + subsInput.Trim();
@@ -384,7 +385,7 @@ namespace Nikse.SubtitleEdit.Logic
StartInfo =
{
FileName = GetFfmpegLocation(),
- Arguments = $"-i \"{inputVideoFileName}\"{subsInput} -map 0:v -map 0:a{subsMap} -c:v copy -c:a copy{subsFormat}{subsMeta} \"{outputVideoFileName}\"".TrimStart(),
+ Arguments = $"-i \"{inputVideoFileName}\"{subsInput} -map 0 -c copy{subsMap}{subsFormat}{subsMeta} \"{outputVideoFileName}\"".TrimStart(),
UseShellExecute = false,
CreateNoWindow = true,
}