'How to use pyffmpeg to convert mp3 to wav?
I use python and pyffmpeg to convert mp3 to wav. My codes are below: But error, the pycharm tell that
Traceback (most recent call last):
File "D:\steelsoft\speech2text\main.py", line 82, in <module>
mp3_to_wav(input_file, output_file)
File "D:\steelsoft\speech2text\main.py", line 19, in mp3_to_wav
ff = FFmpeg()
File "D:\steelsoft\speech2text\venv\lib\site-packages\pyffmpeg\__init__.py", line 50, in __init__
self._ffmpeg_file = Paths().load_ffmpeg_bin()
File "D:\steelsoft\speech2text\venv\lib\site-packages\pyffmpeg\misc.py", line 55, in load_ffmpeg_bin
from .static.bin.win32 import win32
ImportError: cannot import name 'win32' from 'pyffmpeg.static.bin.win32' (D:\steelsoft\speech2text\venv\lib\site-packages\pyffmpeg\static\bin\win32\__init__.py)
def mp3_to_wav(mp3_path, wav_path):
inp = mp3_path
out = wav_path
ff = FFmpeg()
output_file = ff.convert(inp, out)
print(output_file)
if __name__ == '__main__':
# print_hi('PyCharm') D:\temp\AISHELL-2-sample\iOS\data\wav\C0936\IC0936W0474.wav
file_name = "D:\\temp\\1.mp3"
input_file = file_name
output_file = "D:\\temp\\1.wav"
mp3_to_wav(input_file, output_file)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
