-2

I have a project that requires me to produce a thumbnail from 2000 videos, i researched for a tool on the net and found that ffmpeg can do it, however i could not find a sample that will demonstrate how to work on a directory of videos and run on it do create thumbnail for all the videos, can any one point to a good sample Thanks Shimon

Shimon Wiener
  • 1,142
  • 4
  • 18
  • 39

1 Answers1

1

Your question is too broad, FFmpeg is not a magic tool, has nothing to do with directories, so your task will be a little bit more complicated here.

To extract a frame from a video, here's a command you can start with:

ffmpeg -i <INPUT_FILE.EXT> -filter_complex "select=between(t\,10\,20)*eq(pict_type\,I)" -vframes 1 -f image2 <OUTPUT.jpg>

This command will extract an I-frame from the video between 10 to 20 seconds. You may want to extend your filtergraph with a scale and crop filter to make your thumbnails the same format.

All you need to do is to put this command in a script that loops trough your video library. Hope it helped.

Gergely Lukacsy
  • 2,881
  • 2
  • 23
  • 28
  • Thanks' do you have a sample script to execute the process? or do you know where i can found one – Shimon Wiener Jul 25 '17 at 08:17
  • Since I don't know your folder structure or whatsoever, I assume that all videos are dumped in the same directory. In this case the loop would be something like this: `for /r %%i in (*) do ( ffmpeg -i %%i -filter_complex "select=between(t\,10\,20)*eq(pict_type\,I)" -vframes 1 -f image2 %%~ni.jpg )` You need to put this in a batch file, of course. Here's a related question how to loop trough files in windows batch: **[--link--](https://stackoverflow.com/questions/138497/iterate-all-files-in-a-directory-using-a-for-loop)** Have a good hacking! – Gergely Lukacsy Jul 25 '17 at 11:00