You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# credit to https://inphotos.org/2015/11/28/more-fun-with-long-exposure-stacking-of-photos/
5
+
4
6
5
7
# print usage if no params
6
8
if [ -z$1 ];then
7
-
echo"usage: $0 -f <video file> -F <convert evaluate filter > -r <factor to reduce fps captures> -s <start mm:sec.fraction> -S <stabilize video first 0/1>"
9
+
echo"usage: $0 -f <video file> -F <convert evaluate filter > -r <factor to reduce fps captures> -s <start mm:sec.fraction> -S <stabilize video first 0/1> -d <duration of video to capture>"
8
10
echo"for a list of all convert filters, run convert -list evaluate "
9
11
exit
10
12
fi
@@ -16,19 +18,24 @@ for i in ffmpeg ffprobe convert; do
16
18
exit;
17
19
fi
18
20
done
19
-
21
+
pid=$$
20
22
until [[ -z$1 ]];do
21
23
case$1in
22
-
-f) filename="$2";shift ;; # quote this in case video contains spaces
23
-
-F) filter=$2;shift ;;
24
-
-r) reduce_factor=$2;shift ;;
25
-
-s) start_time=$2;shift ;;
26
-
-S) stabilize=$2;shift ;;
24
+
-f) filename="$2";shift ;; # quote this in case video contains spaces
25
+
-F) filter=$2;shift ;;
26
+
-r) reduce_factor=$2;shift ;;
27
+
-s) start_time=$2;shift ;;
28
+
-d) duration_secs=$2;shift ;;
29
+
-S) stabilize=$2;shift ;;
27
30
esac
28
31
shift
29
32
done
30
33
31
34
# need to check the basic requires params of $filename and $filter are all there
35
+
if [ -z$filename ] || [ -z$filter ];then
36
+
echo"At least a filename and filter are required"
37
+
exit;
38
+
fi
32
39
33
40
newvid=new.mp4
34
41
if [ -z$stabilize ] || [ $stabilize== 0 ];then
@@ -51,11 +58,32 @@ else
51
58
python3 -m vidstab -i "$filename" -o $newvid
52
59
fi
53
60
61
+
# optional -s option to start slicing at a certain point in the video - e.g. instable video for the first 10 seconds, pass 11 to start slicing at 11 seconds in.
62
+
if [ -z$start_time ];then
63
+
start_time="-ss 0"
64
+
else
65
+
start_time="-ss $start_time"
66
+
fi
67
+
68
+
# duration - need to
69
+
if [ !-z$duration_secs ];then
70
+
duration_secs="-t $duration_secs"
71
+
fi
72
+
73
+
74
+
# if we get start_time and duration_secs, run those through ffmpeg to create a new video for proper calculations below
75
+
if [ "$start_time"!="-ss 0" ] || [ "$duration_secs"!="" ];then
76
+
mv $newvid tmp_$newvid
77
+
echo"Generating new video based on start time of $start_time and duration : $duration_secs"
# optional -s option to start slicing at a certain point in the video - e.g. instable video for the first 10 seconds, pass 11 to start slicing at 11 seconds in.
echo"Video is $duration seconds long at $fps fps - - will capture $images_per_sec images per second - which should generate $frames images - start at $start_time"
91
113
# note that the -r $fps option placement is important. If places BEFORE the -i it affects the input file rate
0 commit comments