When we are working with video sites, we often need to create our thumbnails, and often enough this happens to be in a folder with dozens if not more videos in it. The “old” or current process is to open that video, pause it in your video player, and take a screenshot. While not a huge issue if your doing a video or two, but once you get above that, well it becomes a pain. What if we can automate this process? Enter FFmpeg, the standard for internet video, were pretty much all video is based from.
In this example, I have a dozen or so videos I want to make thumbnails for.
So how to we take these 17 videos I have here, and automate this process? Well pretty easy,
Navigate to the folder in question and then just run the following command.
for f in *.mp4; do ffmpeg -i "$f" -ss 00:01:00 -vframes 1 "${f%.mp4}.jpg"; done
The above command does the following.
for f in *.mp4 -> In the folder look for all files with a mp4 extension.
do ffmpeg -i “$f -> Look over those mp4 files and then.
-ss 00:01:00 -vframes 1 -> Grab the frame at the 1 Minute Mark.
${f%.mp4}.jpg” -> Grab this from every file, and then name the new file matching the old file, but change the mp4 to jpg.
Now after we do this, it will loop over the directory and create your thumbs. Now please note that for every file, it must open it, jump to the 1 minute mark, take a screenshot, save the new file, and close the video. For me with an i7 still took about 3/5 seconds a video. So this is not an instant process, but if you have hundreds of videos to process, this will take hours if not days off your time.
As you can see, it created the new images and all it working!
Hope this helps you out with some of your thumbnail creation needs!!