Created
October 15, 2022 20:33
-
-
Save johnnoel/72dc758a4eb1984533b240863b930403 to your computer and use it in GitHub Desktop.
Video file screenshot script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# single video file | |
./screenshotter.sh video.mp4 250 | |
# directory of files | |
find . -type f -maxdepth 1 -printf '"%f"\n' -exec screenshots.sh {} 250 \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/bin/bash | |
duration=$(ffprobe -v quiet -print_format json -show_format -show_streams "$1" | jq -r .format.duration) | |
fps=$(echo "scale=5; $duration / $2" | bc) | |
filename=$(basename "$1") | |
#filename="${filenameonly%.*}" | |
#echo $1 $duration $fps $filename | |
mkdir -p "screenshots/$filename" | |
ffmpeg -v quiet -stats -i "$1" -vf fps=1/$fps "screenshots/$filename/%06d.png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment