-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathevery_nth_frame.sh
More file actions
36 lines (31 loc) · 889 Bytes
/
Copy pathevery_nth_frame.sh
File metadata and controls
36 lines (31 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash -
#===============================================================================
#
# FILE: every_nth_frame.sh
#
# USAGE: ./every_nth_frame.sh
#
# DESCRIPTION: Shell script to get every nth frame
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Dilawar Singh (), dilawars@ncbs.res.in
# ORGANIZATION: NCBS Bangalore
# CREATED: 07/20/2016 11:45:30 AM
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
set -x
set -e
VIDEOFILE=$1
NTH=$2
FRAMEDIR="${VIDEOFILE}_FRAMES"
mkdir -p "$FRAMEDIR"
if [ $# -lt 2 ]; then
echo "USAGE: $0 video_file nth"
exit
fi
ffmpeg -i "$VIDEOFILE" -vf "select=not(mod(n\,$NTH))" \
-vsync vfr "$FRAMEDIR/img_%03d.png"