0

I have this aplication where I need to convert video files to MP4 and then compress it. I'm trying to use FFMPEG to get this to work. Tried the command lines in the console and it works great

Converting

ffmpeg -i teste.avi teste.mp4

Compressing

ffmpeg -i teste.mp4 -acodec mp2 teste.mp4

But when I do the same within a PHP script, it starts yelling that something called GLIBCXX is not installed. This is the error:

ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/i386-linux-gnu/libjack.so.0)
ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /usr/lib/i386-linux-gnu/libjack.so.0)
ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/i386-linux-gnu/libjack.so.0)
ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /usr/lib/i386-linux-gnu/libzmq.so.3)
ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/i386-linux-gnu/libzmq.so.3)
ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/i386-linux-gnu/libopencv_core.so.2.4)
ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /usr/lib/i386-linux-gnu/libopencv_core.so.2.4)
ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/i386-linux-gnu/libopencv_core.so.2.4)

This is my script

$r = shell_exec("ffmpeg -i $file_path $output_path 2>&1"); //convert
$r = shell_exec("ffmpeg -i $file_path -acodec mp2 $file_path 2>&1"); //compress

I'm running the script on Ubuntu

@edit I can run, for example, shell_exec('ls')

Victor Ferreira
  • 135
  • 1
  • 1
  • 5

2 Answers2

1

You are running a XAMPP server, so everything in there is running with the libraries that came with it. The problem is that now you trying to run a program that uses the system libraries and on an environment that has been set up to use a particular another libraries. You have two choices:

  • Install the LAMP stack on your Ubuntu box from the repository. tasksel makes that a breeze. That way PHP will run in the same environment ffmpeg is running.
  • Setting the LD_LIBRARY_PATH to the global values inside your PHP script wherever you are going to run ffmpeg. You can find those values if you run ldconfig -v | grep \/.
Mauricio López
  • 974
  • 4
  • 9
0

What I did to fix this was I went to /usr/lib and searched for libstdc++ (this directory has newer versions) and copied it to /opt/lampp/lib.

I took a backup of the original file and pasted the new file and BOOM! It worked! :)

I hope it works for you too.