Reputation: 257
I successfully generated a thumbnail for a video file using ffmpeg and now I want to create a thumbnail for each video in directory. How can I read all video files in the directory and generate thumbnail for each video using ffmpeg?
Upvotes: 3
Views: 1434
Reputation: 65534
DirectoryIntoThumbNails(@"C:\VideoFolder", "*.mpg")
void DirectoryIntoThumbNails(string sDir, string extension)
{
try
{
foreach (string d in Directory.GetDirectories(sDir))
{
foreach (string f in Directory.GetFiles(d, extension))
{
SystemDiagnostics.Process.Start(@"C:\Ffmpeg.exe " + f + commandYouUsedSuccessfullyOnOneFile)
}
//Uncomment this if you want it to be recursive - all sub folders
//DirSearch(d, extension);
}
}
catch (System.Exception excpt)
{
Console.WriteLine(excpt.Message);
}
}
Upvotes: 2
Reputation: 4678
Try this
using System.IO;
string[] filePaths = Directory.GetFiles(@"c:\MyDir\");
Browse this link for Get Files from Directory
Now manipulate the array filePaths
and generate thumbnail for the videos . .
Upvotes: 0