Last active
December 5, 2017 00:00
-
-
Save harrisonlingren/907a13cabf60c74e280d15b086d5fe3d to your computer and use it in GitHub Desktop.
Batch convert video files to frames
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 | |
# Batch convert video files to frames | |
# script by Harrison Lingren | |
for file in Video/*; | |
do | |
echo "> Parsing file: $file"; | |
if [ ! -d "${file:6:4}" ]; then | |
echo "> Creating directory ${file:6:4}..."; | |
mkdir "./${file:6:4}"; | |
fi | |
echo "> Saving to: ${file:6:4}/%04d.jpg"; | |
ffmpeg -i "$file" -r 3 ${file:6:4}/%04d.jpg; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires ffmpeg to run. Save your video files in a
Videos/
directory next to the script. Output will be split to directories using the first 4 characters of the video name as directory names.