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')

  • How did you install ffmpeg? Why are you running "LAMPP"? – Michael Hampton Nov 18 '15 at 1:35
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 \/.
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.