pydub
pydub copied to clipboard
Fix audio segment export bigger 4gb
This pull request adds the possibility to export an AudioSegment, which is bigger than 4 GB to any compressed format. It does not allow to export the AudioSegment directly to a WAV file bigger than 4 GB. Apparently it's not even allowed from the specification of the WAV file to be bigger than 4 GB. The strategy for the compressed formats is to split the audio segment into Wave Files smaller 4 GB and then to combine them with FFMPEG. Note: I also added a test with an audio segment > 4 GB, which is taking quite some time. On my machine (Lenovo P50), it takes 26 seconds. Additionally on the infrastructure, it's impossible to run it due to memory limitation:
ERROR: test_audio_segment_export_bigger_than_4gb (main.AudioSegmentTests) Traceback (most recent call last): File "test/test.py", line 1104, in test_audio_segment_export_bigger_than_4gb original_segment += original_segment File "c:\projects\pydub\pydub\audio_segment.py", line 364, in add return self.append(arg, crossfade=0) File "c:\projects\pydub\pydub\audio_segment.py", line 1280, in append return seg1._spawn(seg1._data + seg2._data) MemoryError
=> This test is there, it can be used to verify the issue and the fix, but I have to disable it.
Any help on this? I am facing the exact same issue.....
Would love to see this merged, it would help with an issue some folks hit when making audiobooks.