If you are using a Linux machine and ffmpeg is installed then you can use following code in your PHP file to convert “video.mp4″ file into “music.mp3″ exec(‘ffmpeg -i video.mp4 -f mp3 -ab 192000 -vn music.mp3′); This should work !

We can convert mp4 video files to mp3 audio files using Java a ProcessBuilder using the following command , which uses FFMPEG : ffmpeg -i mp4filename.mp4 -vn -s 00:00:25 -acodec libmp3lame mp3filename.mp3 This reads “mp4filename.mp4″ file and ignores video ; outputs 25 seconds as mp3filename.mp3 !