Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compress or convert to low quality Mp3 file from PHP [closed]

Tags:

php

mp3

Is there any PHP library or function to covert Mp3 file to lower quality?

I want to compress / convert 128Kbps or higher quality Mp3 file to 64Kbps Mp3 file by PHP.

Anyone know?

like image 569
Angolao Avatar asked Jan 07 '11 17:01

Angolao


3 Answers

First of all, you need to install ffmpeg available at: http://ffmpeg.org/download.html

Then, make sure you have safe mode enabled in your PHP configuration and select the right dir where you can execute files: safe_mode_exec_dir

Finally, use:

exec("ffmpeg -i inputfile.mp3 -ab 64 outputfile.mp3")
like image 55
jpmonette Avatar answered Nov 10 '22 01:11

jpmonette


Have you taken a look at ffmpeg? http://ffmpeg-php.sourceforge.net/

like image 32
Mech Avatar answered Nov 10 '22 01:11

Mech


This command worked for me

exec("ffmpeg -i inputfile.mp3 -b:a 64k outputfile.mp3")
like image 23
Waqas Avatar answered Nov 10 '22 03:11

Waqas