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;
}
}
我得到了解決此,我對得給文件夾權限的ffmpeg – 2010-11-04 10:05:57