1

So I've been working on trying to get FFMPEG to encode videos that are uploaded to my site. The upload script calls the PHP binary using exec() to run a script called encode.php that looks like this:

include("include/config.inc.php");
$videoID = $argv[1];
exec("ffmpeg -i " . $_SERVER['DOCUMENT_ROOT'] . "/processing/" .  $videoID. ".mp4 -vcodec libx264 -vpre normal -s 1280x720 -r 30 -acodec libfaac " . $_SERVER['DOCUMENT_ROOT'] . "/videos/" . $videoID . ".mp4");
$connect = mysql_connect($dbhost, $dbusername, $dbpassword);
mysql_select_db($dbname, $connect);
$query = mysql_query("UPDATE `videos` SET `isProcessing` = 0 WHERE `id` = '$videoID' LIMIT 1");

However, nothing happens to the video at all. I've tried using the full path to FFMPEG, but that doesn't work either. I know the script is being executed as the isProcessing is set to 0 in the database.

Maybe I'm just clueless, but I can't seem to figure this out. Any help would be greatly appreciated.

  • 1
    Have a look at the error_log file to see if there is some information coming from the output of the execution of the ffmpeg command. You could also execute the command capturing its output, and show such output (for debugging purpose). – jap1968 Mar 27 '13 at 06:40
  • How long is your video? Since FFmpeg only makes your video available at the end of the conversion. Maybe your FFmpeg conversion is just very slow and hanging, since you are using libx264 for a 1280x720 size. You can shorten your video by setting a time capture of like 10 seconds using `-t 10`. Just test it out and see what happens. – Omega Mar 27 '13 at 08:01

1 Answers1

0

You might find this project useful: https://ffmpeg-php.readthedocs.org/en/latest/index.html#installation

ojreadmore
  • 1,465
  • 2
  • 17
  • 33
  • See this question as it may have to do with DYLD http://stackoverflow.com/questions/10107671/ffmpeg-mamp-dyld-library-not-loaded-error – ojreadmore May 03 '13 at 18:51