关于其他视频文件向.flv文件转换的问题

今年最火的就是在线视频网站了。

这些网站都是.flv文件。.flv文件可以支持边下载边播放,而且占用空间比较小。

现在就有一个问题,如何让网站用户 不论上传什么文件,都自动转换为.flv文件?

我前几天稍微学习了一点点这方面的东西。

转换主要用到了两个控件。

1:mEncoder。2:ffmpeg

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

%
>


申明

非源创博文中的内容均收集自网上,若有侵权之处,请及时联络,我会在第一时间内删除.再次说声抱歉!!!

博文欢迎转载,但请给出原文连接。

原文地址:https://www.cnblogs.com/Athrun/p/1030999.html