Skip to content

Commit 224ea0a

Browse files
committed
Adding new weights
1 parent addca30 commit 224ea0a

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

code/mghistory.sh

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
#!/bin/bash
22
# ------------------------------------------------------------------
33
# Description:
4-
# Will add all tiff files in folder into one combined image
4+
# Create motion history (aka "blurring") from a video file.
5+
# Number of frames to include in the history can be specified.
56
#
67
# Usage:
78
# Place in folder with video files
89
# Make executable: chmod u+x [scriptname]
910
# Run script: sh [scriptname]
1011
#
1112
# Dependency:
12-
# Uses ImageMagick
13+
# Uses FFmpeg
1314
#
1415
# Author:
1516
# Alexander Refsum Jensenius
1617
# University of Oslo
1718
#
1819
# Version:
20+
# 0.2 - 2022-01-09
1921
# 0.1 - 2020-03-01
2022
# ------------------------------------------------------------------
2123

2224

2325
if [ -z "$1" ]; then
24-
echo "usage: ./mghistory.sh VIDEO [FRAMES=30]"
26+
echo "usage: ./mghistory.sh VIDEO [FRAMES=10]"
2527
exit
2628
fi
2729

@@ -30,4 +32,12 @@ NAMESTRING=`echo $FILENAME | cut -d'.' -f1`;
3032

3133
FRAMES=$2
3234

33-
ffmpeg -i $FILENAME -filter:v tmix=frames=30:weights="10 1 1" ${NAMESTRING}_history.mp4
35+
if [ -z "$FRAMES" ]; then
36+
FRAMES=10
37+
fi
38+
39+
# Creating weight sequence so that the first frames (the last in the sequence)
40+
# get heigher weights and are more visible
41+
WEIGHTS=`seq $FRAMES`
42+
43+
ffmpeg -i $FILENAME -filter:v tmix=frames=${FRAMES}:weights="${WEIGHTS}" ${NAMESTRING}_history.mp4

0 commit comments

Comments
 (0)