Update utils/ffmpeg.py
Browse files- utils/ffmpeg.py +2 -2
utils/ffmpeg.py
CHANGED
|
@@ -33,7 +33,7 @@ def ffmpeg(input_stream: io.BufferedReader, ffmpeg_args: list) -> io.BytesIO:
|
|
| 33 |
|
| 34 |
except Exception as e:
|
| 35 |
process.terminate()
|
| 36 |
-
raise RuntimeError(f"
|
| 37 |
|
| 38 |
finally:
|
| 39 |
if process.stdout:
|
|
@@ -47,6 +47,6 @@ def ffmpeg(input_stream: io.BufferedReader, ffmpeg_args: list) -> io.BytesIO:
|
|
| 47 |
def mp3_to_opus(input_bytes_io: io.BytesIO) -> io.BytesIO:
|
| 48 |
try:
|
| 49 |
input_stream = io.BufferedReader(input_bytes_io)
|
| 50 |
-
return
|
| 51 |
except Exception as e:
|
| 52 |
raise RuntimeError(f"Failed to convert MP3 to Opus: {str(e)}")
|
|
|
|
| 33 |
|
| 34 |
except Exception as e:
|
| 35 |
process.terminate()
|
| 36 |
+
raise RuntimeError(f"FFmpeg processing failed: {str(e)}")
|
| 37 |
|
| 38 |
finally:
|
| 39 |
if process.stdout:
|
|
|
|
| 47 |
def mp3_to_opus(input_bytes_io: io.BytesIO) -> io.BytesIO:
|
| 48 |
try:
|
| 49 |
input_stream = io.BufferedReader(input_bytes_io)
|
| 50 |
+
return ffmpeg(input_stream, ["-c:a", "libopus"])
|
| 51 |
except Exception as e:
|
| 52 |
raise RuntimeError(f"Failed to convert MP3 to Opus: {str(e)}")
|