ffmpeg可以很方便的把大部分视频格式转换为.flv格式的。但是不支持.rm,.rmvb的。所以需要用mEncoder把.rm或者.rmvb直接转换为.flv的。但是我没有转换成功过,所以我只能先转换为.avi的,然后再用ffmpeg转换为.flv。
ffmpeg.asp
:
<%
Server.ScriptTimeout=0
str=server.MapPath("ffmpeg1.exe")
video=server.MapPath("xyx.AVI")
flv=server.MapPath("xyx.flv")
Set WshShell = server.CreateObject("Wscript.Shell")
str=str&" -i "&video&" -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 "&flv
Isffmpeg = WshShell.Run(str,1,false)
if Isffmpeg = 0 Then
Response.Write str&"<br/>"
end if
Set WshShell = Nothing
%>
mEncoder.asp:
<%
tools=Server.mapPath("mencoder.exe")
comeFile=Server.MapPath("xyx.wmv")
toFile=Server.MapPath("rmvb.avi")
Set Shell = Server.CreateObject("wScript.Shell")
str=tools & " "&comeFile&" -oac mp3lame -lameopts preset=64 -ovc xvid -xvidencopts bitrate=600 -of avi -o " & toFile
i_certify_that_my_video_stream_does_not_use_b_frames -ovc lavc -lavcopts vcodec=flv:vbitrate=200 -srate 22050 -oac lavc -lavcopts acodec=mp3:abitrate=56 ok \"&comeFile&" -o ok \" & toFile
IsMenCoder = Shell.run(str,1,false)
if IsMenCoder = 0 Then
Response.Write("成功!")
response.write("<br />" & str)
end if
Set Shell = Nothing
%>
参考资料:
http://hi.baidu.com/injava/blog/item/84c01a3356f395f81b4cff3d.html
http://www.hkepc.com/bbs/viewthread.php?tid=346269&extra=page%3D1
http://www2.flash8.net/teach/5411.htm
|
|