Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wave.Error: unknown format: 65534 #129

Open
erikparr opened this issue Feb 16, 2016 · 7 comments
Open

wave.Error: unknown format: 65534 #129

erikparr opened this issue Feb 16, 2016 · 7 comments
Labels

Comments

@erikparr
Copy link

I'm trying to process a bunch of different soundfiles but I run into a problem when pydub tries to load a wav file that is:
96000 sample rate
24 bits
stereo
1 second

at line:
sound = AudioSegment.from_file(file)
returns:
Traceback (most recent call last):
File "/Users/erikparr/Documents/_Projects/LandscapesStudy/LandscapeStudy/convertAudiofilesToWav.py", line 17, in
f2w.convertAll(60)
File "/Users/erikparr/Documents/_Projects/LandscapesStudy/LandscapeStudy/flac2wav.py", line 107, in convertAll
sound = AudioSegment.from_file(file, frame_rate=48000, channels=2)
File "build/bdist.macosx-10.10-x86_64/egg/pydub/audio_segment.py", line 427, in from_file
File "build/bdist.macosx-10.10-x86_64/egg/pydub/audio_segment.py", line 460, in _from_safe_wav
File "build/bdist.macosx-10.10-x86_64/egg/pydub/audio_segment.py", line 136, in init
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wave.py", line 511, in open
return Wave_read(f)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wave.py", line 164, in init
self.initfp(f)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wave.py", line 144, in initfp
self._read_fmt_chunk(chunk)
File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wave.py", line 274, in _read_fmt_chunk
raise Error, 'unknown format: %r' % (wFormatTag,)
wave.Error: unknown format: 65534

@agieocean
Copy link

Can you try downsampling to 48kHz and see what happens? PyDub Python seems to have issues with anything over 48kHZ.

@queengooborg
Copy link

Same thing happens with an AIFF file that I have. It matches the info about the WAV file that @erikparr mentioned, that is, 96 KHz 24-bit stereo. Dropped down to 44.1 KHz, and the loading worked like a charm.

@cool-benson
Copy link

cool-benson commented Jul 26, 2017

I'm having the same error for different cause. When I read 5.1 channel aac file it also gives the same error. Following is the setting of my aac:
aac(LC), 48000Hz, 5.1, fltp, 249kb.s

my solution for now is use ffmpeg to reduce the channel to 2.
ie ffmpeg -i 6channels.wav -ac 2 stereo.wav
https://trac.ffmpeg.org/wiki/AudioChannelManipulation

@jiaaro
Copy link
Owner

jiaaro commented Jul 27, 2017

@cool-benson I think the cause of the error in your case is fltp (the Planar floating point format)

@cool-benson
Copy link

@jiaaro but I also checked the stereo one working it also says fltp. Following is the spec.
Stream #0:0 Audio: aac(LC), 48000 Hz, stereo, fltp, 150 kb/s

@Cybernetic1
Copy link

A Chinese web site says that it is due to WAV file format, not the fault of ffmpeg.
The solution is to use the sox utility:

sox input.wav -b 16 -e signed-integer output.wav

@cancundeyingzi
Copy link

一个中文网站说是WAV文件格式,不是ffmpeg的错。 解决方案是使用该sox实用程序:

sox input.wav -b 16 -e signed-integer output.wav

能提供一下出处么?谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants