Skip to content

Instantly share code, notes, and snippets.

@kmundnic
Last active March 2, 2020 21:27
Show Gist options
  • Save kmundnic/9701f4dbd0ef1833a690a717d12e06c1 to your computer and use it in GitHub Desktop.
Save kmundnic/9701f4dbd0ef1833a690a717d12e06c1 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Extract frames from the videos of the RECOLA data set. The images are then cropped to squares and resized to 50%.
# The script requires ffmpef and imagemagick installed.
for file in train_*.mp4
do
echo $file
DIR="frames_${file%.*}"
mkdir $DIR
ffmpeg -i $file -frames 300 "$DIR/frame_%d.png"
for image in $DIR/*.png
do
echo $image
convert $image -crop 720x720+280+0 $image # Crop image to a square
convert $image -resize 50% $image # Resize image
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment