【问题标题】:Save taken snapshot保存拍摄的快照
【发布时间】:2014-10-08 22:30:54
【问题描述】:

我已经完成了this question 中的所有操作。一切都很好,除了一个。我无法保存拍摄的快照。如果我继续调试一切都很好.. 有什么问题?

 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");

【问题讨论】:

    标签: c# ffmpeg snapshot


    【解决方案1】:

    我假设您正在提取 640x480 的缩略图,而 velicina 是用于指定分辨率的参数,由您发布的部分代码判断。在这种情况下,您有一个 ffmpeg 语法错误,您可以更改 GetThumbnail 函数,如下所示:

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

    特别是,-s 告诉 ffmpeg 输出的分辨率。试试看有没有效果。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-14
      • 1970-01-01
      • 1970-01-01
      • 2014-12-03
      • 1970-01-01
      • 1970-01-01
      • 2011-09-30
      相关资源
      最近更新 更多