标题python打开wav文件,出现如下错误:
C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn’t find ffmpeg or avconv - defaulting to ffmpeg, but may not work
warn(“Couldn’t find ffmpeg or avconv - defaulting to ffmpeg, but may not work”, RuntimeWarning)
CutFile File Name is pengsq.wav
Traceback (most recent call last):
File “D:\test\go\pengsq\spite.py”, line 120, in
CutFile(filename)
File “D:\test\go\pengsq\spite.py”, line 35, in CutFile
f = wave.open(FileName, “rb”)
File “C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\wave.py”, line 509, in open
return Wave_read(f)
File “C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\wave.py”, line 163, in init
self.initfp(f)
File “C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\wave.py”, line 143, in initfp
self._read_fmt_chunk(chunk)
File “C:\Users\HP\AppData\Local\Programs\Python\Python39\lib\wave.py”, line 268, in _read_fmt_chunk
raise Error(‘unknown format: %r’ % (wFormatTag,))
wave.Error: unknown format: 3
搜索后解决方法如下:
sox input.wav -b 16 -e signed-integer output.wav
将源文件更改后,可以正常打开。