Wed 19 Apr 2006
If you want to convert other video format to FLV (sorenson codec), everybody will suggest using FFmpeg. In fact, only FFmpeg is not enough for successfully create a server-side command line conversion environment to create FLV with video and audio, plus the FLV 1.1 metadata information. I have stroked for a whole day to setup my Linux server (Fedora Core 3), so I wrote down my note here for other people and myself as a reference.
Purely install FFmpeg is not enough, the FLV converted has no audio, because FLV audio codec is mp3, so you need LAME support. Moreover, the FLV converted has no metadata, you cannot know the dimension, duration such important information for a FLV player swf. Therefore, you need another free tool: FLVTool2, which is written in Ruby, so I have to install Ruby in my server, too.
Overall installation order: LAME->FFmpeg->Ruby->FLVTool2, if you want to access video info through FFmpeg in php, you can install ffmpeg-php, too.
Please login as root first:
Download from LAME site, type the following command to compile and install it:
./configure --enable-shared --prefix=/usr
enable-shared to make sure FFmpeg can use LAME later. Type lame in command line to see help after install succeed.
Note: you can also use yum to install FFmpeg, it will install dependency LAME, too, so you can skip this step.
yum install ffmpeg
Download from FFmpeg site through CVS, type the following command to get the latest copies from CVS and save to your $home (currenly path after login into consule) with folder name “ffmpeg”:
cvs -z9 -d:pserver:email@example.com:/cvsroot/ffmpeg co ffmpeg
To compile and install it, type the following command:
./configure --enable-gpl --enable-mp3lame --enable-shared --prefix=/usr
make clean && make
enable-shared to make sure ffmpeg-php can use FFmpeg later (if you do not use ffmpeg-php, you do not need –enable-shared –prefix=/usr). Type ffmpeg in command line to see help after install succeed.
Note: you can also use yum to install FFmpeg:
yum install ffmpeg
Download from Ruby site, type the following command to compile and install it:
Download from FLVTool2 site, type the following command to compile and install it:
ruby setup.rb config
ruby setup.rb setup
sudo ruby setup.rb install
Type flvtool2 in command line to see help after install succeed.
Installation is completed here. If you want to access video infomation easily in php, there is a ffmpeg-php you can try. You can follow the instruction inside the package to install it. I installed it as a Shared Extension and did not edit php.ini to add
extension=ffmpeg.so When I try its test_ffmpeg.php to verfiy the installation. I saw an error:
Unable to load dynamic library './ffmpeg.so' - ./ffmpeg.so: cannot open shared object file: No such file or directoryYou have to copy ffmpeg.so to your php extension folder, or like me, I just copy the file to the same folder of the php script is located.
- FFMpeg compiled Windows exe
- Video and Audio Streaming with Flash and Open Source Tools
- libflv – creating FLV video streams
- FLV2MP3 (Make FlashCom recorded FLV conversion possible ?!)
- Flash 视频(FLV)编码,转换,录制,播放方案一网打尽
- How To: Convert audio to another format on a web page (with installation guide, php code sample)