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

    技术2022-05-11  58

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

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

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

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

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

    1:mEncoder。2:ffmpeg

    ffmpeg可以很方便的把大部分视频格式转换为.flv格式的。但是不支持.rm,.rmvb的。所以需要用mEncoder把.rm或者.rmvb直接转换为.flv的。但是我没有转换成功过,所以我只能先转换为.avi的,然后再用ffmpeg转换为.flv。

    ffmpeg.asp:

    <%Server.ScriptTimeout=0str=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 " & toFilei_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=1

    http://www2.flash8.net/teach/5411.htm


    最新回复(0)