generated from fahricansecer/boilerplate-be
@@ -93,21 +93,25 @@ public class VideoRenderPipeline
|
||||
_logger.LogInformation("🎙️ Adım 2/5: TTS narration üretimi");
|
||||
|
||||
var voiceStyle = job.ScriptJson?.VoiceStyle ?? "Deep authoritative male voice";
|
||||
var ttsTasks = new List<Task<GeneratedMediaFile>>();
|
||||
var ttsResults = new List<GeneratedMediaFile>();
|
||||
|
||||
foreach (var scene in scenes)
|
||||
{
|
||||
ttsTasks.Add(GenerateTtsWithProgress(
|
||||
var result = await GenerateTtsWithProgress(
|
||||
scene, projectDir, voiceStyle,
|
||||
() =>
|
||||
{
|
||||
completedSteps++;
|
||||
var progress = (int)(completedSteps / (double)totalSteps * 40); // TTS %0-40
|
||||
return progressCallback(progress, "TTS_GENERATION");
|
||||
}, ct));
|
||||
}, ct);
|
||||
|
||||
ttsResults.Add(result);
|
||||
|
||||
// Rate limit (429 Too Many Requests) yememek için sahneler arası 1 saniye bekle
|
||||
await Task.Delay(1000, ct);
|
||||
}
|
||||
|
||||
var ttsResults = await Task.WhenAll(ttsTasks);
|
||||
allMediaFiles.AddRange(ttsResults);
|
||||
|
||||
// ═══════════════════════════════════════
|
||||
@@ -273,7 +277,15 @@ public class VideoRenderPipeline
|
||||
|
||||
if (!string.IsNullOrEmpty(scene.TtsProvider) && scene.TtsProvider.Equals("openai", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
result = await _openAiTts.GenerateNarrationAsync(scene, outputDir, voiceStyle, ct);
|
||||
try
|
||||
{
|
||||
result = await _openAiTts.GenerateNarrationAsync(scene, outputDir, voiceStyle, ct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "OpenAI TTS başarısız (Muhtemelen 429 Rate Limit/Quota). Voicebox'a fallback yapılıyor.");
|
||||
result = await _voiceboxTts.GenerateNarrationAsync(scene, outputDir, voiceStyle, ct);
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(scene.TtsProvider) && scene.TtsProvider.Equals("minimax", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user