theHolc
theHolc

Reputation: 21

Python pydub AudioSegment MemoryError

I am pretty new to Python and am running into a MemoryError issue when trying to create an AUdioSegment object from a 44 MB .mp3 audio file. I have no issues when dealing with most audio files I have but they are all less than 1 MB except for this one. This is all I am trying to do at this point:

audio = AudioSegment.from_file(filepath, format="mp3")

Here is the full output for the error:

Exception in thread Thread-3:
Traceback (most recent call last):
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
    self.run()
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\Owner\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1366, in _readerthread
    buffer.append(fh.read())
MemoryError

I wouldn't think that a 44 MB file would cause a MemoryError, but clearly I am mistaken or something else is going on in the background that I am unaware of. I tried finding issues related to memory when using AudioSegment and they all seem to be dealing with much larger files. Any help would be appreciated. Thank you!

Upvotes: 1

Views: 794

Answers (1)

Water
Water

Reputation: 3655

Had this exact problem with a 50mb file. Fixed it by installing the 64-bit Python. For some reason I had the 32-bit version and it would run out of memory. The 64-bit version fixed everything and I could work with larger files.

Upvotes: 1

Related Questions