2010-11-04 164 views
0
I am using ffmpeg for video convertion, it is working fine in local. 

但是,當我在線上傳該網站時,它並沒有轉換視頻。它顯示操作失敗,我應該在服務器上安裝ffmpeg。ffmpeg視頻轉換問題?

公共無效convertFile()

{ 

    lblStatus.Visible = false; 
    try 
    { 

     int i = sFile.LastIndexOf("."); 
     thumb = sFile.Remove(i); 
     thumb = thumb + ".jpg"; 
     video = Page.MapPath("../VideoOut/" + sFile); 
     Image = Page.MapPath("../VideoSnapShots/" + thumb); 
     ffmpeg = new Process(); 
     ffmpeg.StartInfo.Arguments = " -i \"" + video + "\" -vframes 1 -ss 00:00:10 -s 150x150 -f image2 -vcodec mjpeg \"" + Image + "\""; // arguments ! 
     ffmpeg.StartInfo.FileName = Page.MapPath("FFMPEG\\ffmpeg.exe"); 
     ffmpeg.Start(); 
     Session["image"] = thumb; 
     string mpg; 
     string VideoOut; 
     int j = sFile.LastIndexOf("."); 
     mpg = sFile.Remove(j); 
     mpg = mpg + ".flv"; 
     video = Page.MapPath("../VideoOut/" + sFile); 
     VideoOut = Page.MapPath("../Videos/" + mpg); 
     ffmpeg.EnableRaisingEvents = true; 

     ffmpeg.StartInfo.Arguments = " -i \"" + video + "\" -ar 22050 \"" + VideoOut + "\""; 
     ffmpeg.StartInfo.FileName = Page.MapPath("FFMPEG\\ffmpeg.exe"); 
     ffmpeg.Start(); 
     ffmpeg.StartInfo.UseShellExecute = false; 
     ffmpeg.StartInfo.CreateNoWindow = false; 
     ffmpeg.StartInfo.RedirectStandardError = true; 
     ffmpeg.StartInfo.RedirectStandardOutput = false; 
     ffmpeg.WaitForExit(); 
     ffmpeg.Close(); 
     Session["videosrc"] = mpg; 

     InsertVideo(); 
     File.Delete(video); 

    } 
    catch (Exception ex) 
    { 
     lblStatus.Visible = true; 
     lblStatus.Text = ex.Message; 
    } 

} 
+0

我得到了解決此,我對得給文件夾權限的ffmpeg – 2010-11-04 10:05:57

回答

0

清楚,如果你問的東西,請確定您的問題。

無論如何,我會盡力回答它:
您不需要在服務器上安裝ffmpeg,也許您的代碼不正確,或者其他問題可能導致此問題。看看我的博客文章下面,也許這可以幫助你。

http://www.arief.me/post/2007/05/06/Upload-and-Convert-Video-to-FLV-using-ASPNET-and-Windows-Service.aspx

+0

我會送我的代碼,請veryfy – 2010-11-04 08:14:50

+0

阿里耶夫伊曼·桑托斯先生ü可以請我的代碼 – 2010-11-04 08:22:35

+0

它在本地工作,當我上傳在線它給予操作失敗 – 2010-11-04 08:23:04