0

this is not really a question but a request to point me to any starting direction. i have a simple audio upload form which stores the audio to a database or just any folder. I want to start by implementing ffmpeg so before this audio is stored in the folder, it goes through ffmpeg(converted to mp3 for example) and stores the converted version to the folder. Can someone please point me to any tutorial or links where i can start more research. I already installed ffmpeg.exe in xampp much appreciated in advance

  • Before I can answer your question for ffmpeg: Do you already have a webpage with an upload form? If yes, which (server side) technology you are using? PHP, CGI, ..? xampp is just a package with a web server, so to get code running in your server, you need some scripts in your server. – Business Tomcat Feb 03 '18 at 06:19
  • hi Uwe,yes i do have a simple file upload form with scripts running in xampp. just a basic upload form for practice as i know implementing ffmpeg is gonna be a long road so i am very ready just to start researchin. asume a basic upload form like
    and offcourse there are other php files and scripts that handle the upload and transfer, i just want to know where to start and i can start walking my way up and definitely ask if i run into trouble.thanks@Uwe Mannl
    – Michelle Dimwaite Feb 03 '18 at 11:05

1 Answers1

0

Option 1: call ffmpeg.exe

If you are using PHP, you can call ffmpeg from your script like this:

$answer = shell_exec("ffmpeg.exe -i input.wav -codec:a libmp3lame -qscale:a 2 output.mp3");
echo $answer."</br>"; 

In this case, ffmpeg.exe and your input file (input.wav in my case) must be in the same folder as your php script, or you set the directory relative to it.

input.wav can be any other file, ffmpeg doesn't really care about it, as long as it is a usual audio file.

Documentation about shell_exec: http://php.net/manual/de/function.shell-exec.php

Information about mp3 encoding can be found here: https://trac.ffmpeg.org/wiki/Encode/MP3

Option 2: use PHP library

There are several php librarys for ffmpeg. But most of them are no longer maintened.

You could try this one: https://github.com/PHP-FFMpeg/PHP-FFMpeg

There is a good documentation, but I don't have any experiences with it.

Business Tomcat
  • 1,021
  • 9
  • 12