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

speedup hangs indefinitely #736

Open
jaypinho opened this issue Jul 3, 2023 · 1 comment
Open

speedup hangs indefinitely #736

jaypinho opened this issue Jul 3, 2023 · 1 comment

Comments

@jaypinho
Copy link

jaypinho commented Jul 3, 2023

Steps to reproduce

  1. Download a podcast episode (I used https://27083.mc.tritondigital.com/OMNY_ODDLOTS_PODCAST_P/media-session/f155044e-aa39-4c0c-ada7-581d92b80798/d/clips/e73c998e-6e60-432f-8610-ae210140c5b1/8a94442e-5a74-4fa2-8b8d-ae27003a8d6b/33372447-ffe8-4b9d-8a2a-b031012c3f03/audio/direct/t1688371276/Bridgewater's_Greg_Jensen_on_AI,_Inflation_and_What_Markets_Are_Getting_Wrong.mp3).

  2. Try:

from pydub import AudioSegment, effects
sound_file = AudioSegment.from_mp3(filename)
so = sound_file.speedup(playback_speed=1.25, chunk_size=150, crossfade=25)
so.export("faster_file.mp3", format="mp3")

Expected behavior

I should get a new mp3 file (faster_file.mp3) that's shorter than the original.

Actual behavior

The code hangs indefinitely and I have to manually cut it off after 5+ minutes.

Your System configuration

  • Python version: 3.9.6
  • Pydub version: 0.25.1
  • ffmpeg or avlib?: ffmpeg
  • ffmpeg/avlib version: 6.0

Is there an audio file you can include to help us reproduce?

See URL above.

@lumip
Copy link

lumip commented Jul 25, 2023

I can reproduce: While the speedup function doesn't actually "hang", it becomes really slow due to internal repeated copying of the audio, which for long audio files/segments becomes prohibitive. In PR #746 I have a much more performant but not quite as general re-implementation to start a discussion on how to improve this.

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

No branches or pull requests

2 participants