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

Remove pydub from dependencies #3968

Open
JasonGrace2282 opened this issue Oct 20, 2024 · 6 comments
Open

Remove pydub from dependencies #3968

JasonGrace2282 opened this issue Oct 20, 2024 · 6 comments
Labels
enhancement Additions and improvements in general help wanted We would appreciate help on this issue/PR

Comments

@JasonGrace2282
Copy link
Member

pydub is no longer actively maintained, and is now running into issues with audioop being removed in python 3.13. As such, we should try to remove it from our dependencies and implement the needed features ourselves.

From a quick look through the code, the main features needed to implement are:

  • AudioSegment.silent
  • AudioSegment.overlay
  • AudioSegment.from_file

self.audio_segment = segment.overlay(
new_segment,
position=int(1000 * time),
gain_during_overlay=gain_to_background,
)

AudioSegment.silent(int(np.ceil(diff * 1000))),

new_segment = AudioSegment.from_file(wav_file_path.name)

@JasonGrace2282 JasonGrace2282 added enhancement Additions and improvements in general help wanted We would appreciate help on this issue/PR labels Oct 20, 2024
@JasonGrace2282
Copy link
Member Author

Pinging @behackl as we talked about this on stream a while back.

@OliverStrait
Copy link

I read some source code of pydub and find this:

try:
    import audioop
except ImportError:
    import pyaudioop as audioop

It seems like, inside of pydub there is substitution functions written in python at pyaudioop.py. If those work as intended in runtime, there may not be so much of hurry and it may still work in 3.13. (One missing function was marked, but it may be some cursed global reference that no 3rd party cannot figure out without dancing with debugger)
But still, I think this is can be a issue maker and other alternativies should be investigated.

Original audioop code is in this package: https://github.com/AbstractUmbra/audioop
Pydub: https://github.com/jiaaro/pydub

@JasonGrace2282
Copy link
Member Author

JasonGrace2282 commented Oct 28, 2024

Unfortunately, pydubs alternate python implementation is actually broken, as I found out in #3967
Relevant upstream issue jiaaro/pydub#815

@OliverStrait
Copy link

Yeah, it is totally broken. If you resolve the import issue, then the code is just filled with type errors and mentioned function really was not there. Never tested hasty conversion of C-code.

@OliverStrait
Copy link

If dependency to external ffmpeg executable is dropped, this will be broken in that regard too.
PyAv does not share it's ffmpeg through envPATH.

@behackl
Copy link
Member

behackl commented Oct 30, 2024

The cases where pydub would call ffmpeg via the executable should be taken care of by manual transcoding on our end. Did you find some situation where pyav actually tries to invoke ffmpeg on the current main branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Additions and improvements in general help wanted We would appreciate help on this issue/PR
Projects
Status: 🆕 New
Development

No branches or pull requests

3 participants