Created
October 5, 2022 18:39
-
-
Save FBoucher/d1649d82d7695952b5358ca5f58e4e44 to your computer and use it in GitHub Desktop.
Script to generate 5 sec animated GIF of all mp4 in the folder and sub-folder
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
clear | |
search_dir="/mnt/c/" | |
files="$(find -L "$search_dir" -type f -name '*.mp4')" | |
echo "Count: $(echo -n "$files" | wc -l)" | |
echo "$files" | while read file; do | |
onlyFilename=$(basename "$file") | |
onlyName=$(basename -s .mp4 "$file") | |
onlyDir="$(dirname "${file}")" | |
echo ..processing: $onlyFilename | |
dkCmd="docker run -v '${onlyDir}':/video jrottenberg/ffmpeg -r 60 -i /video/${onlyFilename} -loop 0 -vf scale=520:-1 -c:v gif -f gif -ss 00:00:01.000 -r 10 -t 5 - > previews/${onlyName}.gif" | |
#echo $dkCmd | |
echo $dkCmd >> ./listOfCmds.txt | |
eval $dkCmd | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment