Create Screenshots at a specific Timestamp from all Videos in a Folder
A while ago I had some recorded lectures from our university. They all begin with an introduction screen with the date the title of the lecture and what # of lecture. I wanted to automatically sort all those files, add remarks, titles etc. so its easier to watch them, and of course rename them.
For that you can use screen readers (in python etc. what ever you prefer). But first you have to extract screenshots of your video at a specific timestamp. To do that I used FFMPEG.
On Mac OS X you can install FFMPEG like this: (Click)
brew install ffmpeg
Also maybe you have some videos and you want to extract a frame at a specific timestamp. Then you have some nice cover image for YouTube or some other video hosting platform. :)
YouTube not always chooses the right frame for their automatically generated title images.
You can use this little script:
#!/bin/bash
FILES=/Users/jo/Downloads/university_lectures/*
for f in $FILES
do
filename="${f%.*}"
echo "screenshotting: $f ... @9sec";
ffmpeg -y -ss 00:00:09 -i $f -vframes 1 -q:v 2 ${filename}.jpg;
done
This little script just loops all the files in your folder specified at FILES=
then it tells ffmpeg to do an screenschot at the timestamp 00:00:09
(9 Seconds in). And then it saves it as a jpg.
If you want to execute this script. Save this as my_random_filename.sh
. Make the script executable with: chmod +x my_random_filename.sh
and then let ffmpeg do the rest.
If you writing yourself a python script you can of course use ffmpeg python bindings: https://github.com/kkroening/ffmpeg-python and then use the extracted screenshot for your screenreader.
If you liked this little blog, please share like comment what ever :-)