I am trying to execute ffmpeg from php. I have installed ffmpeg locally on my mac via homebrew and I am able to run the commands I need via terminal.
When I try to execute the following code:
<?php
echo "Starting ffmpeg";
$output = shell_exec("ffmpeg -i test.mp3 -codec:a libmp3lame -b:a 128k out.mp3 2>&1");
echo "<pre>$output</pre>";
?>
I am receiving the following on my browser:
Starting ffmpeg
sh: 1: ffmpeg: not found
I am assuming that I somehow need to install ffmpeg to my xampp server but it is not obvious how to do that. After searching online I can find linux and Windows tutorials but I couldn't figure out something out by looking at them.
What I tried doing was to download the ffmpeg static build form https://ffmpeg.org/download.html#build-mac and placed it in the htdocs holder, and then tried to execute ffmpeg as if it was an executable (after changing chmod), but that gave me
sh: 1: ./ffmpeg: Exec format error
How would one go and install and then run ffmpeg on their xampp server?
source https://stackoverflow.com/questions/68958025/ffmpeg-not-found-when-running-ffmpeg-via-php-xampp-mac
Comments
Post a Comment