Lynx
Lynx

Reputation: 257

how to generate thumbnail for all video file using ffmpeg?

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

Answers (2)

Jeremy Thompson
Jeremy Thompson

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

kushalbhaktajoshi
kushalbhaktajoshi

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

Related Questions