fix(music-lab): pipeline 오디오 경로 + ffmpeg 에러 가시성
- orchestrator._run_video: track.file_path 우선 사용 (audio_url 변환 불필요) - _local_path: /media/music/ → /app/data/ (마운트가 /app/data 직접이라 music 서브디렉토리 없음) - video.py/thumb.py: stderr truncation [-800:]/[-500:] — 진짜 에러 보이게
This commit is contained in:
@@ -104,7 +104,7 @@ async def _run_cover(p, track, feedback):
|
|||||||
async def _run_video(p, track):
|
async def _run_video(p, track):
|
||||||
setup = db.get_youtube_setup()
|
setup = db.get_youtube_setup()
|
||||||
vd = setup["visual_defaults"]
|
vd = setup["visual_defaults"]
|
||||||
audio_path = _local_path(track.get("audio_url", ""))
|
audio_path = track.get("file_path") or _local_path(track.get("audio_url", ""))
|
||||||
cover_path = _local_path(p["cover_url"])
|
cover_path = _local_path(p["cover_url"])
|
||||||
out = video.generate(
|
out = video.generate(
|
||||||
pipeline_id=p["id"], audio_path=audio_path, cover_path=cover_path,
|
pipeline_id=p["id"], audio_path=audio_path, cover_path=cover_path,
|
||||||
@@ -162,14 +162,17 @@ async def _run_publish(p, track):
|
|||||||
|
|
||||||
|
|
||||||
def _local_path(media_url: str) -> str:
|
def _local_path(media_url: str) -> str:
|
||||||
""" /media/videos/123/cover.jpg → /app/data/videos/123/cover.jpg """
|
""" /media/videos/123/cover.jpg → /app/data/videos/123/cover.jpg
|
||||||
|
/media/music/abc.mp3 → /app/data/abc.mp3 (music mount at /app/data, no subdir)
|
||||||
|
"""
|
||||||
if not media_url:
|
if not media_url:
|
||||||
return ""
|
return ""
|
||||||
base_media = os.getenv("VIDEO_MEDIA_BASE", "/media/videos")
|
base_media = os.getenv("VIDEO_MEDIA_BASE", "/media/videos")
|
||||||
base_data = os.getenv("VIDEO_DATA_DIR", "/app/data/videos")
|
base_data = os.getenv("VIDEO_DATA_DIR", "/app/data/videos")
|
||||||
if media_url.startswith(base_media):
|
if media_url.startswith(base_media):
|
||||||
return media_url.replace(base_media, base_data, 1)
|
return media_url.replace(base_media, base_data, 1)
|
||||||
# /media/music/abc.mp3 → /app/data/music/abc.mp3
|
if media_url.startswith("/media/music/"):
|
||||||
|
return media_url.replace("/media/music/", "/app/data/", 1)
|
||||||
return media_url.replace("/media/", "/app/data/", 1)
|
return media_url.replace("/media/", "/app/data/", 1)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ def generate(*, pipeline_id: int, video_path: str,
|
|||||||
"-ss", "00:00:05", "-vframes", "1", "-q:v", "2", out_path]
|
"-ss", "00:00:05", "-vframes", "1", "-q:v", "2", out_path]
|
||||||
result = subprocess.run(cmd, capture_output=True, text=True, timeout=THUMB_TIMEOUT_S)
|
result = subprocess.run(cmd, capture_output=True, text=True, timeout=THUMB_TIMEOUT_S)
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
raise ThumbGenerationError(f"ffmpeg 썸네일 실패: {result.stderr[:300]}")
|
raise ThumbGenerationError(f"ffmpeg 썸네일 실패: {result.stderr[-500:]}")
|
||||||
|
|
||||||
if overlay_text and track_title:
|
if overlay_text and track_title:
|
||||||
_overlay_title(out_path, track_title)
|
_overlay_title(out_path, track_title)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ def generate(*, pipeline_id: int, audio_path: str, cover_path: str,
|
|||||||
logger.info("ffmpeg 실행: %s", " ".join(cmd))
|
logger.info("ffmpeg 실행: %s", " ".join(cmd))
|
||||||
result = subprocess.run(cmd, capture_output=True, text=True, timeout=VIDEO_TIMEOUT_S)
|
result = subprocess.run(cmd, capture_output=True, text=True, timeout=VIDEO_TIMEOUT_S)
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
raise VideoGenerationError(f"ffmpeg 실패: {result.stderr[:500]}")
|
raise VideoGenerationError(f"ffmpeg 실패: {result.stderr[-800:]}")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"url": storage.media_url(pipeline_id, "video.mp4"),
|
"url": storage.media_url(pipeline_id, "video.mp4"),
|
||||||
|
|||||||
Reference in New Issue
Block a user