-
-
Save luruke/927b818debc41228ca89 to your computer and use it in GitHub Desktop.
Generate Frames from videos using ffmpeg
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 | |
for i in videos/webm/*.webm; do | |
if [ -e "$i" ]; then | |
file=`basename "$i" .webm` | |
if ! [[ "$file" =~ ^interview ]] ; then | |
mkdir -p "img/sprites/$file" | |
total_frames=`ffmpeg -i $i -vcodec copy -acodec copy -f null dev/null 2>&1 | grep 'frame=' | cut -f 3 -d ' '` | |
numframes=10 | |
rate=`echo "scale=0; $total_frames/$numframes" | bc` | |
ffmpeg -i $i -f image2 -vf "select='not(mod(n,$rate))'" -vframes $numframes -vsync vfr -y "img/sprites/$file/frame-%d.jpeg" | |
ffmpeg -i $i -f image2 -vf "select='not(mod(n,$rate))'" -vframes 1 -vsync vfr -vf "smartblur=lr=5" -y "img/sprites/$file/blur-frame-%d.jpeg" | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment