Skip to content

Instantly share code, notes, and snippets.

@harrisonlingren
Last active December 5, 2017 00:00
Show Gist options
  • Save harrisonlingren/907a13cabf60c74e280d15b086d5fe3d to your computer and use it in GitHub Desktop.
Save harrisonlingren/907a13cabf60c74e280d15b086d5fe3d to your computer and use it in GitHub Desktop.
Batch convert video files to frames
#!/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
@harrisonlingren
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment