0
votes

I am using ffmpeg for video conversion, it is working fine in local. But when I upload the site in online it is not converting the videos. It is showing operation failed should I install the ffmpeg in server also.

public void 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;
    }

}
1
i got the solution for this, i for got to give folder permission for ffmpeg - Surya sasidhar

1 Answers

0
votes

Please define your problem clearly if you ask something.

Anyway I'll try to answer it:
You don't need to install ffmpeg on the server, maybe your code is not correct, or something else can cause the problem. Take a look at my blog post below maybe this can help you.

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