Tuesday, 14 May 2019

look for a specific filetype in a directory in php and send it to a different directory after conversion

I have a directory in which there is a mp4 file (including other files as well) which I want to convert into mp3 and then send it to different directory. I have used the following command line command to covert into mp3 and its working perfectly fine.

ffmpeg -i 36031P.mp4 -map 0:2 -ac 1 floor_english.mp3 

mp4 file is inside in_folder. Using ffmpeg, I want to convert mp4 file into mp3 and send it to out_folder.

<?php
$dir    = 'in_folder';
$files1 = scandir($dir);
print_r($files1);    /* It lists all the files in a directory including mp4 file*/
?>

print_r($files1) lists all the file in a directory including mp4file.

Problem Statement:

I am wondering what php code I need to write so that it looks for only mp4 file inside the directory and send it to different directory (let say out_folder) after converting into mp3.

The pictorial representation of what I want:

enter image description here



from look for a specific filetype in a directory in php and send it to a different directory after conversion

No comments:

Post a Comment