Work on tts

This commit is contained in:
niksedk 2024-04-12 08:46:29 +02:00
parent be01dace58
commit c0ed5acc33
4 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,4 @@
using System; using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace Nikse.SubtitleEdit.Core.TextToSpeech namespace Nikse.SubtitleEdit.Core.TextToSpeech

View File

@ -19032,6 +19032,12 @@ namespace Nikse.SubtitleEdit.Forms
TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(25), () => TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(25), () =>
{ {
if (string.IsNullOrEmpty(_videoFileName) || _videoInfo == null)
{
MessageBox.Show(LanguageSettings.Current.General.NoVideoLoaded);
return;
}
if (RequireFfmpegOk()) if (RequireFfmpegOk())
{ {
using (var form = new TextToSpeech(_subtitle, GetCurrentSubtitleFormat(), _videoFileName, _videoInfo)) using (var form = new TextToSpeech(_subtitle, GetCurrentSubtitleFormat(), _videoFileName, _videoInfo))

View File

@ -182,7 +182,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts
var next = _subtitle.GetParagraphOrDefault(index + 1); var next = _subtitle.GetParagraphOrDefault(index + 1);
var pFileName = Path.Combine(_waveFolder, index + ".wav"); var pFileName = Path.Combine(_waveFolder, index + ".wav");
//TODO: analyse audio and remove silence at start and end (ffmpeg -af silenceremove=1:0:-50dB:1:1:-50dB) //TODO: analyse audio and remove silence at start and end (ffmpeg -af silenceremove=1:0:-5dB:1:1:-5dB)
var outputFileName1 = Path.Combine(_waveFolder, index + "_u.wav"); var outputFileName1 = Path.Combine(_waveFolder, index + "_u.wav");
var trimProcess = VideoPreviewGenerator.TrimSilenceStartAndEnd(pFileName, outputFileName1); var trimProcess = VideoPreviewGenerator.TrimSilenceStartAndEnd(pFileName, outputFileName1);
trimProcess.Start(); trimProcess.Start();

View File

@ -612,7 +612,7 @@ namespace Nikse.SubtitleEdit.Logic
StartInfo = StartInfo =
{ {
FileName = GetFfmpegLocation(), FileName = GetFfmpegLocation(),
Arguments = $"-i \"{inputFileName}\" -af silenceremove=start_periods=1:start_silence=0.01,areverse,silenceremove=start_periods=1:start_silence=0.01,areverse \"{outputFileName}\"", Arguments = $"-i \"{inputFileName}\" -af \"areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0.1:start_threshold=0.01,areverse,atrim=start=0,silenceremove=start_periods=1:start_silence=0.1:start_threshold=0.01\" \"{outputFileName}\"",
UseShellExecute = false, UseShellExecute = false,
CreateNoWindow = true CreateNoWindow = true
} }