Permission denied for /tmp directory using ffmpeg

Hi all,

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:

[cache @ 0x55a98290f980] [TEMPFILE @ 0x7ffd9fbf6320] ff_tempfile: Cannot open temporary file /tmp/ffcache6vBwsa
[cache @ 0x55a98290f980] Failed to create tempfile
cache:pipe:0: Permission denied

App is here:

Please provide a link to your github repo, your streamlit app is not accessible.

Should be public now. Sorry, first time working with streamlit, hadn’t notice the share and permissions thing.

Anyway, please give us the link to the github repo. The linked github repo seems to be different.

I think the reason for this error is that pydub makes some strange things with Temporaryfile, which I do not understand at first glance. :thinking:

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.