I’m having difficulty writing an mp3 file. The file is created on disk, but I get “Failed to open output” errors.
torchaudio.save(
uri=f"{noisy_dataset_directory}/clips/{filename}",
src=noisy_waveform.unsqueeze(1),
sample_rate=data[1],
format="libmp3lame"
)
RuntimeError: Failed to open output "/home/jacob/noisy-commonvoice/en/clips/common_voice_en_17924809.mp3" (Invalid argument).
Exception raised from get_output_format_context at /__w/audio/audio/pytorch/audio/src/libtorio/ffmpeg/stream_writer/stream_writer.cpp:24 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::string) + 0x57 (0x71647bf7a897 in /home/jacob/jupyter-venv/lib/python3.12/site-packages/torch/lib/libc10.so)
frame #1: c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::string const&) + 0x64 (0x71647bf2ab25 in /home/jacob/jupyter-venv/lib/python3.12/site-packages/torch/lib/libc10.so)
frame #2: <unknown function> + 0x5375c (0x716485b1875c in /home/jacob/jupyter-venv/lib/python3.12/site-packages/torio/lib/libtorio_ffmpeg6.so)
frame #3: torio::io::StreamingMediaEncoder::StreamingMediaEncoder(std::string const&, std::optional<std::string> const&) + 0x11 (0x716485b19f31 in /home/jacob/jupyter-venv/lib/python3.12/site-packages/torio/lib/libtorio_ffmpeg6.so)
frame #4: <unknown function> + 0x39bbe (0x7163cd4b9bbe in /home/jacob/jupyter-venv/lib/python3.12/site-packages/torio/lib/_torio_ffmpeg6.so)
frame #5: <unknown function> + 0x32024 (0x7163cd4b2024 in /home/jacob/jupyter-venv/lib/python3.12/site-packages/torio/lib/_torio_ffmpeg6.so)
frame #6: /home/jacob/jupyter-venv/bin/python3() [0x58201f]
frame #7: _PyObject_MakeTpCall + 0x75 (0x548f55 in /home/jacob/jupyter-venv/bin/python3)
frame #8: /home/jacob/jupyter-venv/bin/python3() [0x54cc87]
frame #9: /home/jacob/jupyter-venv/bin/python3() [0x59e181]
frame #10: /home/jacob/jupyter-venv/bin/python3() [0x599ab3]
frame #11: <unknown function> + 0xfafb (0x716485b8aafb in /home/jacob/jupyter-venv/lib/python3.12/site-packages/torchaudio/lib/_torchaudio.so)
frame #12: _PyObject_MakeTpCall + 0x75 (0x548f55 in /home/jacob/jupyter-venv/bin/python3)
frame #13: _PyEval_EvalFrameDefault + 0xa89 (0x5d7499 in /home/jacob/jupyter-venv/bin/python3)
frame #14: _PyObject_Call_Prepend + 0x18a (0x54a86a in /home/jacob/jupyter-venv/bin/python3)
frame #15: /home/jacob/jupyter-venv/bin/python3() [0x59dfef]
frame #16: /home/jacob/jupyter-venv/bin/python3() [0x599ab3]
frame #17: _PyObject_MakeTpCall + 0x13e (0x54901e in /home/jacob/jupyter-venv/bin/python3)
frame #18: _PyEval_EvalFrameDefault + 0xa89 (0x5d7499 in /home/jacob/jupyter-venv/bin/python3)
frame #19: PyEval_EvalCode + 0x15b (0x5d59ab in /home/jacob/jupyter-venv/bin/python3)
frame #20: /home/jacob/jupyter-venv/bin/python3() [0x5d352c]
frame #21: _PyEval_EvalFrameDefault + 0x3f56 (0x5da966 in /home/jacob/jupyter-venv/bin/python3)
frame #22: /home/jacob/jupyter-venv/bin/python3() [0x5559ff]
frame #23: _PyEval_EvalFrameDefault + 0x319a (0x5d9baa in /home/jacob/jupyter-venv/bin/python3)
frame #24: /home/jacob/jupyter-venv/bin/python3() [0x54cb74]
frame #25: PyObject_Call + 0x115 (0x54b185 in /home/jacob/jupyter-venv/bin/python3)
frame #26: _PyEval_EvalFrameDefault + 0x4b83 (0x5db593 in /home/jacob/jupyter-venv/bin/python3)
frame #27: /home/jacob/jupyter-venv/bin/python3() [0x66c159]
frame #28: <unknown function> + 0x9d44 (0x716487e45d44 in /usr/lib/python3.12/lib-dynload/_asyncio.cpython-312-x86_64-linux-gnu.so)
frame #29: <unknown function> + 0xb150 (0x716487e47150 in /usr/lib/python3.12/lib-dynload/_asyncio.cpython-312-x86_64-linux-gnu.so)
frame #30: /home/jacob/jupyter-venv/bin/python3() [0x581f32]
frame #31: /home/jacob/jupyter-venv/bin/python3() [0x6a47c3]
frame #32: /home/jacob/jupyter-venv/bin/python3() [0x581e9d]
frame #33: _PyEval_EvalFrameDefault + 0x4b83 (0x5db593 in /home/jacob/jupyter-venv/bin/python3)
frame #34: PyEval_EvalCode + 0x15b (0x5d59ab in /home/jacob/jupyter-venv/bin/python3)
frame #35: /home/jacob/jupyter-venv/bin/python3() [0x5d352c]
frame #36: /home/jacob/jupyter-venv/bin/python3() [0x581e9d]
frame #37: PyObject_Vectorcall + 0x35 (0x549955 in /home/jacob/jupyter-venv/bin/python3)
frame #38: _PyEval_EvalFrameDefault + 0xa89 (0x5d7499 in /home/jacob/jupyter-venv/bin/python3)
frame #39: /home/jacob/jupyter-venv/bin/python3() [0x6bcc12]
frame #40: Py_RunMain + 0x232 (0x6bc842 in /home/jacob/jupyter-venv/bin/python3)
frame #41: Py_BytesMain + 0x2d (0x6bc4ad in /home/jacob/jupyter-venv/bin/python3)
frame #42: <unknown function> + 0x2a1ca (0x716487c2a1ca in /lib/x86_64-linux-gnu/libc.so.6)
frame #43: __libc_start_main + 0x8b (0x716487c2a28b in /lib/x86_64-linux-gnu/libc.so.6)
frame #44: _start + 0x25 (0x657925 in /home/jacob/jupyter-venv/bin/python3)