1. What is FFmpeg? Now let's take a look at the introduction of Baidu Encyclopedia.
FFmpeg is an open source free Cross-platform video and audio streaming program that belongs to free software, using LGPL or GPL licenses (based on the components you choose). It provides a complete solution for recording, converting, and streaming audio and video. It contains a very advanced audio/video codec library Libavcodec, in order to ensure high portability and codec quality, Libavcodec Many codec are developed from scratch.
2. Compile the required source code package
Yasm:http://yasm.tortall.net/download.html (assembler, new version of FFmpeg added assembly code)
lame:http://lame.sourceforge.net/download.php (MP3 audio decoding)
Opencore AMR:HTTP://SOURCEFORGE.NET/PROJECTS/OPENCORE-AMR
Amrnb:http://www.penguin.cz/~utx/amr
Amrwb:http://www.penguin.cz/~utx/amr
Ffmpeg:http://ffmpeg.org/download.html.
Extract and compile the above source package separately
#tar XZVF *.tar.gz
#tar XJVF *.tar.bz2
Use directly after decompression
#./configure
#make
#make Install
command to compile the installation.
A little special when compiling FFMPEF:
#./configure--enable-libmp3lame--enable-libopencore-amrnb--ENABLE-LIBOPENCORE-AMRWB--enable-version3-- Enable-shared
#make
#make Install
#ldconfig
After the last write config, the terminal runs the FFmpeg command, and the success and installed extensions appear, and the operation succeeds.
3. How to use
MP3 convert amr:ffmpeg-i 1.mp3-ac 1-ar 8000 1.amr
AMR Conversion Mp3:ffmpeg-i 1.amr 1.mp3
problems that may be encountered
1.ffmpeg Default installation directory is "/usr/local/lib", some 64-bit system under the software directory is "/usr/lib64", the compilation process may appear
"Ffmpeg:error while loading shared libraries:libmp3lame.so.0:cannot open Shared object file:no such file or directory" and other similar mistakes,
The solution is to create soft links:
#ln-S/usr/local/lib/libmp3lame.so.0.0.0/usr/lib64/libmp3lame.so.0
2. At this point, if the following prompt appears:
Ffmpeg:error while loading shared libraries:libavdevice.so.54:cannot open Shared object file:no such file or directory
You can view ffmpeg's dynamic-link libraries in the following ways, which are not found:
# ldd ' which ffmpeg '
libavdevice.so.54 => not found
Libavfilter.so.3 => not found
libavformat.so.54 => not found
libavcodec.so.54 => not found
libswresample.so.0 => not found
Libswscale.so.2 => not found
libavutil.so.51 => not found
Libm.so.6 =>/lib64/libm.so.6 (0x00002ab7c0eb6000)
libpthread.so.0 =>/lib64/libpthread.so.0 (0x00002ab7c100b000)
Libc.so.6 =>/lib64/libc.so.6 (0x00002ab7c1125000)
/lib64/ld-linux-x86-64.so.2 (0x00002ab7c0d9a000)
If similar to the output above, look for the above class library:
# find/usr/local/lib/| Grep-e "libavdevice.so.54|libavfilter.so.3|libavcodec.so.54"
/usr/local/lib/libavfilter.so.3.17.100
/usr/local/lib/libavcodec.so.54.59.100
/usr/local/lib/libavdevice.so.54
/usr/local/lib/libavcodec.so.54
/usr/local/lib/libavfilter.so.3
/usr/local/lib/libavdevice.so.54.2.101
Will find it all under the/usr/local/lib/.
View the link library profile
# More/etc/ld.so.conf | Grep/usr/local/lib
If it is not included, you need to edit this article to add:
/usr/local/lib
/usr/local/lib64
Run Configuration command
# Ldconfig
----------------------------------------------------------------------------------------------------------
The above is reproduced
1 If Setup Amrnb encounters an error:
Configure:error:You need patch utility to prepare sources.
Perform:
Yum Install patch
2 encountered Error:libopencore_amrnb not found
Cd..
wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz?r=http ://SOURCEFORGE.NET/PROJECTS/OPENCORE-AMR/&TS=1285256783&USE_MIRROR=UFPR
TAR-XF opencore-amr-0.1.2.tar.gz
CD opencore-amr-0.1.2
./configure
Make && make install clean
3 Appears "MAKE: * * * [libavcodec/libavcodec.so.55] Error 1"
Make a clean and/configure ...
Install ffmpeg-php
(1) Download the installation package
wget http://jaist.dl.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.5.3.1/ffmpeg-php-0.5.3.1.tbz2
or http://jaist.dl.sourceforge.net/project/ffmpeg-php/ffmpeg-php/
Install ffmepg-php
#tar-JXVF ffmpeg-php-0.6.0.tbz2
#cd ffmepg-php
#/usr/local/php/bin/phpize
#./configure--with-php-config=/usr/local/php/bin/php-config--WITH-FFMPEG=/USR/LOCAL/FFMEPG
#make && make Install
Error situation
Make: * * * * [Ffmpeg-php.lo] Error 1
Solve:
# MV Ffmpeg-php.lot Ffmpeg-php.lo
Make: * * * * [Ffmpeg_movie.lo] Error 1
Solve:
# MV Ffmpeg_movie.lot Ffmpeg_movie.lo
Make: * * * * [Ffmpeg_frame.lo] Error 1
Solve:
# MV Ffmpeg_frame.lot Ffmpeg_frame.lo
Make: * * * * [Ffmpeg_errorhandler.lo] Error 1
Solve:
# MV Ffmpeg_errorhandler.lot Ffmpeg_errorhandler.lo
Make: * * * * [Ffmpeg_tools.lo] Error 1
Solve:
# MV Ffmpeg_tools.lot Ffmpeg_tools.lo
(4) test
In the PHP configuration php.ini file, add the following content
Extension=ffmpeg.so
Restart Apache or PHP-FPM, test with PHP
/usr/local/php/bin/php-r ' phpinfo (); ' | grep ffmpeg
Ffmpeg
FFmpeg Support (ffmpeg-php) => enabled
ffmpeg-php version => 0.5.3.1
ffmpeg-php GD support => enabled
Ffmpeg.allow_persistent => 0 => 0
Ffmpeg.show_warnings => 0 => 0
............................ Omitted
installation of FFmpeg PHP extensions under the 64-bit Win7 system
I installed a 64-bit version of win7,php in my notebook and the previous one was the same, then it was the FFmpeg expansion pack that downloaded that version (Win32) and then put Php_ Ffmpeg.dll into PHP's ext directory, put the rest into the system32. Found invalid, To the Apache Error.log view is no wrong to remind, make me very depressed, I also posted on the csdn also told me to go to Error.log to see the error, but is not see, I also tried to write a wrong in php.ini DLL, found Apache Error.log Also can not see the error.
Finally found that this can solve the problem: or put the php_ffmpeg.dll into the ext, the rest of the DLL do not put under System32, but to put into the 64-bit system unique C:\Windows\SysWOW64 directory, and then good.
PS: Although Ffpmpeg has 64-bit extensions, this 64-bit is consistent with PHP, not your operating system. I finally debug out of the problem is to use under the command to run PHP, directly if there are errors, such as you load the wrong DLL, this time will bounce out of the wrong, and quickly help to solve the problem!