|
1、在vs2005中内部浏览器及DOS中调试运行都正常,自动生成1.flv和1.jpg,但在IE等外部浏览器运行没任何反应,怪。。。 <%@ Page Language="VB" Debug="true" %> <%@ Import Namespace="system.IO" %> <script runat="server"> Sub runcmd(ByVal Src As Object, ByVal E As EventArgs) Shell("cmd.exe /c ffmpeg.exe -i 1.3gp -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 1.flv -f image2 1.jpg", , True, 20000) Shell("cmd.exe /c flvtool2 -UPx 1.flv", , True, 20000) End Sub </script> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>ASP.NET Shell</title> </head> <body> <form runat="server"> <asp:Button ID="Button" runat="server" Text="Run" OnClick="runcmd" /> </form> </body> </html> 2、上面代码如何改成自动生成,而不用点“RUN”按钮才运行,谢谢。 3、我用vc#写的直接运行两个DOS命令行时(代码如下),为什么总是不成功,我看XP的进程,是ffmpeg .exe flvtool2.exe cmd都没正常退出,所以第一个问题解决不了,才用VB的,我试过成功了一半,象上面讲的,IE等外部浏览器运行没任何反应 // Create the ProcessInfo object System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("cmd.exe"); psi.UseShellExecute = false; psi.RedirectStandardOutput = true; //psi.RedirectStandardInput = true; psi.RedirectStandardError = true; String str = Request.PhysicalApplicationPath; if (PubExtenName == ".flv") //判断扩展名,是flv不转换,非flv视频就转换成flv { psi.Arguments = "/c " + str + "ffmpeg\\ffmpeg.exe -i " + str + "Files\\" + PubFileName + PubExtenName + " -y -f image2 -ss 8 -t 0.001 -s 350x240 " + PubFileName + ".jpg"; } else { psi.Arguments = "/c " + str + "ffmpeg\\ffmpeg.exe -i " + str + "Files\\" + PubFileName + PubExtenName + " -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 " + PubFileName + ".flv -f image2 " + PubFileName + ".jpg"; } psi.WorkingDirectory = str+"Files\\"; cmd = psi.Arguments;
// Start the process System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);
MessageBox.Show(OldFileName + "文件上传完成!" + str + "Files\\" + OldFileName); //if (proc.Length >0) //{ if (!proc.HasExited) { if (proc.Responding) { proc.Close(); } else { proc.Kill(); } }
后面是运行flvtool2.exe的命令,是照着上面套的,运行不成功。
我是菜鸟,我怕谁,怕高手~~~
|