HI,
I am trying to convert an audio file that is in wav format to mp3 format. I have installed apache and I am using windows 8. I downloaded the files for ffmpeg and tried to run the php script and convert the file but no success. What I am doing is in the exec command I am giving the path to ffmpeg.exe and calling the convert command. Here is my code.

$ffmpeg =  $_SERVER['DOCUMENT_ROOT'].'/ffmpeg_test/bin/ffmpeg.exe';
exec($ffmpeg.' -i 10001_pre.wav file.mp3',$out,$return);

Now when I try to print the out variable it does not show me any thing. Can any one tell me what I am doing wrong. I think what I am missing is I need to get the ffmpeg package open through php.ini. If that is the case can anyone tell me how can I add the extension to my php.ini.
Thanks in advance.

if your PHP is not compile with ffmpeg-php, then you can call the exec like this.

## define the location of your ffmpeg somewhere in drive C: . Assuming that the location of ffmpeg binary file is located in drive c.

$ffmpeg_loc = 'c:/ffmpeg_test/bin/ffmpeg.exe';

## define options for your mp3 file

$mp3_options = '-acodec libmp3lame -ab 128k';

## if you are running the latest ffmpeg with volume support, you can it like this.
$mp3_options = '-vol 256 -acodec libmp3lame -ab 128k';

## define the input
$input = '10001_pre.wav';
## define the output name and location

$output = 'file.mp3';

## assemble everything and then execute.
exec($ffmpeg_loc.' -i '.$input $mp3_options $output );

Compile means that you have the codec dll files for the PHP, and the ffmpeg php extension. Else, use the above suggestions.

How can I use compile with ffmpeg. Ffmpeg is installed on my localhost.

it really depends on your system.If you are running xampp on windows 8, then just look at the php info. of your xampp installation and look for the compiler used on your version. Applications for windows are compiled with either VC9, VC11 .

The latest ffmpeg compiled by sergey89.ru was VC9, so this may not be compatible for the latest php version 5.5.3 on xampp version 1.8.3 with PHP version 5.5.3. However, you can probably use the older xampp release 1.8.2 which has php 5.4.x and I think this particular version was compiled in VC9.

Don't take my words on this.. I am just pulling these fragmented info. out of my head, and sometimes my memory does not serve me very well.. You need to do some searching on the subject matter.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.