Last active
February 9, 2017 00:36
-
-
Save varunchopra/c0ac55e01c05e6a003708d622fd6fd1e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
PATH=/bin:/usr/bin:/sbin:/usr/sbin | |
images=20 | |
OLDIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
if [ $1"x" != "x" ]; then | |
file=$1; | |
else | |
read -p "Enter file name: " file | |
fi | |
frames=$(ffmpeg -nostats -i $file -vcodec copy -f rawvideo -y /dev/null 2>&1 | grep frame | awk '{split($0,a,"fps")}END{print a[1]}' | sed 's/.*= *//') | |
offset=$(echo "$frames/$images" | bc) | |
vcs="ffmpeg -loglevel panic -y -i $file -frames 1 -q:v 1 -vf \"select=not(mod(n\,$offset)),scale=-1:200,tile=4x5\" $file.jpg" | |
eval $vcs | |
IFS=$OLDIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment