Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Video To MP3 in php?

Tags:

php

mp3

Hey, I'm just wondering if it would be possible to convert videos to mp3 files in php, if so, could someone point me in the right direction?

like image 234
Belgin Fish Avatar asked Dec 29 '22 19:12

Belgin Fish


1 Answers

This is not possible in pure PHP. You will need to use the services of a command-line executable or a web service.

The most popular command-line executable for this is ffmpeg. Here is a tutorial on how to strip audio/video streams from it: ffmpeg audio/video manipulation

From that tutorial - looks pretty straightforward:

ffmpeg -i mandelbrot.flv -vn -acodec copy mandelbrot.mp3

of course, there are tons of options to adjust and fine-tune the operation.

ffmpeg needs to be installed on your web server for this, and your PHP instance needs to be able to execute it.

There are some web services around to convert video I think, but I know of no free ones.

like image 94
Pekka Avatar answered Jan 08 '23 11:01

Pekka