TaahKay commited on
Commit
256396c
·
verified ·
1 Parent(s): 2e6882a

Update utils/audio_processing.py

Browse files
Files changed (1) hide show
  1. utils/audio_processing.py +2 -2
utils/audio_processing.py CHANGED
@@ -75,13 +75,13 @@ def download_audio_as_wav(url, max_filesize_mb=70):
75
  # Convert to WAV (outside temp_dir so it persists)
76
  temp_wav = tempfile.NamedTemporaryFile(delete=False, suffix=".wav")
77
  convert_cmd = ["ffmpeg", "-y", "-i", audio_path, temp_wav.name]
78
- subprocess.run(convert_cmd, stdout=subprocess.PIPE("utf-8", errors="ignore"), stderr=subprocess.PIPE("utf-8", errors="ignore"), check=True)
79
 
80
  # Return WAV file path; temp_dir and downloaded audio cleaned automatically
81
  return temp_wav.name
82
 
83
  except subprocess.CalledProcessError as e:
84
- error_msg = e.stderr.decode("utf-8", errors="ignore")
85
  if "st" in globals():
86
  st.error("Audio download or conversion failed.")
87
  st.code(error_msg)
 
75
  # Convert to WAV (outside temp_dir so it persists)
76
  temp_wav = tempfile.NamedTemporaryFile(delete=False, suffix=".wav")
77
  convert_cmd = ["ffmpeg", "-y", "-i", audio_path, temp_wav.name]
78
+ subprocess.run(convert_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
79
 
80
  # Return WAV file path; temp_dir and downloaded audio cleaned automatically
81
  return temp_wav.name
82
 
83
  except subprocess.CalledProcessError as e:
84
+ error_msg = e.stderr.decode("utf-8", errors="replace") if e.stderr else str(e)
85
  if "st" in globals():
86
  st.error("Audio download or conversion failed.")
87
  st.code(error_msg)