-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
AudioSegment broken for current avprobe (12.3) #285
Comments
I have the same issue :( and MacOS 10.13.5 |
Error in version Pydub 0.22.0, not problem in 0.21.0 info: |
Fix line: https://github.com/jiaaro/pydub/blob/master/pydub/audio_segment.py#L664 replace |
I will apply the patch in #290 as a temporary fix, but long term we should switch to using ffprobe’s json output instead of parsing the human readable output with a regex. If I have time I’ll look at that approach first. @markkohdev Thank you for taking the time to write this detailed report :) |
@jiaaro I've rewritten the regular expression, now it should be suitable for all cases (but still not all tests pass on macOS) |
Steps to reproduce
AudioSegment.from_file()
on an audio fileExpected behavior
AudioSegment should return segment data based on avprobe output
Actual behavior
AudioSegment hits a
KeyError
the new version of avprobe has added a line break to the line containing the sample_fmt.
Avprobe output used to look like this (partial output)
but now looks like this (note the additional line break)
so the parsing of this line https://github.com/markkohdev/pydub/blob/master/pydub/utils.py#L262 no longer works, consequently not setting
sample_fmt
on this line https://github.com/markkohdev/pydub/blob/master/pydub/utils.py#L291Thus, this key does not exist and this line fails
https://github.com/markkohdev/pydub/blob/master/pydub/audio_segment.py#L664
The solution to this seems to be to update the utils file regexes to handle the new format, or to use a safe
.get('sample_fmt', '<default>')
in the audio segmenterYour System configuration
Is there an audio file you can include to help us reproduce?
schubert.ogg.zip
The text was updated successfully, but these errors were encountered: