无法打开文件file.wav作为WAV由于:文件不以RIFF ID开头
问题描述:
我在尝试打开一个RIFF文件(据我了解这是一种WAV类型)在python中时出现此错误。无法打开文件file.wav作为WAV由于:文件不以RIFF ID开头
Failed to open file file.wav as a WAV due to: file does not start with RIFF id
当我检查它与各种工具,这使我相信它是真的WAV/RIFF文件。
$ file file.wav
file.wav: MBWF/RF64 audio, stereo 96000 Hz
$ file -i file.wav
file.wav: audio/x-wav; charset=binary
$ mediainfo file.wav
General
Complete name : file.wav
Format : Wave
Format profile : RF64
File size : 4.10 GiB
Duration : 2h 7mn
Overall bit rate mode : Constant
Overall bit rate : 4 608 Kbps
Audio
Format : PCM
Format settings, Endianness : Little
Format settings, Sign : Signed
Codec ID : 1
Duration : 2h 7mn
Bit rate mode : Constant
Bit rate : 4 608 Kbps
Channel(s) : 2 channels
Sampling rate : 96.0 KHz
Bit depth : 24 bits
Stream size : 4.10 GiB (100%)
答
我有一个单词, 我将文件的后缀重命名为“mp3”并将其转换为“wav”,然后我可以读取它。
subprocess.call(['ffmpeg', '-i', 'XXX.mp3', 'XXX.wav'])