I’m attempting to use pydub to convert an uploaded mp3 to a wav file.
All packages and dependencies are installed (via requirements.txt and packages.txt)
Under the hood pydub uses ffmpeg, so when this line is called:
sound = AudioSegment.from_mp3(uploaded_file)
Seems ffmpeg attempts to create a tempfile and is getting denied:
I think the reason for this error is that pydub makes some strange things with Temporaryfile, which I do not understand at first glance.
A quick fix ist to use libav instead of ffmpeg and the error is gone. Pydub prefers libav over ffmpeg if it is installed.
Just add to your packages.txt file:
Oh nice! I fought most of the night with pydub and the tempfile issue and couldn’t figure out a way around. I think the Temporaryfile is actually coming from ffmpeg, so by switching to libav like you suggested, it all works now! Thanks so much! Sorry for the late reply.