feat:Google Lyria API로 AI 배경음악 생성 연동
Lyria API 연동: - Vertex AI 기반 Google Lyria 음악 생성 API 추가 - 분위기(mood)별 영어 프롬프트 매핑 (upbeat, energetic, calm 등 8종) - 생성된 30초 WAV → MP3 변환 + 영상 길이에 맞춰 루프/트림 - 페이드인(1초) + 페이드아웃(3초) 자동 적용 - 비용: $0.06/30초 BGM 우선순위 변경: - 1순위: Lyria AI 배경음악 (신규) - 2순위: 프리셋 BGM 파일 (storage/app/bgm/) - 3순위: FFmpeg 앰비언트 (기존 폴백) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -216,14 +216,24 @@ public function handle(
|
||||
}
|
||||
|
||||
// === Step 4: BGM 생성/선택 ===
|
||||
$video->updateProgress(VideoGeneration::STATUS_GENERATING_BGM, 75, 'BGM 준비 중...');
|
||||
$video->updateProgress(VideoGeneration::STATUS_GENERATING_BGM, 75, 'AI 배경음악 생성 중...');
|
||||
|
||||
$bgmMood = $scenario['bgm_mood'] ?? 'upbeat';
|
||||
$bgmPath = $bgm->select($bgmMood, "{$workDir}/bgm.mp3");
|
||||
$totalDuration = array_sum(array_column($activeScenes, 'duration'));
|
||||
|
||||
// BGM 파일이 없으면 앰비언트 BGM 자동 생성
|
||||
// 1순위: Google Lyria AI 배경음악 생성
|
||||
$bgmPath = $bgm->generateWithLyria($bgmMood, $totalDuration, "{$workDir}/bgm.mp3");
|
||||
if ($bgmPath) {
|
||||
$totalCost += 0.06; // Lyria 비용 ($0.06/30초)
|
||||
}
|
||||
|
||||
// 2순위: 프리셋 BGM 파일
|
||||
if (! $bgmPath) {
|
||||
$bgmPath = $bgm->select($bgmMood, "{$workDir}/bgm.mp3");
|
||||
}
|
||||
|
||||
// 3순위: FFmpeg 앰비언트 BGM
|
||||
if (! $bgmPath) {
|
||||
$totalDuration = array_sum(array_column($activeScenes, 'duration'));
|
||||
$bgmPath = $bgm->generateAmbient($bgmMood, $totalDuration, "{$workDir}/bgm.mp3");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user