0

I'm trying to figuring out how to install and use ffmpeg on windows 64 with XAMPP.

I have flow this tutorial and install the ffmpeg-php librarys and I can see the expansion in the phpinfo().

Now I put my ffmpeg.exe in the site root folder and I run this php script:

extension_loaded('ffmpeg') or die('Error in loading ffmpeg');

function convertTo( $input, $output ) 
{
echo $cmd = "ffmpeg -i $input $output";
$outputData = array();
exec( $cmd , $outputData);
echo "<br/>";
print_r($outputData);
}

convertTo( "input.mp4", "output.flv" );

and I get this output:

ffmpeg -i input.mp4 output.flv
Array ( )

but no encoded file. My php safe mode is off and the movie file is in the root folder too.

workplace info:

  • win7 64bit
  • XAMPP 1.7.2
  • Apache 2.2
  • php 5.3.5

Help will be appreciated.

Bo.
  • 2,547
  • 3
  • 24
  • 36
Daniel
  • 2,288
  • 1
  • 14
  • 22
  • Enable the error.log, and error reporting. Why did you install the PHP extension, if you use the cmdline tool? – mario Jun 01 '12 at 09:23
  • possible duplicate of [How to convert videos with ffmpeg](http://stackoverflow.com/questions/4624556/how-to-convert-videos-with-ffmpeg) – mario Jun 01 '12 at 09:24
  • the error reporting is on and no output from error_get_last(), is maybe there is a problem with the directories ? all the files are in the same site root folder. – Daniel Jun 01 '12 at 09:38

1 Answers1

0

for windows, use ffmpeg.exe and modify code

function convertTo( $input, $output ) 
{
echo $cmd = "c:\\ffmpeg\\ffmpeg -i $input $output";
$outputData = array();
exec( $cmd , $outputData);
}

convertTo( "d:\www\input.mp4", "d:\www\output.flv" );

$outputdata not return anything, so don't expect output.

  • i need to use this script on a server so i can use only the root directorie. all my files are at C:\xampp\htdocs\ffmpeg-test -ffmpeg.exe -input.mp4 -script.php – Daniel Jun 01 '12 at 10:13
  • For above script ffmepeg.exe could be on different location, source and destination could be on different location. Change the path in script as per requirement. – user1423458 Jun 01 '12 at 10:28
  • i moved the files according to the answer and still noting happens. i downloaded the exe from [here](http://ffmpeg.zeranoe.com/builds/) and selected the **64-bit Builds (Static)** – Daniel Jun 01 '12 at 10:37
  • thanks to all, i have played around with the directories and got it working from the root file. – Daniel Jun 01 '12 at 11:38