This commit is contained in:
niksedk 2023-03-11 13:17:38 +01:00
parent 3ff0251030
commit 8fe5fa0319
4 changed files with 45 additions and 20 deletions

View File

@ -2,7 +2,8 @@
3.6.12 (xth March 2023) BETA
* NEW:
* Add Whsper via GPU (ConstMe, windows only) - thx albino1/darnn/smith02ct
* Add embedding of subtitles in video files - thx David
* Add Whisper via GPU (ConstMe, windows only) - thx albino1/darnn/smith02ct
* Allow video cut when exporting video with burned-in sub - thx Daniela/David/Leon
* Batch convert: Image based format to png with time code - thx Ninelpienel
* Add new shortcut for split + auto-br - thx oep42

View File

@ -41,10 +41,10 @@ namespace Nikse.SubtitleEdit.Forms
Text = LanguageSettings.Current.GenerateVideoWithEmbeddedSubs.Title;
labelInputVideoFile.Text = LanguageSettings.Current.GenerateVideoWithEmbeddedSubs.InputVideoFile;
labelSubtitles.Text = string.Empty;
buttonAddSubtitles.Text = LanguageSettings.Current.DvdSubRip.Add;
buttonAddSubtitles.Text = LanguageSettings.Current.DvdSubRip.Add;
ButtonRemoveSubtitles.Text = LanguageSettings.Current.SubStationAlphaStyles.Remove;
buttonClear.Text = LanguageSettings.Current.SubStationAlphaStyles.RemoveAll;
ButtonMoveSubUp.Text = LanguageSettings.Current.DvdSubRip.MoveUp;
ButtonMoveSubUp.Text = LanguageSettings.Current.DvdSubRip.MoveUp;
ButtonMoveSubDown.Text = LanguageSettings.Current.DvdSubRip.MoveDown;
buttonToggleForced.Text = LanguageSettings.Current.GenerateVideoWithEmbeddedSubs.ToggleForced;
buttonSetDefault.Text = LanguageSettings.Current.GenerateVideoWithEmbeddedSubs.ToggleDefault;
@ -80,10 +80,7 @@ namespace Nikse.SubtitleEdit.Forms
private void LoadVideo(string inputVideoFileName)
{
listViewSubtitles.Items.Clear();
_softSubs = new List<VideoPreviewGeneratorSub>();
if (!File.Exists(inputVideoFileName))
if (string.IsNullOrEmpty(inputVideoFileName) || !File.Exists(inputVideoFileName))
{
return;
}
@ -95,6 +92,7 @@ namespace Nikse.SubtitleEdit.Forms
}
textBoxInputFileName.Text = inputVideoFileName;
buttonGenerate.Enabled = true;
_inputVideoFileName = inputVideoFileName;
_videoInfo = videoInfo;
@ -147,7 +145,7 @@ namespace Nikse.SubtitleEdit.Forms
var item = new ListViewItem
{
Tag = sub.Tag,
Text = sub.SubtitleFormat != null ? sub.SubtitleFormat.Name : sub.Name,
Text = sub.SubtitleFormat != null ? sub.SubtitleFormat.Name : sub.Format,
};
item.SubItems.Add(GetDisplayLanguage(sub.Language));
item.SubItems.Add(sub.IsDefault.ToString(CultureInfo.InvariantCulture));
@ -191,6 +189,28 @@ namespace Nikse.SubtitleEdit.Forms
private void AddListViewItem(string fileName)
{
if (string.IsNullOrEmpty(fileName) || !File.Exists(fileName))
{
return;
}
if (fileName.EndsWith(".sup", StringComparison.OrdinalIgnoreCase) &&
FileUtil.IsBluRaySup(fileName))
{
AddListViewItem(new VideoPreviewGeneratorSub
{
Name = Path.GetFileName(fileName),
Language = "eng", //TODO: get from file name or sup
Format = "Blu-ray sup",
SubtitleFormat = null,
IsNew = true,
IsForced = false,
IsDefault = false,
FileName = fileName,
});
return;
}
var subtitle = Subtitle.Parse(fileName);
if (subtitle == null || subtitle.Paragraphs.Count == 0)
{
@ -263,7 +283,7 @@ namespace Nikse.SubtitleEdit.Forms
using (var saveDialog = new SaveFileDialog
{
FileName = SuggestNewVideoFileName(),
Filter = GetTargetVideoFilter(),
Filter = GetTargetVideoFilter(),
AddExtension = true
})
{
@ -312,7 +332,7 @@ namespace Nikse.SubtitleEdit.Forms
if (!File.Exists(VideoFileName) || new FileInfo(VideoFileName).Length == 0)
{
SeLogger.Error(Environment.NewLine + "Generate embedded video failed: " + Environment.NewLine + _log);
MessageBox.Show("Generate embedded video failed" + Environment.NewLine +
MessageBox.Show("Generate embedded video failed" + Environment.NewLine +
"For more info see the error log: " + SeLogger.ErrorFile);
buttonGenerate.Enabled = true;
groupBoxSettings.Enabled = true;
@ -441,13 +461,14 @@ namespace Nikse.SubtitleEdit.Forms
if (!File.Exists(_inputVideoFileName))
{
MessageBox.Show(string.Format(LanguageSettings.Current.Main.FileNotFound, _inputVideoFileName));
buttonGenerate.Enabled = false;
return;
}
else
{
buttonGenerate.Focus();
}
UiUtil.FixFonts(groupBoxSettings, 2000);
buttonGenerate.Focus();
}
private void buttonOpenVideoFile_Click(object sender, EventArgs e)

View File

@ -1757,7 +1757,7 @@ namespace Nikse.SubtitleEdit.Forms
openSecondSubtitleToolStripMenuItem.Text = _language.Menu.Video.OpenSecondSubtitle;
generateBlankVideoToolStripMenuItem.Text = _language.Menu.Video.GenerateBlankVideo;
generateVideoWithHardcodedSubtitleToolStripMenuItem.Text = _language.Menu.Video.GenerateVideoWithBurnedInSub;
generateVideoWithHardcodedSubtitleToolStripMenuItem.Text = _language.Menu.Video.GenerateVideoWithEmbeddedSubs;
generateVideoWithSoftcodedSubtitlesToolStripMenuItem.Text = _language.Menu.Video.GenerateVideoWithEmbeddedSubs;
videoaudioToTextToolStripMenuItem.Text = string.Format(_language.Menu.Video.VideoAudioToTextX, "Vosk/Kaldi");
audioToTextWhisperTolStripMenuItem.Text = string.Format(_language.Menu.Video.VideoAudioToTextX, "Whisper");

View File

@ -4,7 +4,6 @@ using Nikse.SubtitleEdit.Forms;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Eventing.Reader;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
@ -328,20 +327,24 @@ namespace Nikse.SubtitleEdit.Logic
{
subsFormat = " -c:s mov_text";
}
else if (softSub.SubtitleFormat.GetType() == typeof(SubRip))
else if (softSub.SubtitleFormat == null && softSub.Format == "Blu-ray sup")
{
subsFormat += $" -c:s:s:{count - 1} copy"; // should be "pgs" or "pgssub" or ?
}
else if (softSub.SubtitleFormat?.GetType() == typeof(SubRip))
{
subsFormat += $" -c:s:s:{count - 1} srt";
}
else if (softSub.SubtitleFormat.GetType() == typeof(AdvancedSubStationAlpha))
else if (softSub.SubtitleFormat?.GetType() == typeof(AdvancedSubStationAlpha))
{
subsFormat += $" -c:s:s:{count - 1} ass";
}
else if (softSub.SubtitleFormat.GetType() == typeof(SubStationAlpha))
else if (softSub.SubtitleFormat?.GetType() == typeof(SubStationAlpha))
{
subsFormat += $" -c:s:s:{count - 1} ssa";
}
else if (softSub.SubtitleFormat.GetType() == typeof(WebVTT) ||
softSub.SubtitleFormat.GetType() == typeof(WebVTTFileWithLineNumber))
else if (softSub.SubtitleFormat?.GetType() == typeof(WebVTT) ||
softSub.SubtitleFormat?.GetType() == typeof(WebVTTFileWithLineNumber))
{
subsFormat += $" -c:s:s:{count - 1} webvtt";
}