.wmvビデオのサムネイルを作成しようとしています。私は次のコードを試しました:ffmpeg.exeを使用してサムネイルを作成する方法
Guid id = Guid.NewGuid();
string thumbpath, thumbname, videopath;
string thumbargs, inputfile;
thumbpath = "C:\\Users\\Tom\\Desktop\\picture gallery\\";
thumbname = thumbpath + id.ToString() + ".jpg";
videopath = "C:\\Users\\Tom\\Desktop\\video gallery\\";
inputfile = Videopath + id.ToString() + ".wmv";
thumbargs = "-i " + inputfile + " -vframes 1 -ss 00:00:07 -s 150x150 -f image2 " + thumbname;
Process thumbproc = new Process();
thumbproc = new Process();
thumbproc.StartInfo.FileName = "C:\\Users\\Tom\\Desktop\\ffmpeg\\ffmpeg.exe";
thumbproc.StartInfo.UseShellExecute = false;
thumbproc.StartInfo.CreateNoWindow = false;
thumbproc.StartInfo.RedirectStandardOutput = false;
try
{
thumbproc.Start();
if (thumbproc != null)
{
thumbproc.Close();
}
}
catch (Exception ex)
{
lblMessage.Text = ex.Message;
lblMessage.ForeColor = System.Drawing.Color.Red;
lblMessage.Visible = true;
}
"ビデオギャラリー"フォルダに保存されているビデオにアクセスしています。私の解決策の問題は、ソリューションを実行するときにエラー "ffmpeg 'gallery \ 69b77a48-1b3c-4ce7-8c5a-fba10af5d9b1.jpg'に適した出力形式を見つけることができませんでした。
サムネイル(画像ギャラリーまたはビデオギャラリー)のパス内のスペースを削除してもうまくいきます。
私の "thumbargs"に問題があるかどうか、私のコードでは分かっていないことを教えてください。
私は後者を追加しました。 thumbproc.StartInfo.Arguments = thumbargs;私は同じ問題に直面している。 – prasad