[英]how can i convert a video into image files using ffmpeg in c#?
string inputpath = strFileNamePath;
string outputpath = "C:\\Image\\";
//for (int iIndex = 0; iIndex < 1000; iIndex++)
//{
//string fileargs = "-i" + " " + inputpath + " -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv " + outputpath + "SRT.flv";
string fileargs = "-i" + " " + inputpath + " " + outputpath + "image.jpg";
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "C:\\Documents and Settings\\Badr\\My Documents\\Visual Studio 2008\\Projects\\Video2image2video.\\ffmpeg\\ffmpeg.exe";
p.StartInfo.Arguments = fileargs;
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
我有此代碼,這僅創建了1張視頻圖像,我應用了一個循環,但我反復生成了初始圖像,我該如何獲取所有視頻的圖像
預先感謝
嗨,當您以這種方式返回時,您想在視頻文件中拍攝圖像嗎?
for (int i = 0; i < iImageCount; i++)
{
string sInputVideo = Page.MapPath(...);
string sImageCapture = Page.MapPath("") + "\\Videolar\\" + ImageName+ "_" + iResim + ".jpg";
ffmpeg.StartInfo.Arguments = " -i \"" + sInputVideo + "\" -s 108*100 -ss " + iImageCapture + " -vframes 1 -f image2 -vcodec mjpeg \"" + sImageCapture + "\"";
ffmpeg.StartInfo.FileName = (Server.MapPath("Referanslar/ffmpeg.exe"));
ffmpeg.Start();
ffmpeg.WaitForExit();
ffmpeg.Close();
iImageCapture += 1;
iResim++;
}
您可以通過更改來隨意拍攝照片;)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.