3

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?

LOZ
  • 1,169
  • 2
  • 16
  • 43
Lynx
  • 259
  • 1
  • 9
  • 26

2 Answers2

2

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);
    }
}
Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
0

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 . .

kushalbhaktajoshi
  • 4,640
  • 3
  • 22
  • 37