0

Here are the paths for localhost:

/Applications/MAMP/htdocs/NAME_OF_WEBSITE/
/usr/local/bin/ffmpeg

Here are the paths for the live website:

/var/www/html/NAME_OF_WEBSITE/
/usr/bin/ffmpeg

Finally, here are the commands for the localhost and live website:

LOCAL
=====
exec('/usr/local/bin/ffmpeg -i "' . $uploaded_file . '" -c:v libx264 "./videos/' . $video_mp4 . '" -y 1>2>&1');
LIVE
====
exec('/usr/bin/ffmpeg -i "' . $uploaded_file . '" -c:v libx264 "./videos/' . $video_mp4 . '" -y 1>2>&1');

On the live website, the php code is not reading the 'ffmpeg' file. Can someone please help me?

margie
  • 1
  • 5
  • Have you checked the output of the `exec()` function? – KIKO Software Nov 04 '21 at 08:01
  • I did, and it works. I also added php error_reporting and it read, "Notice: Undefined index: file in /var/www/html/NAME_OF_WEBSITE/video-upload.php on line 9". Line 9 reads, "$file_name = basename($_FILES['file']['name']);" – margie Nov 04 '21 at 08:08
  • Then why do you say, in your question, that it doesn't work? Anyway, that error is unrelated to your question. I would advice to read the manual where it discusses [Handling file uploads](https://www.php.net/manual/en/features.file-upload.php) or use a good tutorial. – KIKO Software Nov 04 '21 at 08:11
  • I just ran a function to see if it worked. But the video is not converting to mp4. – margie Nov 04 '21 at 08:23
  • You need to do some debugging. See: [PHP parse/syntax errors; and how to solve them](https://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them). This requires some practice. – KIKO Software Nov 04 '21 at 08:29

1 Answers1

0

I finally figured it out. I would tell you how I did it, but I really don't know myself. I just kept playing with the syntax until I finally got it right. Here's the 'exec()' that made it work: "exec("/usr/bin/ffmpeg -i $uploaded_file videos/$db_file_name");" It was in the exec() all the time, and I thought it was the path to ffmpeg that was the culprit. KIKO Software was right on point when he got me to focus on the syntax.

margie
  • 1
  • 5