오류 내용
| Failed to save audio to <_io.BytesIO object at 0x0000024D2A909F30>: Couldn't allocate AVFormatContext. The destination file is <_io.BytesIO object at 0x0000024D2A909F30>, check the desired extension? Invalid argument |
ComfyUI\custom_nodes\comfyui-griptape\nodes\tasks 의 gtUIBaseAudioTask.py 파일을 수정한다.
수정 전
|
def save_audio_tempfile(self, audio_data):
import torchaudio
temp_files = []
for waveform in audio_data["waveform"]:
with tempfile.NamedTemporaryFile(suffix=".flac", delete=False) as temp_file:
temp_filename = temp_file.name
# Save the audio to the buffer
buff = io.BytesIO()
torchaudio.save(
buff, waveform, audio_data["sample_rate"], format="FLAC"
)
# Write the buffer's contents to the temporary file
with open(temp_filename, "wb") as f:
f.write(buff.getbuffer())
temp_files.append(temp_filename)
return temp_files
|
수정 후
|
def save_audio_tempfile(self, audio_data):
import torchaudio
import os
temp_files = []
# ComfyUI의 오디오 데이터 구조(차원)를 안전하게 맞춥니다.
waveforms = audio_data["waveform"]
if waveforms.dim() == 4: # [batch, channel, samples, ...]
waveforms = waveforms.squeeze(0)
for waveform in waveforms:
# 1. 임시 파일 경로 생성 (.wav 확장자 사용)
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as temp_file:
temp_filename = temp_file.name
# 2. [핵심 수정] BytesIO 없이 경로에 직접 저장
# 파일 확장자(.wav)를 보고 torchaudio가 자동으로 올바른 포맷을 결정합니다.
torchaudio.save(
temp_filename,
waveform,
audio_data["sample_rate"]
)
temp_files.append(temp_filename)
return temp_files
|
'3Dsoftware > Ai' 카테고리의 다른 글
| comfyUI rgthree-badge (frontend_only) remove (0) | 2026.01.14 |
|---|---|
| Zonos Generate 오류 (0) | 2026.01.10 |
| ComfyUI Zonos 오류 해결 (0) | 2026.01.10 |
| Rtx 5090 - TRELLIS.2 설치 (0) | 2026.01.03 |
| Python 가상환경 세가지 방식 (venv vs embedded vs env) (0) | 2025.12.17 |