Hi, I want to upload audio files via file_upload, then convert them to ogg format and do all this without writing to a local disk on my PC.
How can I do the same thing without saving the file on my PC?
fileObject = st.file_uploader(label = "Please upload your file ",
type=[‘wav’, ‘mp3’])
with open(fileObject.name, ‘wb’) as f:
f.write(fileObject.getbuffer())
ogg_version = AudioSegment.from_mp3(fileObject.name)
ogg_version.export(fileObject.name, format=“ogg”, codec=“libopus”)
sending the converted file
s3.upload_file(fileObject.name, ‘aisales’, fileObject.name)