convert the wma files through php script in linux

convert the wma files through php script in linux

When we use the mobile download we always get the wma files as song file. If you want to convert wma files to mp3 file. For that I written the simple PHP sciprt for converting the wma files through php scirpt.

convert the wma files through php script in linux

Use the following scirpt.

<?php
// Script made for convertion of  .wma to .M3 Converter (media conversion) in Linux
//You need the  mplayer and lame installted in your linux OS

set_time_limit(0);
ReadDirs('/var/www/html/songs/wmamp3/');
function ReadDirs($dir){
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." &amp;&amp; $file != ".." &amp;&amp; $file != "Thumb.db") {
$info = pathinfo($file);
if($info['extension']=='wma') {
$mp3_file = str_replace('.wma','',$file);
$cmd = "mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader '".$dir.$file."';lame -m s -V 3 audiodump.wav;mv audiodump.wav.mp3 '".$dir."mp3/".$mp3_file.".mp3';rm -f audiodump.wav";
system($cmd);
}

}
}
closedir($handle);
}
}
?>

Above script will take wma files from folder and convert all files to mp3 files.

convert the wma files through php script in linux
convert the wma files through php script in linux

 

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

Leave a Reply

Your email address will not be published.