Skip to content

Instantly share code, notes, and snippets.

@carlok
Last active August 8, 2022 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlok/483b61309a6e50a3a753c54b08ce4719 to your computer and use it in GitHub Desktop.
Save carlok/483b61309a6e50a3a753c54b08ce4719 to your computer and use it in GitHub Desktop.
Bash to extract frames from a list of MP4 using FFMPEG
# choose one or the other
# 1
# oneliner: all JPGs in a single folder (don't use it when you are going to have thousands of images)
for i in $(ls 2022_07_*.MP4 | awk -F "." '{print $1}'); do ffmpeg -i $i.MP4 -qscale:v 1 -s 1920x1080 $(printf '%s' $i)_%8d.jpg; done
# 2
# each mp4 generates its own jpg folder
for i in $(ls 2022_07_13_*.MP4 | awk -F "." '{print $1}')
do
mkdir $i
ffmpeg -i $i.MP4 -qscale:v 1 -s 1920x1080 $i/$(printf '%s' $i)_%8d.jpg
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment