Created
May 27, 2020 04:22
-
-
Save WSAyan/d54760ded3c4cc9bf6f4676a586dabb2 to your computer and use it in GitHub Desktop.
extracts images from all video files in a directory using ffmpeg
This file contains hidden or 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
# extract images from video file | |
# sh extract-img.sh -e [extension] -fr [frame rate] | |
_ext="" | |
_fr=1 | |
while getopts ":e:o:f:n:" opt; do | |
case $opt in | |
e) | |
_ext="$OPTARG" | |
;; | |
f) | |
_fr="$OPTARG" | |
;; | |
\?) | |
echo "ERROR: Invalid option: -$OPTARG" >&2 | |
exit | |
;; | |
esac | |
done | |
i=0 | |
for file in *.$_ext; do | |
ffmpeg -i $file -r $_fr output_"$i"_%04d.jpeg | |
i=$((i+1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment