Answer the question
In order to leave comments, you need to log in
How to use ffmpeg to convert an mp3 file to wav format before downloading by the user in PHP without having to create a wav file on the server?
I have a database of mp3 files. For example file s1.mp3
The user needs to download this file in wav format.
I can convert the file like this
And give the received file like this
exec ("ffmpeg -i s1.mp3 s1.wav",$output);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question