在闪吧看别人的帖子看了这么多年了,也没有做出过大的贡献.所以积分少的可怜,近来工作少了,考试又顺利,暑假也放了,应该做点贡献了,废话少说了下面开始讲内容.
现在flash做的播放器相当的流行的,但是一般都只能播放mp3的声音文件和flv的视频文件,所以很大程度上限制了播放的内容.要解决这个问题就是把文件转换成mp3或者flv格式的视频.下面主要的讲flv格式的转变.
flv格式的转变大家都知道的一种就是导入视频,然后转换的方法,网上有很多的相同的教程,所以我在这里就不浪费大家的时间和论坛的空间了,请上百度搜索.
大家如果用手动的转换,少量的FLV还可以,那么大量的文件将会使工作变的相当的复杂的,所以解决的方法就是在服务器端,用程序让视频文件格式转变.
视频文件的转变的方法就是根据视频格式的编码的不相同,来转变的,当然我们如果要写一个转变的文件将会使工作变的相当的繁杂的,还好,有一个叫ffmpeg的解决方案.
我们需要做的就是把ffmpeg编译成exe文件,然后通过asp(或者php来调用exe文件.). 在asp中使用WScript.Shell可以很简单的调用,关键的难点在于,ffmpeg的编译,和使用的方法,编译的教程,原文件本身有,但是是英文的,所以我翻译后贴在了闪吧.
We install the Minimalist GNU for Windows MinGW (Compiler) and MSYS (Minimal SYStem) which is a kind of UNIX-shell to access the MinGW-commands. Next we download, compile and install Lame, an open-source mp3-codec, with MSYS. Next we install WinCVS and checkout the latest cvs-release of FFMPEG. Finally we compile ffmpeg and I will show a few examples how to work with Flash Video (FLV).
翻译:我们首先安装windows编译程序Minimalist GNU和一个UNIX-核心的 MSYS (Minimal SYStem)来成功的编译程序。接下来,我们下载、编译和用MSYS安装开源的MP3编码程序。然后我们安装WinCVS,找出FFMPEG的最新版本的cvs.最后我们编译FFMPEG,接下来,我将给大家展示如何来使用FLV。
Download MinGW " MSYS current releases (Window Exe Binaries MSYS-1.0.10.exe & MinGW-3.1.0-1.exe)
下载MinGW的当前的版本(Window Exe Binaries MSYS-1.0.10.exe & MinGW-3.1.0-1.exe)
Install MinGW
安装MinGW
Install MSYS
安装MSYS
HINT: During the Post install be sure to set the right path to MinGW with a "/" instead of a Windows-"". If you did it wrong anyway re-install MSYS to the same directory and do the post install right (I missed it a few times)
提示:在安装位置的时候必须给MinGW用“/”来代替windows中的” ”设置正确的路径,如果你安装过程不正确,请一定要重新的安装到同一个地址并且保证安装正确(我就安装错了好几次的)。
Download and compile Lame
下载并且编译lame
Extract Lame to your MSYS home-directory
把lame提取到你的 MSYS的根目录。
Open MSYS and change to your lame-directory (cd ../lame-XXX)
打开你 MSYS并且跳转到你lame所在的目录(cd ../lame-XXX)
Enter the following commands:
输入下面的命令:
CODE:
代码:
./configure //(takes a few minutes)
make //(lame is being comiled; takes a few minutes, too)
make install
After installing you will recognize that there are new directories and files in MSYS/local which we will use while compiling ffmpeg with mp3-support
等你安装完成了以后你会发现在MSYS/local下有几个我们在用mp3-support编译ffmpeg的时候用到的几个文件和文件目录。
Download WinCVS (http://www.wincvs.org) and install it
然后下载WinCVS(http://www.wincvs.org)安装
Open the Command-Line window (CTRL-L) and enter the command:
打开window命令行(ctrl-l)并且键入下列命令
CODE:
命令为:
cvs -z9 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg
Select "Execute for directory" and browse to you MSYS-Directory and select your home-directory ("home")
选择"Execute for directory"并且浏览你的MSYS目录,然后选择你的根目录("home")
Press "OK" and the current cvs release will be checked out into your home-directory
点OK,然后现在的CVS版本将会检测到你的根目录下的。
Compile FFMPEG
开始编译FFMPEG
Change the directory in MSYS to your ffmpeg-directory (cd ../ffmpeg)
改变 MSYS中的目录到你的ffmpeg的安装目录(cd ../ffmpeg)
Enter the command:
键入下列命令
CODE:
命令