0

I have done everything how is in this question. everything is alright except one. I can't save the taken snapshot. If I'll follow with debug everything is alright.. what's wrong?

 public class FFMPEG
{
    Process ffmpeg;
    public void exec(string input, string parametri, string output)
    {
        ffmpeg = new Process();

        ffmpeg.StartInfo.Arguments = " -i " + input + (parametri != null ? " " + parametri : "") + " " + output;
        ffmpeg.StartInfo.FileName = HttpContext.Current.Server.MapPath("~/ffmpeg.exe");
        ffmpeg.StartInfo.UseShellExecute = false;
        ffmpeg.StartInfo.RedirectStandardOutput = true;
        ffmpeg.StartInfo.RedirectStandardError = true;
        ffmpeg.StartInfo.CreateNoWindow = true;

        ffmpeg.Start();
        ffmpeg.WaitForExit();
        ffmpeg.Close();
    }

    public void GetThumbnail(string video, string jpg, string velicina)
    {
        if (velicina == null) velicina = "640x480";
        exec(video, "-ss 00:00:06 " + velicina, jpg);
    }

}


FFMPEG f = new FFMPEG();
            f.GetThumbnail(Server.MapPath("~/Uploads/" + unique), Server.MapPath("~/Thumbnails/" + unique.Remove(unique.IndexOf(".")) + ".jpg"), "1200x223");
Community
  • 1
  • 1

1 Answers1

0

I assume you are extracting 640x480 thumbnails, and velicina is the parameter used to specify the resolution judging by the partial code you posted. In this case, you have a ffmpeg syntax error and you can change GetThumbnail function as belowing for a try:

public void GetThumbnail(string video, string jpg, string velicina)
{
    if (velicina == null) velicina = "640x480";
    exec(video, "-ss 00:00:06 -s" + velicina, jpg);
}

Specially, -s tells ffmpeg the resolution for the output. Try whether it works out.

JasonYang
  • 686
  • 7
  • 14