How can I convert video to 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();
I have this code that only creates 1 image of the video, I am applying a loop, but I am repeatedly generating the original image, how can I get the images of the whole video
thanx in advance
a source to share
From ffmpeg documentation :
You can extract images from videos, or create videos from many images:
To extract images from video:
ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-% 03d.jpeg
This will extract one video snippet after the second from the video and output them in files named
foo-001.jpeg',
foo-002.jpeg, etc. Images will be rescaled to match the new WxH values.
So, just change the arguments you pass to ffmpeg and you should be up and running.
a source to share
Hi you want to take pictures in video files when you want to go back this way;
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++;
}
You can take pictures as you like by changing it;)
a source to share