Add whisper setting WhisperMaxSegmentCharacters

This commit is contained in:
niksedk 2022-11-12 20:23:03 +01:00
parent b79d81fb0c
commit 4a1740a455
2 changed files with 10 additions and 1 deletions

View File

@ -414,6 +414,7 @@ namespace Nikse.SubtitleEdit.Core.Common
public string WhisperModel { get; set; }
public string WhisperLanguageCode { get; set; }
public string WhisperLocation { get; set; }
public int WhisperMaxSegmentCharacters { get; set; }
public string WhisperExtraSettings { get; set; }
public int AudioToTextLineMaxChars { get; set; }
public int AudioToTextLineMaxCharsJp { get; set; }
@ -615,6 +616,7 @@ namespace Nikse.SubtitleEdit.Core.Common
GenVideoNonAssaBox = true;
VoskPostProcessing = true;
UseWhisperCpp = Configuration.IsRunningOnWindows;
WhisperMaxSegmentCharacters = 1;
WhisperExtraSettings = "";
WhisperLanguageCode = "en";
AudioToTextLineMaxChars = 86;
@ -6149,6 +6151,12 @@ $HorzAlign = Center
settings.Tools.WhisperLocation = subNode.InnerText;
}
subNode = node.SelectSingleNode("WhisperMaxSegmentCharacters");
if (subNode != null)
{
settings.Tools.WhisperMaxSegmentCharacters = int.Parse(subNode.InnerText, CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("WhisperExtraSettings");
if (subNode != null)
{
@ -10409,6 +10417,7 @@ $HorzAlign = Center
textWriter.WriteElementString("UseWhisperCpp", settings.Tools.UseWhisperCpp.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("WhisperModel", settings.Tools.WhisperModel);
textWriter.WriteElementString("WhisperLocation", settings.Tools.WhisperLocation);
textWriter.WriteElementString("WhisperMaxSegmentCharacters", settings.Tools.WhisperMaxSegmentCharacters.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("WhisperExtraSettings", settings.Tools.WhisperExtraSettings);
textWriter.WriteElementString("WhisperLanguageCode", settings.Tools.WhisperLanguageCode);
textWriter.WriteElementString("AudioToTextLineMaxChars", settings.Tools.AudioToTextLineMaxChars.ToString(CultureInfo.InvariantCulture));

View File

@ -636,7 +636,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
if (Configuration.Settings.Tools.UseWhisperCpp && string.IsNullOrEmpty(translateToEnglish))
{
translateToEnglish = "--max-len 1 ";
translateToEnglish = $"--max-len {Configuration.Settings.Tools.WhisperMaxSegmentCharacters} ";
}
var outputSrt = string.Empty;